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/
<delinquentme> how can i print out a string in raw format .. i mean I
<delinquentme> i'd like to see the \n instead of returns
<seanstickle> returns IS the raw format
<seanstickle> You mean some sort of encoded format
Faris has joined #ruby
<delinquentme> yeah...
<delinquentme> i think?
davidcelis has joined #ruby
burns180 has joined #ruby
mikepack has joined #ruby
Seisatsu has joined #ruby
sacarlson has joined #ruby
stringoO has joined #ruby
<gogiel> delinquentme: p "a\nb"
<gogiel> "a\nb"
<gogiel> puts "a\nb" show return instead of \n
emocakes has joined #ruby
iocor has joined #ruby
<banisterfiend> delinquentme: string dump
<banisterfiend> delinquentme: puts "hello\nlittle duck!\n".dump
<banisterfiend> String#dump even
araujo has joined #ruby
<banisterfiend> delinquentme: that what u want?
pingfloyd has joined #ruby
davidpk_ has joined #ruby
savage- has joined #ruby
ascarter has joined #ruby
Tearan has joined #ruby
lkba has joined #ruby
TrapExit has joined #ruby
shevy has joined #ruby
burns180_ has joined #ruby
mdw has joined #ruby
mxweas_ has joined #ruby
adman65 has joined #ruby
elec2 has quit [#ruby]
Faris has quit [#ruby]
lukehamilton has joined #ruby
<lukehamilton> I am not always connected to the net so I am wondering what is the best way to have ruby and gem documentation install locally? I also use rvm too?
<seanstickle> Gem documentation is automatically installed locally via rdoc and ri unless you intentionally suppress it.
randym_ has joined #ruby
nari has joined #ruby
<banisterfiend> lukehamilton: if you use pry, you dont even need to install the gem docs
<banisterfiend> it'll take waht it needs and only what it needs at runtime from the source files themselves
<banisterfiend> lukehamilton: seanstickle recommends it :)
<lukehamilton> banisterfiend: What's pry??
<seanstickle> I recommend it!
<seanstickle> pry is the world's best IRB replacement
<lukehamilton> link?
<banisterfiend> lukehamilton: http://pry.github.com
<lukehamilton> thanks
<seanstickle> We use it at work instead of IRB
<seanstickle> And we are continually delighted by it.
cpruitt has joined #ruby
i8igmac has joined #ruby
octavio has joined #ruby
maletor has joined #ruby
octavio has quit [#ruby]
BrokenCog has joined #ruby
Mac_ has joined #ruby
CacheMoney1 has joined #ruby
CacheMoney has joined #ruby
CodeZombie has joined #ruby
priteshjain has joined #ruby
blischalk has joined #ruby
burns180 has joined #ruby
libertyprime has joined #ruby
chimkan has joined #ruby
k_89 has joined #ruby
savage- has joined #ruby
ZachBeta has joined #ruby
vitoravelino has joined #ruby
vitoravelino has joined #ruby
glosoli has joined #ruby
baroquebobcat has joined #ruby
sdwrage has joined #ruby
ZachBeta has joined #ruby
apeiros_ has joined #ruby
fbernier has joined #ruby
S1kx has joined #ruby
vitoravelino`afk has joined #ruby
vitoravelino has joined #ruby
mdw has joined #ruby
burns180_ has joined #ruby
jbhewitt has joined #ruby
Nathandim has joined #ruby
glosoli has quit ["Leaving"]
QaDeS_ has joined #ruby
wallerdev has joined #ruby
jameshyde has joined #ruby
igotnolegs has joined #ruby
liluo has joined #ruby
tomku has joined #ruby
SegFaultAX has joined #ruby
etank has joined #ruby
compcube has joined #ruby
burns180 has joined #ruby
al3xnull has joined #ruby
blueadept has joined #ruby
Seisatsu has joined #ruby
Vert has joined #ruby
savage- has joined #ruby
amerine has joined #ruby
rpenguin has joined #ruby
shtirlic_ has joined #ruby
flingbob has joined #ruby
Vert has joined #ruby
burns180_ has joined #ruby
stephenjudkins has joined #ruby
rushed has joined #ruby
vortixo has joined #ruby
<vortixo> hi
<vortixo> can i make a question ?
maletor has joined #ruby
td123 has joined #ruby
<A124> vortixo: Do you know the rule of "Don't ask to ask." ?
<vortixo> ok sorry
sacarlson has joined #ruby
<vortixo> i have this fuctions that allows me to interpolate between 2 values
<vortixo> how can i extend this to use more than 2 values?
<vortixo> f =      { |in1, in2, frac|
<vortixo>                        in1 =in1;
<vortixo>                        in1 + (frac * (in2 - in1)) };
Hanmac1 has joined #ruby
<seanstickle> I'm pretty sure that isn't Ruby.
etank has joined #ruby
<Squarism> how do i read the complete contents of a file that isnt text?
adeponte has joined #ruby
<Squarism> rather binary
<seanstickle> Squarism: IO.read(file)
<Squarism> date = IO.read(file)
<Squarism> ?
<Squarism> data = ...
<seanstickle> Unless you're on Windows, of course
<vortixo> its a general function seanstickle
<seanstickle> vortixo: meaning what?
<seanstickle> vortixo: that you're pretending it's Ruby?
iamjarvo has joined #ruby
drbawb has joined #ruby
<Squarism> IO.read seems to work very wellt
<Squarism> thanks
<banisterfiend> vortixo: this is meaningless: "in1 =in1;"
<vortixo> seanstickle: the idea is you call the fuction in this way
<banisterfiend> pointless*
<vortixo> f.value( 0, 5, 1);
<vortixo> the first 2 values are the values to interpolate and the third is the value for index
<seanstickle> I must be missing something. You can define a function in Ruby like f = {|x| x } ?
<A124> vortixo: if you change the definitions, it whould work in Ruby, but this is not a Ruby.
<A124> Ruby would be "def something (in, in2, frac);  in1 + (frac * (in2 - in1)); end
<vortixo> index goes fom 0 to 1
<vortixo> if i do this : f.value( 0, 5, 1); i get as result 5
sako has joined #ruby
<seanstickle> Ah, ok, so I didn't forget something
<vortixo> if i do this: f.value( 0, 5, 0); i get 0
<vortixo> if i do this f.value( 0, 5, 0.5); i get as result 2.5
<vortixo> is it clear?
<seanstickle> vortixo: except, your code is not Ruby
<Squarism> hmm.. now.. i would like to invoke a shell command, and pipe the data ive read onto stdin for that shell command. Is that possible?
<A124> *def something (in1, in2, frac); 
<vortixo> its not ruby its a general fuction
<seanstickle> What is a "general function"?
<vortixo> dont worry about the sintaxis, my question is more about the algorithm
<vortixo> how to implement the function
<banisterfiend> vortixo: then why dont u ask on #C, if the syntax isnt relevant ? ;)
burns180 has joined #ruby
<banisterfiend> vortixo: if you want help from rubyists at least write your code in ruby
<banisterfiend> vortixo: or seanstickle will you kill and your entire family
<banisterfiend> no jokes
<banisterfiend> ok jokes :
ascarter has joined #ruby
<banisterfiend> )
<seanstickle> I won't kill anyone. I will just pester them with junk mail.
<Squarism> anyone know how to pipe data to a shell command?
<Squarism> `awk ....` << rubyvar
<Squarism> sort of ?
<vortixo> ok sorry
<vortixo> i dont know ruby
BrokenCog has joined #ruby
<A124> The problem is.. how you want to extend it?
<seanstickle> vortixo: if you don't know Ruby, you're asking in the wrong place.
<seanstickle> vortixo: unless you are trying to implement this in Ruby.
xlogic has quit [#ruby]
drbawb has joined #ruby
mvangala_ has joined #ruby
sacarlson has joined #ruby
Sgeo_ has joined #ruby
luxurymode has joined #ruby
lebro has joined #ruby
abstrusenick has joined #ruby
cpruitt has joined #ruby
neohunter has joined #ruby
mikeric has joined #ruby
startling has joined #ruby
baroquebobcat has joined #ruby
<sgronblo> Is there a Hash method that assigns a value and returns the hash?
neurodrone has joined #ruby
neurodrone has joined #ruby
<A124> What do you mean?
startling has quit [#ruby]
<seanstickle> sgronblo: a = {}; a.merge({b: 1})
<A124> Ok, you was faster and smarter
<A124> class Hash; def assign( key, value); self[key] = value; self; end
<A124> * class Hash; def assign( key, value); self[key] = value; self; end; end
<seanstickle> Ooh, don't do that.
<A124> Yes, as I said, you are smarter.
<seanstickle> Ha
<A124> But anyway, why I shouldn't?
krz has joined #ruby
<A124> Except that your's a (lot) better.
<seanstickle> Don't muck around with core classes like that. Bad side effects are inevitable.
<A124> Ok. So if I don't add it to class, is it still ok?
moshee has joined #ruby
moshee has joined #ruby
<A124> And I must agree, assign is really bad name if I wanter to do that anyway.
eko has joined #ruby
eko has joined #ruby
<A124> Thanks anyway ;)
<kW> Hello! How do I convert a filename as created by Tempfile.open() from UNIX-style "c:/file/name" to windows-style "c:\file\name" in a generic manner? something like file.localfilename
<A124> "c:/file/name".gsub(/\//, '\')
burns180_ has joined #ruby
fayimora_ has joined #ruby
<A124> *"c:/file/name".gsub(/\//, '\\')
<A124> Sorry, my mistake.. I haven't escaped the latter
<Sgeo_> vortixo, why not ask in here?
<A124> kW: ^^
<lebro> i too am waiting for that
<A124> Some people just don't like to Thank / reply :_ú
amerine has joined #ruby
flingbob has joined #ruby
mdw has joined #ruby
sroy2_ has joined #ruby
priteshjain has joined #ruby
krz has joined #ruby
chimkan has joined #ruby
blueadept has joined #ruby
timonv has joined #ruby
adit has joined #ruby
tux__ has joined #ruby
Marco has joined #ruby
burns180 has joined #ruby
dankest has joined #ruby
amerine has joined #ruby
ysiad has joined #ruby
thecreators has joined #ruby
Liothen_ has joined #ruby
priteshjain has joined #ruby
<Blaster> anyone know why this code is throwing an error, it says it's missing something after my final statement? http://pastebin.com/aq2CaMUL
<Blaster> (simple code)
Sgeo_ has quit ["Leaving"]
maletor has joined #ruby
c0rn has joined #ruby
robertjpayne has joined #ruby
csherin has joined #ruby
<heftig> Blaster: ++ is not ruby
<td123> Blaster: open up irb and see how you can increment a variable
dv_ has joined #ruby
neohunter has joined #ruby
<td123> or see heftig's for a direct answer :P
philips has joined #ruby
<Blaster> but I'm using ++ in IRB to increment a hash value
<Blaster> demo = {}; demo['test'] = 1; demo['test']++
<heftig> that doesn't work.
<td123> Blaster: and did irb print out a value?
<banisterfiend> Blaster: demo['test'] += 1
<td123> Blaster: irb will just continue if the line is seemingly incomplete
<Blaster> i typed them as seperate lines
<Blaster> and it incremented to 2
<td123> impossible
<Blaster> I'm being honest
radic has joined #ruby
<banisterfiend> Blaster: prove it by pasting your code
i8igmac has joined #ruby
<heftig> ++ will be interpreted as a binary + and an unary +, so it's not a complete expression
burns180_ has joined #ruby
rohit has joined #ruby
dbgster has joined #ruby
<Blaster> hmm
<Blaster> so what would be the right way?
<tux__> can someone take a look at my make log: http://pastebin.com/aq2CaMUL
<td123> you were already given the right way by banisterfiend + several hints..
ascarter has joined #ruby
<banisterfiend> Blaster: demo['test'] += 1
drbawb has joined #ruby
kah has joined #ruby
<Blaster> This must be wrong... words.each { |key| freqs[key] += 1 }
<adit> tux__ : bad link
<Blaster> am I allowed to use key variable to define the hash key?
<banisterfiend> Blaster: Yeah
<tux__> adit, sorry, http://pastebin.com/itTCYzRA
<banisterfiend> deryl: you here?
<Blaster> banisterfiend: I'm getting "undefined method '+' for nil:Nilclass"
<tux__> then that var doesnt exist
kah_ has joined #ruby
<banisterfiend> Blaster: freqs = Hash.new { |h, k| h[k] = 0 }
<banisterfiend> put that outside your loop
<tux__> or Hash.new(0)
<banisterfiend> hehe, better that ^
<adit> tux__: unsure
vortixo has quit [#ruby]
<Blaster> what's the |h,k| h[k] = 0 do?
<banisterfiend> Blaster: never mind about it, use freqs = Hash.new(0) instead
ZeepZop has joined #ruby
<banisterfiend> put that outside your loop
kah has joined #ruby
<Blaster> I'm just curious what the other one does, looks interesting
<banisterfiend> Blaster: it calculates the default value based on evaluation of a block
adit has quit [#ruby]
kah has joined #ruby
<sgronblo> So wait, don't defs have access to local variables around them? What's the scope of local variables in the top scope of a file?
<banisterfiend> sgronblo: they dont
<banisterfiend> sgronblo: local to top-level
<sgronblo> So I'd have to define it as a $global in this case?
<banisterfiend> sgronblo: i'd say you dont have to do either and that you're likely doing something weird ;)
fai|safe has joined #ruby
<banisterfiend> sgronblo: but if it's a simple script you're writing ina procedural style, you could just use @ivars instead
<banisterfiend> sgronblo: so long as you're only invoking the methods at top level
<sgronblo> It's a simple script to be used with script/runner
sleetdrop has joined #ruby
mxweas_ has joined #ruby
burns180 has joined #ruby
ZachBeta has joined #ruby
MrGando has joined #ruby
pen has joined #ruby
fai|safe has joined #ruby
nari has joined #ruby
abstrusenick has joined #ruby
looopy has joined #ruby
sizz has joined #ruby
abstrusenick has joined #ruby
rippa has joined #ruby
hessrs has joined #ruby
<hessrs> Hello, quick question on ruby Modules
<hessrs> Would a good comparison for modules be that they're like large #define blocks in C or C++?
<heftig> no.
<hessrs> Ah, ok
<hessrs> It seemd like methods defined in the module were just pasted in where they were imported, regardless of context
<hessrs> How is that unlike a define in c?
fbernier has joined #ruby
seanstickle has joined #ruby
<heftig> module M; def a; :m; end; end; class C; def a; :c; end; include M; end; C.new.a
<heftig> that returns :c, not :m
flingbob has joined #ruby
<heftig> an included Module becomes part of the ancestry chain of the class
<pen> are there any ruby libraries or gem that provides cipher AES with CTR mode?
<heftig> it doesn't just insert the methods where you include
Vert has joined #ruby
<hessrs> I see, thanks
td123 has joined #ruby
burns180_ has joined #ruby
igotnolegs has joined #ruby
stepnem has joined #ruby
MissionCritical has joined #ruby
<Blaster> any built in methods for taking a http query string and turning it into a hash ?
macmartine has joined #ruby
Zolrath has joined #ruby
i8igmac has joined #ruby
sayem has joined #ruby
<rippa> Blaster: CGI.parse
chimkan has joined #ruby
mxweas_ has joined #ruby
nobitanobi has joined #ruby
<nobitanobi> is there a cleaner/shorter way of doing this: @type == 'unused' || @type == 'expired'
OldGeezer has joined #ruby
burns180 has joined #ruby
bgupta has joined #ruby
<tux__> nobitanobi, ['expired', 'unused'].include? @type
<tux__> newb
nobitanobi has joined #ruby
<tux__> nobitanobi, ['expired', 'unused'].include? @type
<nobitanobi> tux__: thanks
<tux__> now if you're using that in an iteration that could be huge
<tux__> each time it runs it creates two new strings in a new array
<nobitanobi> ok, thanks for the advice
<tux__> you could save performance by doing state1 = ['expired', 'unused']; requests.each { |r| if state1.include?(r) then ... }
<tux__> then its just a local and gets cleaned up
<tux__> thats if you're doing more than say 10,000 iterations or so
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
undersc0re has joined #ruby
OldGeezer has quit [#ruby]
jgrevich has joined #ruby
jgrevich has joined #ruby
CheeToS has joined #ruby
amerine has joined #ruby
kp666 has joined #ruby
hadees has joined #ruby
albemuth has joined #ruby
burns180_ has joined #ruby
kp666 has joined #ruby
nobitanobi has joined #ruby
gokul has joined #ruby
kawa_xxx has joined #ruby
tyman_ has joined #ruby
kawa_xxx_ has joined #ruby
wmoxam_ has joined #ruby
mxweas_ has joined #ruby
flingbob has joined #ruby
tommyvyo has joined #ruby
mikeric has joined #ruby
supergiantrobot has joined #ruby
gianlucadv has joined #ruby
dhruvasagar has joined #ruby
Synthead has joined #ruby
choffstein has joined #ruby
nobitanobi has joined #ruby
ZachBeta has joined #ruby
rpenguin has quit [#ruby]
AndChat- has joined #ruby
nobitanobi has joined #ruby
amerine has joined #ruby
al3xnull has joined #ruby
undersc0re has joined #ruby
undersc0re has joined #ruby
ZachBeta has joined #ruby
burns180_ has joined #ruby
Quirrell has joined #ruby
Quirrell has joined #ruby
<Blaster> Hey when I use this it's printing to multiple lines, how do I make this print on only 1 line? puts 'You voted' , votes , ' times'
mikeric has joined #ruby
<Quirrell> puts "You voted #{votes} times"
bananas has joined #ruby
greenarrow has joined #ruby
<Blaster> thanks
<Quirrell> No prob
timonv has joined #ruby
<bananas> hi! i'm using sequel with MySQL, sinatra, and ruby 1.9.3... and i can't get utf-8 to work. does anyone know THE solution?
<bananas> i've been googling and trying different things for hours now.
x0F_ has joined #ruby
Synthead has joined #ruby
ryanf has joined #ruby
tonini has joined #ruby
mxweas_ has joined #ruby
nobitanobi has quit [#ruby]
Morkel has joined #ruby
sacarlson has joined #ruby
trivol has joined #ruby
snip_it has joined #ruby
savage- has joined #ruby
burns180 has joined #ruby
Keva161 has joined #ruby
pencilcheck has joined #ruby
burns180 has joined #ruby
Gesh has joined #ruby
odinswand has joined #ruby
k_89 has joined #ruby
burns180_ has joined #ruby
savage- has joined #ruby
albemuth has joined #ruby
danderson has joined #ruby
yxhuvud has joined #ruby
<danderson> Hi. If I define a string as x = 'a #{b} c', how can I tell ruby to do the variable expansion at a later point?
mikeric has joined #ruby
<danderson> specifically, I want to define a bunch of URLs with #{} substitutions in a configuration, and then expand those later when the vars they reference are in scope
<banisterfiend> danderson: u need to keep a reference to the binding where the locals are defined
<danderson> I'm sorry, that made no sense. Could you point me at some docs or an example?
<banisterfiend> danderson: you mean it made no sense to you or are you accusing me of making no sense in general
<danderson> it made no sense to me. My ruby-fu is very weak :)
<banisterfiend> ah
<banisterfiend> danderson: you could try this: x = proc { "x #{b} c" }
<danderson> aha, I see. Crafty :)
burns180 has joined #ruby
Vadim has joined #ruby
<Vadim> guys can somebody help with simple script?
anupadhikari has joined #ruby
<anupadhikari> plese help, how would i remove all the punctuation from a string
<anupadhikari> i tried variable.gsub(/[^A-Za-z]/, '') but it removes space between the words too, but i want to keep the space
KL-7 has joined #ruby
<Gesh> I see on docs punctuation character for regexp /http://en.wikipedia.org/wiki/Special:Search?go=Go&search=:punct:/
<Gesh> oops
<ryanf> anupadhikari: you can just add " " or \s next to A-Za-z to keep spaces
<SpitfireWP> Why not just do variable.gsub(/[^A-z0-9\s]/, '') ?
<ryanf> [^A-Za-z ]
<ryanf> yeah
Targen has joined #ruby
<SpitfireWP> variable.gsub(/[^A-z0-9\s]+/, '') might be more efficient, not sure...
amerine has quit ["Quit"]
<Gesh> 'Punctuation character' on page http://www.ruby-doc.org/core-1.9.3/Regexp.html a can't paste it itself :)
<Hanmac> i think Gesh means: /[:punct:]/ right?
senthil has joined #ruby
<Gesh> yep
<anupadhikari> ryanf, thanks works perfect
<anupadhikari> SpitfireWP, thanks
anupadhikari has quit ["Ex-Chat"]
burns180_ has joined #ruby
QaDeS has joined #ruby
burns180_ has joined #ruby
mafolz has joined #ruby
kawa_xxx has joined #ruby
bashdy has joined #ruby
GoBin has joined #ruby
quest88 has joined #ruby
i8igmac has joined #ruby
benvds has joined #ruby
burns180 has joined #ruby
ph^ has joined #ruby
adman65 has joined #ruby
gokul has joined #ruby
zommi has joined #ruby
QaDeS has joined #ruby
Squarism has joined #ruby
etehtsea has joined #ruby
<pencilcheck> I want to extend IO class, what's the name of the variable to the file itself?
ephemerian has joined #ruby
fr0gprince_ has joined #ruby
wookiehangover has joined #ruby
trivol has joined #ruby
nachtwandler has joined #ruby
sspiff has joined #ruby
stoffus has joined #ruby
c0rn has joined #ruby
burns180_ has joined #ruby
c0rn_ has joined #ruby
lucaspiller has joined #ruby
denysonique__ has joined #ruby
pantsman has joined #ruby
pi3r has joined #ruby
kaneda_ has joined #ruby
bier has joined #ruby
tyman has joined #ruby
<pen> is there any recommended rdiff lib for ruby?
<A124> Try a gem
<A124> (blind shot)
libertyp1ime has joined #ruby
odinswand has joined #ruby
samsonjs has joined #ruby
samsonjs_ has joined #ruby
mikeric has joined #ruby
samsonjs_ has joined #ruby
cyri_ has joined #ruby
libertyp1ime has joined #ruby
Spockz has joined #ruby
burns180 has joined #ruby
alesguzik has joined #ruby
fowl has joined #ruby
InBar has joined #ruby
abstrusenick has joined #ruby
benvds has joined #ruby
benvds has joined #ruby
gen0cide_ has joined #ruby
reason has joined #ruby
mechanicalturk has joined #ruby
nemesit has joined #ruby
drake_ has joined #ruby
burns180_ has joined #ruby
shruggar has joined #ruby
LMolr has joined #ruby
libertyp1ime has joined #ruby
robertjpayne has joined #ruby
flippingbits has joined #ruby
abstrusenick has joined #ruby
arturaz has joined #ruby
stnly has joined #ruby
bluOxigen has joined #ruby
stnly has quit [#ruby]
arturaz has joined #ruby
jlebrech has joined #ruby
Talvino has joined #ruby
Squarism has joined #ruby
libertyp1ime has joined #ruby
Asebolka has joined #ruby
drake_ has joined #ruby
sdwrage has joined #ruby
yeggeps has joined #ruby
ukwiz has joined #ruby
<pen> could someone tell me how to use rrdiff? I installed the gem and tried require 'rrdiff' but ruby said it could not find it
KJF has joined #ruby
KJF has joined #ruby
<A124> pen: I guess, if you have ruby 1.8.x, you have done: require 'rubygems', right?
n8ji has joined #ruby
d3vic3 has joined #ruby
<pen> A124: I am using 1.9.x
<pen> A124: and yes I did require 'rubygems'
<Hanmac> pen: use "gem which rrdiff"
shellox_ has joined #ruby
<shellox_> hi
<pen> Hanmac: interesting, it says it could not find it. but if I do gem list rrdiff is in the list
eka has joined #ruby
emmanuelux has joined #ruby
<pen> Hanmac: also I put it in Gemfile
<pen> installed the gem with bundler
<Hanmac> hm thats bad .. (why didnt you install it with install command?)
<pen> btw, is this case sensitive?
<pen> Hanmac: oh, should I do gem install but not bundle?
<Hanmac> yeah i think
<Hanmac> when you can install the gem with install, you should use it
i8igmac has joined #ruby
n1x has joined #ruby
<pen> Hanmac: but if I require 'rubygems' it should work with bundler right?
<pen> I mean
<pen> I followed the instructions on the bundler homepage
<A124> /usr/lib/ruby/gems/1.8/doc/rrdiff-0.9.0
<shellox_> What's the best library for building Jabber bots today? There exists a lot of libraries, but the most seems unmaintained now..So can anyone recommend an lib, which allow me to build an event-driven bot ;)?
<pen> so bundler doesn't install the gem for me?
InBar has joined #ruby
<Hanmac> i dont know ... and yeah the commands should be case sensitive
<A124> It's in 1.8
<pen> that's weird
<A124> And I have 1.9
<A124> That's the problem
<pen> also bundler doesn't install the gem for me
Vert has joined #ruby
<A124> pen: it did
<pen> A124: oh, it's in 1.8?
<A124> Yes
<pen> that's weird
<pen> is there a way to force it to 1.9?
<A124> I just posted you the path
drake__ has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
<pen> A124: i'm using homebrew, so rrdiff does not install to the dir you posted
<A124> mv /usr/lib/ruby/gems/1.8/gems/rrdiff-0.9.0/ /usr/lib/ruby/gems/1.9/gems/rrdiff-0.9.0/ ?
<A124> Just the easy way xD
<A124> Ah.
<A124> Then use 'find / | grep "rrdiff-0.9.0"'
<A124> find / | grep "rrdiff-0.9.0"
<pen> ok
<pen> also it does not install into ruby 1.9.x path in homebrew
<pen> that's weird
<A124> Ok. I have fault on my side also.
<A124> But it's weird also.
<pen> gem which rrdiff returns not found
<pen> there should be a command in rubygems to show the path of the installed gem
<pen> right?
<pen> "/usr/local/lib/ruby/gems/1.9.1/doc/rrdiff-0.9.0"
<pen> interesting
<pen> so it is installed
<A124> The which does that.. but rrdiff has no documentation, so the gem fails
<pen> oh, but it works for me, it generated the rdoc
<pen> so no errors during installation
<pen> but why can't ruby find the library?
<pen> it's in the path
yeggeps has joined #ruby
Spockz has joined #ruby
<banisterfiend> pen: maybe the name ofthe file to require is different to the gem name
<pen> banisterfiend: where can I find out?
<banisterfiend> pen: ill tell u in a sec
<A124> IDK
<Hanmac> and that is that what wich should returns :(
libertyp2ime has joined #ruby
<pen> Hanmac: oh, maybe the author didn't specify the name?
<banisterfiend> pen: did the install fail?
<banisterfiend> pen: you need the "lsync" library
adambeynon has joined #ruby
<pen> banisterfiend: yes, I have it
<banisterfiend> lrsync
<pen> banisterfiend: it is installed with no errors
<pen> the gem
francisfish has joined #ruby
<pen> and I checked mkmf.log it also says i have the lib and the cflag
<pen> so the gem is installed
<Hanmac> gem content rrdiff
<A124> The thing is. I don't see any rb files
<pen> A124: it's a c ext
<banisterfiend> pen: 'cd' into the folde rreturned by `gem which` and have a look around in the lib/ directory there
<A124> (gem content)
<pen> Hanmac: 4 paths returned and that's where I found the gem
<banisterfiend> A124: that looked lke a failed install
<banisterfiend> pen: can you cd into the gem's lib folder and tell me what files you have there
Vert has joined #ruby
<A124> Yes. It did failed. But after instalation. It failed on documentation.
<banisterfiend> A124: so what? :)
<pen> banisterfiend: hold on
<banisterfiend> it didnt fail on pen's system, so we have to consider his cse
<banisterfiend> case*
<shellox_> damn, i can't find a good framework for this in ruby
<shellox_> i could combine eventmachine + xmpp4r or so..
mdw has joined #ruby
<pen> banisterfiend: was trying to find an online paste site, http://pastie.org/3524620
<pen> this is the output for gem content rrdiff
<banisterfiend> pen: you seriously dont know about github and gists? :)
<pen> banisterfiend: ohhhh, gist!!! i totally forgot
<banisterfiend> pen: looks like it failed for u too
<pen> oh
<banisterfiend> pen: show the context of the log
<pen> hmm
<shevy> pen: gimme ur money
<pen> shevy: $$$$$$$$$$$$$ here you go
<pen> that's all I have
<A124> LoL, gist.. awesome
<pen> banisterfiend: https://gist.github.com/1977635
<pen> now in gist
<pen> this is the mkmf.log
<shevy> where is the error
<pen> dunno
<shevy> oh cool
<pen> i'm confused about this too
<shevy> llvm-gcc :)
<shevy> didn't see that before
<shevy> this is part of llvm?
<pen> that's on lion
<shevy> or gcc
<pen> yea
<pen> that's llvm enhanced gcc
<shevy> oh ok
<pen> backend replaced by llvm
<pen> that's it
<pen> banisterfiend: do you mean mkmf.log?
<shevy> well I think there are some gems that do that actually
<banisterfiend> pen: it lokos like he forgot to add the .c files to the gemspec https://github.com/abhiyerra/rrdiff/blob/master/rrdiff.gemspec
kp666 has joined #ruby
<pen> ha
<shevy> hehe
<pen> damn it
<shevy> detective banisterfiend
<pen> is there a way to fix that?
<banisterfiend> pen: also it's 2 years old
<pen> that's the only one for rsync that I could find
<banisterfiend> pen: built it from the git repo
<banisterfiend> build
bluenemo has joined #ruby
<pen> banisterfiend: is there a short tutorial for that?
<pen> banisterfiend: also how do you fix his gemspec then?
<banisterfiend> pen: Yeah
burns180_ has joined #ruby
<pen> banisterfiend: haha, this is funny. found one from maccman: http://proxy.nwang.info/github.com/maccman/rrdiff
<pen> banisterfiend: so how do I build from github?
<A124> Yeah, you looked essentialy at forks, just as I did xD
<banisterfiend> pen: clone the repo
btfriar has joined #ruby
<banisterfiend> pen: then: gem build blah.gemspec
<A124> banisterfiend: Funny commit xD
<banisterfiend> then gem install blah.gem
<pen> banisterfiend: ok
<pen> and I know maccman, he is in the spine.js channel
<pen> lol
DuoSRX has joined #ruby
<A124> Yes, he is.
<A124> It's his work.
<A124> Anyway. That rrdiff version is working.
<A124> You should be all good.
gianlucadv has joined #ruby
sako has joined #ruby
sako has joined #ruby
<pen> cool
<pen> yea
<pen> looks like it is working, but I want to extend class File but I don't know how to do it properly because I'm getting segfault :S
roderyk has joined #ruby
roderyk has quit [#ruby]
<banisterfiend> pen: run it in gdb
<pen> banisterfiend: run the ruby code in gdb?
<banisterfiend> pen: yeah
<pen> how do I do that?
polysics has joined #ruby
<banisterfiend> pen: gdb ruby
<banisterfiend> r path/to/ruby/file.rb
<pen> banisterfiend: can I call rspec in it?
<banisterfiend> pen: do you need to?
hoipolloi has joined #ruby
<banisterfiend> it's kind of of a pin
<banisterfiend> pain
<pen> well, I have a rspec to test the code, so I am running rspec to test
<pen> I mean rspec_test file
<banisterfiend> pen: why dont you try to generate the segfault outside of rspec?
<pen> with describe end
<pen> banisterfiend: even then I can't bt in gdb, it returns some obscure functions
<polysics> interesting issue
<polysics> apparently, FFI on my machine has stuff dying left and right
<polysics> i am trying to use Celluloid to run some actors
tatsuya_o has joined #ruby
<polysics> same code on Debian works properly
<banisterfiend> pen: you mean functions without names? you probabl have to recompile the extension with debugging symbols and try -O0 too
<polysics> i have a Snow Leopard machine with XCode 4.2, and thus LLVM, installed
<polysics> what could I try to fix that?
<pen> banisterfiend: I found the line segfaulting now
<banisterfiend> pen: using gdb?
schovi has joined #ruby
al3xnull has joined #ruby
<pen> banisterfiend: not without names but name that has nothing to do with the code
trivol has joined #ruby
<pen> banisterfiend: like internal functions
<banisterfiend> pen: can you trace it to a line in the c function too?
<banisterfiend> pen: keep going up the stack to find a funciton you recognize
<banisterfiend> pen: iim guesisng it's a GC issue
<pen> banisterfiend: could you take a look at this and see if I made any mistake, i'm not sure if tempfile is working or not :P https://gist.github.com/1977690
<pen> banisterfiend: I run with rspec again and it shows where it segfault
<pen> banisterfiend: on line 13
<polysics> anyone knows how i could tell Bundler to compile something with GCC isntead of LLVM, please?
<banisterfiend> pen: u need to find the *C* function that's segfaulting and step through it
<shevy> polysics no idea, I couldnt get bundler to work at all for me
<pen> banisterfiend: hmm, I don't know how to do that, not even know how to set breakpoint in ruby code
<pen> banisterfiend: this is my test: https://gist.github.com/1977695
<banisterfiend> pen: you need to learn how to use debuggers baby :P
<pen> banisterfiend: ahh, that's a skill I just keep forgetting after not using for awhile
<polysics> or even where does one start investigating such an issue
Guest8577 has joined #ruby
cha1tanya has joined #ruby
<polysics> issue is "Celluloid, which uses libev through FFI, works on my DEbian machine and not on my Snow Leopard with LLVM one"
<shevy> polysics well truth be told, this is the first time I heard that bundler can be used to compile something actually
<shevy> it seems like another layer of complexity on the pyramid of layers
<pen> banisterfiend: I wonder if I am doing something wrong with tempfile
<shevy> sounds complex :)
<polysics> shevy: bundler itself does not compile anything - but it will compile native xtens for gems
<pen> banisterfiend: also File mixin
<polysics> astually, gem will do that
<banisterfiend> pen: get shevy to help, he's an 31337 C hax0r
<pen> shevy: will you?
becom33 has joined #ruby
<becom33> my require doesn't work ? http://pastebin.com/U0HiMesv
<pen> shevy: I am not sure if I'm doing the right thing in my test
<shevy> hey
<pen> and my rdiff.rb too
<shevy> I do not know C
<shevy> banisterfiend however write many C extensions in ruby
<shevy> checkout method-source or whats-its-name
<pen> shevy: but my code is in ruby...
<shevy> I never saw rdiff before
<shevy> tempfile I used before in the past
<shevy> decided to hate it (hahaha)
<A124> pen: Can you give me your complete testfiles?
<pen> A124: that's it, in that fist
<pen> gist
<shevy> lol
<shevy> it is in my fist now!
<pen> :D
mengu has joined #ruby
<pen> A124: I only wrote one test
<shevy> and the part that fails is - test_file.rsync_signature.should
<shevy> ?
<A124> The problem I got is NameError: uninitialized constant RDiff
<shevy> perhaps those two tempfiles just are not equal
<shevy> or perhaps never can be
<pen> A124: you missed the other file, the rdiff.rb I posted on the other link
<pen> A124: I was trying to do something with mixin
workmad3 has joined #ruby
<A124> Thank you
mdw has joined #ruby
<pen> helper.rb is just a line to unshift PATH to include the file
<pen> you can remove that line
<pen> I don't know why I get segfault though
<pen> A124: any clue?
sohocoke has joined #ruby
<A124> Not yet. I got stuck with something else, sorry.
polysics has quit [#ruby]
emocakes has joined #ruby
<shevy> hehe
<shevy> shooting at kittens right!
<A124> Which ruby ? 1.9.3 1.9.4?
sohocoke has joined #ruby
<A124> pen: ^^
<pen> A124: 1.9.2p290
<shevy> hehehe
TaTonka has joined #ruby
<A124> Ok. Compiling
nethad has joined #ruby
senthil has joined #ruby
<pen> A124: compile? oh, you mean for librsync?
<A124> No, Ruby 1.9.2
<pen> oh
<pen> but do I have any syntax error for mixin?
<pen> and
<A124> idk, I have midnight, so by now I don't think much xD
<pen> I'm not sure self.path will return the current instance.path
yeggeps has joined #ruby
<A124> Where can I get describe?
burns180 has joined #ruby
<A124> My bad it seems I forgot rspec
dhruvasagar has joined #ruby
skim1776 has joined #ruby
skim1776 has quit [#ruby]
gregorg has joined #ruby
gregorg has joined #ruby
Mac_ has joined #ruby
<A124> pen: Can you gove me exact one paste I should test?
<A124> I find no problems.
emocakes has joined #ruby
EddieS has joined #ruby
berserkr has joined #ruby
davidpk has joined #ruby
kedare has joined #ruby
supergiantrobot has joined #ruby
k_89 has joined #ruby
<A124> pen: ok. You had some typos. The test fails. But not by segmentation fault.
alvesjnr has joined #ruby
alvesjnr has quit [#ruby]
monzie has joined #ruby
alvesjnr has joined #ruby
Shrink has joined #ruby
alvesjnr has quit ["Leaving"]
d3vic3 has joined #ruby
yeggeps has joined #ruby
kawa_xxx has joined #ruby
<A124> pen: Sorry, my brain is out. Got it to rest. Good luck, if you are here.
<A124> If you have anything, send me amessage
<A124> rspec rrdiff_spec.rb
<A124> Finished in 0.002 seconds
<A124> 3 examples, 0 failures
DuoSRX has joined #ruby
burns180_ has joined #ruby
KarlFreeman has joined #ruby
Foxandxss has joined #ruby
tayy has joined #ruby
philcrissman has joined #ruby
srp_ has joined #ruby
<shevy> hmmm
<shevy> I have a string like:
<shevy> a = 'abc def ghi "jki lmn" opq'
<shevy> I split it at ' '
<shevy> but it should exclude parts of the string that are enclosed in "
<shevy> so "jki lmn" should not be split
<shevy> hmmm anyone has an easy but elegant suggestion?
arguser has joined #ruby
<A124> split, split, join, just stupid
<shevy> ah ok
<shevy> I came up with this solution too ;) I am glad if others come to the same hehe
<shevy> thanks A124
<A124> or.. gsub
nethad has joined #ruby
<shellox_> meh, how to use active_support without rails
<arguser> hello
mdw has joined #ruby
<arguser> I'm getting this:
<arguser> WARNING: You don't have /home/arch/le/.gem/ruby/1.8/bin in your PATH, gem executables will not run
<arguser> (using rvm)
<arguser> How i should proceed to solve this?
<shellox_> I just want to have date, time and the zones from it, not the whole lib..
interlocutor has joined #ruby
<arguser> seems like suddenly gems are beign installed on .gem instead of .rvm/gem/$rubyversion/---
<msch> is def var ||= initalize_var in any way special/optimized over if not var ; var = initialize_var ; end ; var ?
<A124> shevy: oddly I just made reverse of the function you wanted xD
Helius has joined #ruby
<A124> arguser: source ~/.bash_profile
<A124> You should read instruction when you install something I guss.
mrake has joined #ruby
ChampS666 has joined #ruby
<A124> msch: I guess yes, it is.
<arguser> i didnt get this error before
<A124> The first runs in C, the latter in Ruby
<A124> So even on 1.9.4 there should be difference. .. Said well enough? :)
<msch> A124: ah, fudge. is there a nice pattern for ||= if the initialization takes many lines?
<arguser> A124: im using zsh
<A124> msch: It depends. If you have multiline and have something which does not run really fast, you could go just with if; then; end
<A124> I cannot say exactly as I don't know your specific case.
<msch> A124: well it's the current_user code in my controller, so it should run as fast as possible. would be nice to have something like @current_user ||= do … end
jm_ has joined #ruby
flippingbits has joined #ruby
<rippa> begin ... end
<msch> rippa: ah right! thanks so much!
<A124> Yes, exactly
<A124> msch: You could wrapt anything in begin; end;
<A124> (I meant in any case)
<msch> yep, totally forgot about that. thanks
<A124> Welcome, but it was rippa who was faster and came with that :)
becom33_ has joined #ruby
<pen> hey
<pen> A124: ?
<pen> A124: what typo?
Andromeda has joined #ruby
<A124> idk. I don't already remember. But I run rspec test (not your) without problem
<pen> A124: can you post your test?
<pen> A124: oh, you mean his test?
probst has joined #ruby
<A124> Yes. But changed to work.
<A124> pen:
MrGando has joined #ruby
<A124> Before I go fall asleep: Anybody knows of a good solution to download parse and store few milion pages?
emocakes has joined #ruby
<workmad3> A124: slowly? :)
<workmad3> A124: or map-reduce it
<A124> Fst
zul_ has joined #ruby
<A124> *Fast.
<A124> I'm not familiar with map-reduce t be honest.
<workmad3> A124: you basically pass out parts of the work to lots of machines, each one does a bit of the work (this is the 'map' stage). You then gather results in somehow and process them into one result set (the 'reduce' stage)
zul_ has joined #ruby
<workmad3> A124: you're not going to be able to do it in a fast, robust way on a single machine though
<A124> Ok. I checked out the wiki and I got the idea.
<zul_> hi all could anybody help me (I'm newbie in ruby) to solve a problem with padrino rake and the mysql db?
<A124> workmad3: Oh, you meant that.
<workmad3> A124: yeah, I was thinking of the map-reduce style of distributed computing
<A124> workmad3: Wiki has another explanation xD
<workmad3> A124: something like hadoop ;)
cyberpj has joined #ruby
<A124> I was thinking about distributed
<A124> And a distributed server with a queue.
cyberpj has quit [#ruby]
<A124> But. I meant more in-depth idea.
nari has joined #ruby
<A124> workmad3: But thanks for pointing me, the map-reduce idea heped me in other (data processing) manner.
<workmad3> A124: well, you only gave a very high-level description, you can't get in-depth answers from that ;)
<workmad3> A124: after all... what do you mean by parsing? what storage are you looking at? what are the important criteria for your processing? (e.g. is it more important to be correct or fast?)
burns180 has joined #ruby
<workmad3> A124: in all honesty, I don't even know if a map-reduce style approach would be a good idea (or a queue system, or something like a DRb cluster...) without more details :)
<workmad3> A124: and in addition... designing that sort of system is worth big-bucks :)
undersc0re has joined #ruby
<A124> workmad3: By parsing mean doing anything, one page at a time.
ickmund has joined #ruby
jhunter has joined #ruby
<A124> workmad3: What do you mean by 'correct'?
<workmad3> A124: that would be a question I'd ask you if I was designing the solution ;)
<A124> Storage is subject to the question.
<A124> workmad3: And designing system is very wide term.
<workmad3> A124: the storage influences the design... I'd probably go for a different style of storage if I was going map-reduce compared to if I went distributed queue, and I'd want to pick a storage system based on what would store the end-result best
<workmad3> A124: basically, creating a distributed processing system is a big task... you're not going to get a very in-depth answer from a single question on a public IRC channel :)
BrianE has joined #ruby
<workmad3> A124: and it all boils down to trade-offs
<A124> workmad3: End result will be set of data will be essentialy strings
<workmad3> A124: in case you hadn't already realised though... I'm not going to actually design this system for you
<A124> And about the queue, I could do all back and forth
<workmad3> A124: just giving you pointers in roughly the areas I'd consider :)
<A124> Ok. Depend on interpretation.
banseljaj has joined #ruby
<A124> I didn't wanted to design, but it could be a possible help.
<workmad3> A124: for example, you're suggesting a queue system... have you considered the locking strategy for tasks in the queue?
<A124> I ask for a possible options, good options.
sgmac has joined #ruby
<workmad3> A124: good options depend massively on what you're doing
BrianE has joined #ruby
<A124> As I said. Download a lot of pages, process one by one, then store
<workmad3> A124: and 'downloading, parsing and storing millions of pages' isn't enough information to determine that from :)
<A124> For me, it is, so I don't know in what to be specific
bashdy has joined #ruby
<workmad3> A124: even 'download' isn't enough information to determine what you're doing... are you following redirects? do you ignore 404s? or 500s? do you also download resources like images and stylesheets or javascript files?
<A124> And yes, I have considered queing and locking. And in that connection I got another idea, thanks to you conected with that.
iocor has joined #ruby
<workmad3> A124: as for parse... are you creating a DOM and serialising? are you looking through for some information? what are you storing? are you wanting it for archive purposes or for fast retrieval and query?
<A124> Only text pages, not bigger data, I don't care about redirects, I can get a list of links. But I do care about errors
laxus has joined #ruby
<workmad3> A124: all of this feeds into what would constitute a good solution :)
yeggeps has joined #ruby
<A124> workmad3: Oh. I'm not familiar with DOM approach. But I get what it means.
<workmad3> A124: and are you going to do the download in advance or in parallel with the parsing? If you're doing it in parallel, have you considered whether you'll reach your internet connection saturation? If you're doing it in advance, you need to make sure you have enough disk space to store it all
<A124> And I already said I store strings.
<workmad3> A124: and I've said that isn't enough information for me to give you solid recommendations
<A124> Fast retrieval and querry as well as storage.
<A124> (one part querry, second storage)
<workmad3> A124: chances are you're not going to get both :P
<workmad3> A124: so pick which one is more important
<A124> I mean two data sets.
<A124> One querry, one storage.
<workmad3> A124: right, so what happens if a storage operation succeeds with your query storage but not with your archive?
<workmad3> A124: or vice-versa?
ChampS666 has joined #ruby
<workmad3> A124: as I said, this isn't simple 'do it this way' stuff :)
<A124> right, so what happens if a storage operation succeeds with your query storage but not with your archive?
<A124> I don't get that.
<workmad3> A124: you said you had two data sets, one for querying, one for long-term storage
<workmad3> A124: what happens if your save suceeds with one set and not with the other?
<A124> I have thought a lot of it already.. so I haven't come with an empty hands demanding answer :)
<A124> Save has to succeed with both. But it's also a good thing to point out, thank you.
lorandi has joined #ruby
<A124> And also processing in parallel
<A124> Parallel download, parallel procesing.
<A124> Connection saturation should not be an issue I guess, or I don't see what you exactly mean.
<workmad3> A124: well, have you calculated how much network bandwidth you expect each node to need for optimal processing and whether your network can handle it?
mdw has joined #ruby
<A124> I did not. And I should, yes.
yeggeps_ has joined #ruby
<workmad3> A124: this isn't a place for guessing... you need to break out the calculator and make estimates, verify them, see whether you have spare capacity, etc :) and you should also make sure you're not likely to hit any monthly limits, maybe even consider if you'll hit traffic management on your network by being a 'high user'?
<workmad3> A124: basically... think about anything that could go wrong and how you could potentially handle or recover from it :)
<A124> workmad3: And you do that good, thank you very much.
<workmad3> A124: including things like servers melting, network connections failing, hard drives failing :)
<A124> No limits, mothly or bandwidth.
QaDeS has joined #ruby
<workmad3> A124: no *explicit* limits you mean? ;)
* CacheMoney is going to sleep
<workmad3> A124: there's always a limit... it's just whether you know it or not :)
CacheMoney has quit ["Leaving"]
burns180_ has joined #ruby
<A124> No, I guess there is not.
<workmad3> A124: still, you probably have enough to think about now and I thought you were going to sleep? ;)
<A124> Just pay for additional bandwidth
<workmad3> A124: paying for more bandwidth isn't always an option
<A124> Thats a location #1
conor_ireland has joined #ruby
<A124> It depends on price
<workmad3> A124: and maybe it doesn't matter... you need to determine how much speed you need, whether adding an extra node is worthwhile
<workmad3> etc
<A124> Some people pay by Gigabyte, some by Terabyte
<workmad3> A124: the important thing is to have considered it and know what tradeoffs you're making regarding it ;)
<A124> Oh. and about the limit, location #2 has no limits and no measurings even
<A124> Yes. Indeed.
<workmad3> A124: then, when your client or manager comes and says 'can you make this run faster?' you can say 'sure, we just need to buy 10 more nodes, and upgrade our network bandwidth. It'll cost you $10,000'
seanstickle has joined #ruby
<A124> I'm not managing or owning servers.
<A124> But thank you for warning me.
<workmad3> A124: see, that's important info... so are you renting datacentre resources? do you know how reliable the datacentres are?
sacarlson has joined #ruby
<arturaz> Fetching source index for http://rubygems.org/ takes a long time
<arturaz> is it down? :?
<workmad3> arturaz: define 'long time'?
<A124> workmad: Yes. Yes, estimately.
<arturaz> workmad3, more than 5 minutes
<A124> arturaz: Yes, it's not loading.
<A124> Timing out.
<arturaz> can i tell bundler to skip this? :/
<arturaz> i only need lockfile to be created
<workmad3> arturaz: looks like it could be then :) and no, bundler kinda needs that info in order to know about gems and dependencies
Chat0738 has joined #ruby
nethad has joined #ruby
<workmad3> arturaz: it's the information from that which bundler uses to create the lockfile
<A124> workmad3: If one server fails, the work can be replaced by others at a cost of added time. Except the distribution server
<workmad3> A124: ok... and what do you do if the distribution server melts?
<A124> Which.. I guess, should be somehow mirrored to failover.
<A124> I didn'trealized that till now.
<A124> Oh, you already asked it.
<A124> workmad3: (I was reading your message after I wrote that)
<workmad3> A124: sounds like an idea... synchronous replication? it'll take longer but you won't lose work. Asynchronous replication?
<workmad3> A124: do you want to replicate it in the same data centre or in a different region? or maybe both?
<A124> Different datacentre is in my case now different region. So, probably both.
<JonnieCache> workmad3: you should be charging big bucks for this consultancy :)
<workmad3> JonnieCache: good point :)
<arturaz> does RG have a mirror? :/
<A124> And a peer backed asynchronous replication should do performance and safety both I guess.
<workmad3> A124: it'll have some lag... you need to decide if it's too much, or how you can handle it
<workmad3> A124: and in all honesty... I think we have reached the end of what I can really do for free ;)
<A124> workmad3: and in all honesty.. i was considering, if I should 'thank' you somehow.
<A124> ;) :D
yeggeps has joined #ruby
bluOxigen has joined #ruby
<workmad3> A124: heh
undersc0re has joined #ruby
undersc0re has joined #ruby
<A124> workmad3: All in all, thanks a lot. You pointed out very important things, which are not to be overlooked. In my case are ok. And I also got some more ideas directry and indirectly. I really appreciate your help. I'm now of brain. I guess I will reread it after. Thank you very much. And for now, see you.
bluOxigen has joined #ruby
<workmad3> A124: have fun :)
<A124> workmad3: Thank you.
<A124> You also.
steakknife has joined #ruby
thone_ has joined #ruby
<steakknife> rubygems down?
cantonic has joined #ruby
<arturaz> steakknife, yes, but going back to life
<cantonic> hey guys. How can I make a ruby script run from beginning?
srp_ has joined #ruby
<arturaz> cantonic, eh?
<steakknife> arturaz: thanks for the link
<cantonic> arturaz: well, i have a ruby script and need to make it restart itself
<arturaz> you can't
<arturaz> or really - shoudn't
<arturaz> why do you want to do this?
burns180 has joined #ruby
<steakknife> it's possible to have script restart itself, but it's really messy.
<cantonic> arturaz: well, under some circumstances i need to run the script from its first line and dunno how to do that
<cantonic> i need something like "jump to first line"
<arturaz> wrap everything up in a function and call yourself :)
mklappstuhl has joined #ruby
LMolr has joined #ruby
<cantonic> arturaz: wouldn't that be more messy? :)
<steakknife> cantonic: can you put some actual code in a pastie/gist somewhere?
<arturaz> cantonic, no
<JonnieCache> dont have it call itself
<JonnieCache> as the callstack gets deeper the interpreter gets slower
<steakknife> the other pattern to use, like for retrying connections, is raise / retry
<cantonic> steakknife: wouldn't make sense because it is nothing specific to my code actually but a general question
<JonnieCache> and eventually you'll get a StackTooDeep exception
<cantonic> JonnieCache: i thought that too. what would be the alternative?
<rippa> exec() your script
<JonnieCache> have another process spawn the first script over and over again in a loop
<cantonic> rippa: but that wouldn't close my script. would it?
<JonnieCache> i imagine some of those process monitoring things like god or monit can do it
<rippa> exec replaces running process with another
<cantonic> JonnieCache: you mean a script which looks for the process to be ended and then starts it?
<JonnieCache> cantonic: yes. but the exec() idea is good too
sgmac has quit [#ruby]
<steakknife> one potential use-case i can see is creating a script that auto-installs missing gems and reruns itself.
<cantonic> ok, thank you guys. would be just exec("ruby script.rb") right?
<JonnieCache> try it
<steakknife> of course, use bundler / gemsets for most cases **
<cantonic> steakknife: it is some automation stuff for our company where it checks content on a specific website. but sometimes there are errors and in that case the script needs to run from the beginning
<cantonic> thank you guys.
<JonnieCache> oh well if it doesnt need to run forever why dont you just put an until or while loop inside the script?
<steakknife> you might want to just throw an exception and retry, it's faster and uses fewer resources.
<JonnieCache> yes
<JonnieCache> i thought you wanted it to run forever
<JonnieCache> hmm even then why didnt i just tell you to use a loop... monday morning
<cantonic> JonnieCache: it does need to run forever. but at the beginning of the script it opens the browser and goes to that website etc and after that I have a loop. I will break the loop on error and but exec("ruby script.rb") right after the loop
<JonnieCache> try different options and monitor the memory usage over time until you find something that is acceptable
<cantonic> and i thought maybe it is quite good for system resources if the script restarts from scratch
<cantonic> yeah that's nice. Should install some monitoring stuff...
iamjarvo has joined #ruby
<JonnieCache> the hting you need to worry about is gradual accumulation of RAM if the script leaves hanging objects
<JonnieCache> yeah exactly
tk__ has joined #ruby
<cantonic> nice nice :) you have been a good help guys :) thank you
<JonnieCache> killing and restarting the interpreter is goingto garauntee against building of RAM
<JonnieCache> buildup*
<steakknife> might want to use god and restart if it goes over X MB
<JonnieCache> but i suppose it will churn the OS cache... experiment to find whats best
<cantonic> well i dunno if god works fine on windows
iocor has joined #ruby
<steakknife> ugh, anyone know of getting god working on windows?
<JonnieCache> i doubt if its even possible
<cantonic> nobody uses ruby on windows normally :D
<JonnieCache> the windows process model is very different
kaiwren has joined #ruby
<JonnieCache> surely windows servers have extensive process monitoring built in?
<steakknife> except my client i guess
<cantonic> me too… just have to do it because of a gem called "au3" which only runs on windows… and already had been a pain to get it running like that. windows sucks
Beoran_ has joined #ruby
yeggeps has joined #ruby
<JonnieCache> the windows Services system is basically god i think
<steakknife> JonnieCache: according to my client, it doesn't do so much.
<JonnieCache> fail
<steakknife> JonnieCache: need something like daemontools / god to keep a process running if it dies
<cantonic> i'm in love with ubuntu normally… and quite happy with it...
<JonnieCache> there must be an equivalent solution. i bet it costs $$$$$
<steakknife> JonnieCache: f that
<steakknife> JonnieCache: perhaps god under mingw / cygwin (ikk)
<cantonic> steakknife: keeping a process running shouldn't be that hard. would just need to write a script which checks if process still alive and if not opens that process
<JonnieCache> youd be sruprised how complex it gets actually
nethad has joined #ruby
<steakknife> cantonic: you'd think, but this is winDOwS.
<JonnieCache> once you get into locking pidfiles it suddenly gets a little messy
<steakknife> JonnieCache: also windows doesnt natively have signals either
<cantonic> steakknife: yeah right… but this simple task should be easy… even for win-ddos :)
etank has joined #ruby
<JonnieCache> oh yeah. lol
randym_zzz has joined #ruby
<cantonic> steakknife: maybe AutoHotkey could handle it :P
<steakknife> catonic: on the plus side, my client's willing to contribute to open source.
johndbritton has joined #ruby
<JonnieCache> ive kinda walled off the win32 internals part of my brain like it was a memory of childhood abuse
<JonnieCache> which it kindof is
<steakknife> hahaha
<cantonic> hehehehe. JonnieCache FTW!
<steakknife> i used to be win sys admin, hope you dont hold it against me ; D
ccapndave has joined #ruby
<cantonic> i still hate my parents for buying me a PC when I was a child :D
liluo has joined #ruby
pu22l3r has joined #ruby
burns180_ has joined #ruby
<steakknife> make sure your kids then start with linux or at least macs. :)
wookiehangover has joined #ruby
visof has joined #ruby
visof has joined #ruby
yeggeps_ has joined #ruby
ephemerian has joined #ruby
lorandi has joined #ruby
lorandi has joined #ruby
<JonnieCache> im *just* old enough to have started on dos
<JonnieCache> thankfully
TaTonka has joined #ruby
<banisterfiend> JonnieCache: config.sys autoexec.bat
<JonnieCache> yeah had lots of adventures with extended memory settings in config.sys tring to get midi to work in dune II
<JonnieCache> the good (bad) old days
<steakknife> qemm ftw
j0bk has joined #ruby
<pen> can anyone try to install https://github.com/maccman/rrdiff and run the test to see if it works? it keeps crashing on me
<steakknife> pen: is that librsync-0.9.7?
<pen> steakknife: should be
<steakknife> pen: it built and installed, now what?
burns180 has joined #ruby
burns180 has joined #ruby
jds has joined #ruby
fayimora_ has joined #ruby
<steakknife> pen: boom! it crashes
<pen> yea
<pen> I couldn't make it work
<steakknife> pen: RRDiff.signature("README", "Rakfile")
<steakknife> ^-- [sic]
<steakknife> cnat splel Rakefile
<steakknife> pen: anyhow, might want to try writing a C test prog for librsync and see if that works.
nari has joined #ruby
<pen> steakknife: I think the current setup should be fine
cha1tanya has joined #ruby
<pen> steakknife: you compile with -lrsync
<pen> steakknife: I have written a c prog using librsync successfully
<steakknife> pen: it was built however gem install chooses.
seitensei has joined #ruby
neurodrone has joined #ruby
berkes has joined #ruby
<pen> steakknife: I don't know if it is built using the right cflags or lib, include path
<steakknife> pen: LIBS = $(LIBRUBYARG_SHARED) -lrsync -lpthread -ldl -lobjc
<steakknife> ^ --- ~GEM_HOME/gems/rrdiff-0.9.0/ext/Makefile
nanderoo has joined #ruby
<pen> steakknife: yea, that should be fine
<pen> steakknife: I hate that the test is not configured properly
<pen> steakknife: can't test it right away
<steakknife> pen: argh.
<pen> steakknife: 2 years old of crap, I don't know too much how rubygems works
<pen> steakknife: the c code looks ok, but if I run the gem with my test file it segfaults
<steakknife> pen: have the c test prog on pastesite? i can verify if librsync works at least.
<pen> steakknife: how?
<pen> steakknife: oh
<JonnieCache> i like http://hastebin.com its very minimal
<pen> steakknife: are you on mac?
<steakknife> JonnieCache: cool. PiratePad is also kinda neat.
emmanuelux has joined #ruby
tomzx has joined #ruby
burns180_ has joined #ruby
<matti> Hm.
<matti> Logger, why do you rotate my log files ;/
<steakknife> Are there any simple etherpads with code highlighting? (would be nice to have integrated git too)
cantonic has joined #ruby
<steakknife> pen: the testfile segfaults :(
<pen> steakknife: oh? why?
canton7 has joined #ruby
<pen> steakknife: interesting
<pen> steakknife: do you have both files "oldfile" and "sigfile" exist on your hd and next to the code?
<pen> steakknife: do you install librsync from homebrew
<pen> ?
<steakknife> steakknife: macports, see the gist :)
<pen> which gist?
Shrink has joined #ruby
<steakknife> yours
imsplitbit has joined #ruby
<pen> steakknife: ok, so yours segfault too
<pen> interesting, can you tell me which line?
LMolr has joined #ruby
KarlFreeman has joined #ruby
<steakknife> pen: gist updated with gdb trace.
<pen> oh
<pen> I see your comments
<pen> now
<steakknife> pen: looks like a bad call to feof
<pen> I guess it might be something to do with rs_file_open
<pen> can you try open?
<pen> instead?
<pen> steakknife: or fopen
akemrir has joined #ruby
<pen> steakknife: gist updated
<steakknife> pen: the error is actually in the rs_sig_file call
<pen> hmm
<pen> interesting
<pen> steakknife: try to compile librsync locally and remove it from macports
<pen> steakknife: Something is wrong with the compilation I guess because I have another project in pure C where it uses librsync static library and it works with no segfaults
<pen> steakknife: but I don't know why it segfaults in the first place
<pen> so weird
td123 has joined #ruby
g0bl1n has joined #ruby
fris has joined #ruby
kawa_xxx has joined #ruby
fr0gprince_mac has joined #ruby
francisfish has joined #ruby
<pen> steakknife: yea, they uses fopen
<pen> steakknife: can you try again with fopen instead of rs_file_open?
<fris> can i use ruby from the console like i can with perl like perl -e , ruby -e ?
davidpk has joined #ruby
<steakknife> fris: try it ;)
<JonnieCache> fris: yes
tommyvyo has joined #ruby
burns180_ has joined #ruby
<shevy> hmm to load and save a yaml file, a hash
<shevy> I can use YAML.dump and hash.to_yaml to store it, and just @hash = YAML.load_file("where/it/is/stored.yml") lateron?
<shevy> or did I forget something... this hash stores how many times I played a song
<shevy> with entries in that hash, file_name -> number_of_times_being_played
<JonnieCache> thats pretty much how it works
<shevy> okies JonnieCache
<JonnieCache> it just calls to_yaml recursively on the object graph i think
<JonnieCache> so you can definite it yourself for custom classes
<pen> steakknife: wow, I think fopen works
<steakknife> pen: fopen on sig argument FTW
<pen> steakknife: yea, looks like rs_open_file is bugged
<pen> steakknife: can't believe that librsync has bugs with it's open file
<pen> lol
<steakknife> pen: yeah, rs_file_open apparently in either arg crashes
iocor has joined #ruby
yeggeps has joined #ruby
srp_ has joined #ruby
<pen> steakknife: oh ok
<pen> steakknife: but I wonder if it is still been actively maintained
Synthead has joined #ruby
undersc0re has joined #ruby
Vert has joined #ruby
<steakknife> pen: me *shrugs*. does sf have an adverse possession rule for unmaintained projects?
chaitanya_ has joined #ruby
al3xnull has joined #ruby
cha1tanya has joined #ruby
chaitanya_ has joined #ruby
<pen> steakknife: ha, yea it looks like it is abandoned
<steakknife> pen: i would still file it anyhow.
cha1tanya has joined #ruby
<steakknife> pen: otherwise, we just wasted time for other people.
tayy has joined #ruby
ikaros has joined #ruby
<pen> steakknife: maybe
azbarcea___ has joined #ruby
<steakknife> pen: bug feedback is important. maintainer may decide to fix it.
fearoffish has joined #ruby
<JonnieCache> at the very least other users will be able to see that someone else has the big
<JonnieCache> *bug
albemuth has joined #ruby
<steakknife> JonnieCache: exactly. waiting for other people to take action is a non-starter.
<pen> steakknife: yea, changed it to fopen now it works
<pen> steakknife: at least for signature
geekbri has joined #ruby
<steakknife> pen: it seems to crash for me on the file to hash as well.
nari has joined #ruby
tayy_ has joined #ruby
<pen> steakknife: signature?
<steakknife> pen: on the base parameter
<steakknife> pen: that is, using rs_file_open on either parameter.
<pen> steakknife: oh yea, that must be bugged
<JonnieCache> yay rubygems.org is back
<JonnieCache> steakknife: http://xkcd.com/979/
dr_bob has joined #ruby
`brendan has joined #ruby
dankest1 has joined #ruby
dhruvasagar has joined #ruby
vraa has joined #ruby
<steakknife> JonnieCache: :D
etank has joined #ruby
<`brendan> morning folks
choffstein has joined #ruby
<steakknife> pen: looks like rs_file_open is basically just a call to fopen https://gist.github.com/1978442
S1kx has joined #ruby
<shevy> oh
<shevy> when I have a file like:
<shevy> foo.txt
<shevy> is there a way to find out whether this is actually a yaml file or not?
ceej has joined #ruby
<shevy> YAML.load_file seems to return false if it is not a yaml file
<steakknife> shevy: probably better not to put checking code in. it's faster to just catch an exception if it fails.
philips has joined #ruby
<shevy> hmm it does not fail though, it just returns false.
s_dana has joined #ruby
dr_bob has quit [#ruby]
<shevy> ah well, I removed the old file, and made a new file, now things work anyway
fbernier has joined #ruby
<steakknife> shevy: i got a Psych::SyntaxError
<shevy> oh
<JonnieCache> just raise your own error when it returns false
<shevy> that's interesting steakknife, I'll keep that in mind
<steakknife> shevy: 1.9.3?
<JonnieCache> bear in mind that YAML can point to different parsing engines
<shevy> yeah, perhaps I should switch to json eventually :D
sbanwart has joined #ruby
<steakknife> json is vaild yaml. yaml is not necc valid yaml. ; )
<pen> steakknife: ha
emocakes has joined #ruby
<pen> steakknife: well, I have no idea then
crankycoder has joined #ruby
<steakknife> pen: file a bug, move on. :)
<pen> steakknife: will do later :D
KarlFreeman has joined #ruby
<steakknife> pen: yeah, right. ;P
<shevy> :)
<shevy> click on it!
bglusman has joined #ruby
<shevy> oh
<shevy> end.each do |the_lang|
<shevy> ever saw this before? I have not yet
drbawb has joined #ruby
drbawb has joined #ruby
<JonnieCache> in ruby everything is an expression
<shevy> hehe
<JonnieCache> so everything returns something
<JonnieCache> including blocks
boonedocks has joined #ruby
<steakknife> shevy: it fails with begin end -> { } , which would be expected.
flingbob has joined #ruby
KarlFreeman has quit [#ruby]
samuel02 has joined #ruby
<steakknife> shevy: parens around the first block fixes the code.
manizzle has joined #ruby
<jlebrech> how do I make a case statement run more than one line of code?
Morkel has joined #ruby
<shevy> jlebrech what do you mean
<shevy> user_input = $stdin.gets.chomp
<shevy> case user_input
<shevy> when 'a'
<shevy> do_this
<shevy> when 'b'
<shevy> do_that
<shevy> end
ChampS666 has joined #ruby
<jlebrech> when "something" then five lines
<shevy> I still don't get it hehe
<shevy> when 'something'
<shevy> hi
<shevy> y = 5+5
<shevy> puts 'what do you mean'
iMe has joined #ruby
<jlebrech> i keep getting unexpencted keyword kend
cantbecool has joined #ruby
<jlebrech> think i was missing then
<shevy> jlebrech let me use my meta powers to read your code from afar
* shevy concentrates ...
<shevy> yeah I can see your error clearly now!
mdw has joined #ruby
<jlebrech> oh right, what is it?
<shevy> but the other mere mortals here could benefit from you using something like pastie.org
<shevy> because you know they lack those awesome meta powers
stringoO has joined #ruby
<canton7> jlebrech, you've got random 'do's floating around. 'do' is a ruby keyword
Drewch has joined #ruby
<canton7> jlebrech, also, you don't need the 'then's
<jlebrech> i know :P
<shevy> indent when along the case
<jlebrech> something and there aren't really part of my code either
mrake has joined #ruby
<shevy> jlebrech: http://pastie.org/3526266
<shevy> well substitute with part of your code
<shevy> or concentrate on your meta magic and your arcane powers
<jlebrech> can you control my fingers from where you are and code it for me?
axl_ has joined #ruby
johnmilton has joined #ruby
<shevy> hmm
<shevy> with my meta powers I deduce that your code is too horrible
<shevy> it must be rewritten
blischalk has joined #ruby
<hoipolloi> jlebrech: Is this what you mean? https://gist.github.com/1062f5bb34f198eece28 multiple statements in each branch?
<jlebrech> hoipolloi yeah that's what i wanted to do :)
<hoipolloi> well that gist works for me
<shevy> that's because you know ruby!
phantasm66 has joined #ruby
headius has joined #ruby
carlyle has joined #ruby
asobrasil has joined #ruby
<ccapndave> Does anyone here use RubyMine/IntelliJ ?
jesly has joined #ruby
dv310p3r has joined #ruby
KL-7 has joined #ruby
csexton has joined #ruby
iocor has joined #ruby
caiges has joined #ruby
Cookie123 has joined #ruby
LBRapid has joined #ruby
burns180 has joined #ruby
okhra has joined #ruby
<okhra> I have a string variable, temp= "howdy" how do I dynamically create @howdy using only temp ?
theRoUS has joined #ruby
<okhra> any help ? thanks
ryannielson has joined #ruby
aqua has joined #ruby
<aqua> hi
<aqua> first time here, is this "official" channel?
neurodrone has joined #ruby
neurodrone has joined #ruby
<JonnieCache> sort of
iamjarvo has joined #ruby
boonedocks_ has joined #ruby
<JonnieCache> the official channel for the actual ruby language development is #ruby-lang
<aqua> ok thanks
<aqua> but this has more people
<aqua> what should i do when the system says "your nick name is registered, pls change another one"
<aqua> maybe occupied or something
<JonnieCache> it means someone else has already claimed it
iocor has joined #ruby
aqua has quit ["Leaving"]
aqua has joined #ruby
<aqua> but nothing happens if i dont change the nick, why?
mikepack has joined #ruby
<okhra> can I request some help on ruby ?
bragh has joined #ruby
drake_ has joined #ruby
bragh has quit [#ruby]
<aqua> just shoot
<matled> aqua: /msg nickserv help or help ghost. the person who registered the nick may reclaim it.
<matled> but you're free to use the nick as long as this does not happen
<becom33_> using a "while true" I can write a simple prompt right ?
<becom33_> me anyone >
* becom33_ anyone ?
drizz has joined #ruby
<aqua> maybe you should try loop{} , and what do u mean by promp
drizz has joined #ruby
<aqua> *prompt
<aqua> @matled thanks~
<aqua> i'm reading how to register a nick
<becom33_> a simple prompt like "inline"
<becom33_> aqua:
rippa has joined #ruby
<aqua> i don't get it . r u talking about ruby?
<becom33_> yea I need a simple prompt . like terminal . methods as commands
<becom33_> aqua:
NotMyself has joined #ruby
<aqua> maybe you need to check out ARGV
<becom33_> not ARGV . umm how can I explain this .. ;/
<becom33_> :/
<aqua> thats where ruby keeps the params from shell
<aqua> u mean keep an eye on the user's input?
<becom33_> ok we have linux terminal right ?
<aqua> you mean like a telnet?
<becom33_> somthing like that . but I need the methods as commnds
<becom33_> aqua: not telnet
<becom33_> oh wait
<becom33_> have you heard of metasploit?
burns180_ has joined #ruby
<aqua> well, i think u should ask another one,i am a newbie:P
<becom33_> :/ wait lemme show somthing then maby you might be able to help
wyhaines has joined #ruby
coucher has joined #ruby
libertyp1ime has joined #ruby
vipaca has joined #ruby
Sailias has joined #ruby
fbernier has joined #ruby
Vert has joined #ruby
caiges has joined #ruby
bbttxu has joined #ruby
nachtwandler has joined #ruby
mikepack has joined #ruby
timonv has joined #ruby
cpruitt has joined #ruby
bluOxigen has joined #ruby
blueOxigen has joined #ruby
aqua has joined #ruby
jlogsdon has joined #ruby
<seoaqua> nick changed, lol
ysiad has joined #ruby
albemuth has joined #ruby
CK_afk has joined #ruby
Marco has joined #ruby
Spockz has joined #ruby
snip_it has joined #ruby
Sailias has joined #ruby
s_dana has joined #ruby
conor_ireland has joined #ruby
kuzushi has joined #ruby
drbawb has joined #ruby
drbawb has joined #ruby
burns180 has joined #ruby
burns180 has joined #ruby
seoaqua has joined #ruby
seoaqua has joined #ruby
mikepack has joined #ruby
bwlang has joined #ruby
ckrailo has joined #ruby
tvw has joined #ruby
ckrailo has joined #ruby
priteshjain_ has joined #ruby
s_dana has joined #ruby
luxurymode has joined #ruby
carlyle has joined #ruby
savage- has joined #ruby
DrShoggoth has joined #ruby
drknus has joined #ruby
godfrey999 has joined #ruby
d3vic3 has joined #ruby
LBRapid_ has joined #ruby
LBRapid has joined #ruby
Mattias has joined #ruby
bwlang_ has joined #ruby
macabre has joined #ruby
Mattias has quit ["WeeChat 0.3.7"]
baroquebobcat has joined #ruby
wmoxam has joined #ruby
godfrey999 has joined #ruby
j0bk has quit ["Leaving"]
virunga has joined #ruby
ph^ has joined #ruby
pen has joined #ruby
virunga_ has joined #ruby
virunga has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
bwlang_ has joined #ruby
Squarism has joined #ruby
Mattias has joined #ruby
IAD has joined #ruby
radic has joined #ruby
havenn has joined #ruby
apow has joined #ruby
MasterIdler_ has joined #ruby
burns180_ has joined #ruby
boonedocks has joined #ruby
snip_it_ has joined #ruby
zul_ has joined #ruby
boonedocks_ has joined #ruby
artOfWar has joined #ruby
cha1tanya has joined #ruby
wookiehangover has joined #ruby
bwlang_ has joined #ruby
sdeobald_ has joined #ruby
eywu has joined #ruby
lorandi has joined #ruby
artOfWar has joined #ruby
yoklov has joined #ruby
Seisatsu has joined #ruby
CannedCorn has joined #ruby
lkba has joined #ruby
adambeynon has joined #ruby
tangledhelix has joined #ruby
flak has joined #ruby
theanalyst has joined #ruby
Ramtin has joined #ruby
lorandi has joined #ruby
fayimora has joined #ruby
Natch has joined #ruby
savage- has joined #ruby
rippa has joined #ruby
bwlang has joined #ruby
bnhymn has joined #ruby
Ramtin has quit [#ruby]
KJF has joined #ruby
mdw has joined #ruby
nemesit has joined #ruby
cbuxton has joined #ruby
gianlucadv has joined #ruby
scott- has joined #ruby
macmartine has joined #ruby
<scott-> is RVM still a good way of installing the latest Ruby on OSX Lion?
eldariof has joined #ruby
fayimora has joined #ruby
KaiSforza has joined #ruby
<JonnieCache> i prefer rbenv and ruby-build
<JonnieCache> which you can both conveniently install with homebrew
adeponte has joined #ruby
<JonnieCache> others disagree
<scott-> cool I'll look into them. cheers
n1x has joined #ruby
k_89 has quit ["Leaving"]
kenperkins has joined #ruby
timonv has joined #ruby
mattonrails has joined #ruby
cloke_ has joined #ruby
pantsman has joined #ruby
friskd has joined #ruby
derekbarber has joined #ruby
chimkan_ has joined #ruby
adeponte has joined #ruby
timonv has joined #ruby
pdtpatr1ck has joined #ruby
daniel_hinojosa has joined #ruby
maletor has joined #ruby
<geekbri> when you do a .each on an array, it is guaranteed to execute in order right? (unlike say a hash)
<rippa> yes
<Mattias> geekbri: I'd assume so since an array is index-based
<rippa> actually, hash guaranteed too
SegFaultAX|work has joined #ruby
<rippa> in 1.9
<geekbri> oh is that so?
fayimora_ has joined #ruby
<rippa> in 1.8 hashes are unordered
fayimora has joined #ruby
<Mattias> rippa: in which order? alphabetical?
<Mattias> for hashes
<rippa> in order of insertion
conor_ireland has joined #ruby
scott- has joined #ruby
Cicloid has joined #ruby
Marco has joined #ruby
dr_bob has joined #ruby
ph^ has joined #ruby
burns180_ has joined #ruby
badabim has joined #ruby
bragh has joined #ruby
bragh has quit [#ruby]
Gh0stInAShell has joined #ruby
yoklov_ has joined #ruby
<Gh0stInAShell> puts Foo.public_method_defined?(:hello).inspect
<Gh0stInAShell> that returns true
<Gh0stInAShell> but then
tewecske has joined #ruby
<Gh0stInAShell> puts Foo.hello
<Gh0stInAShell> meta.rb:26:in `<main>': undefined method `hello' for Foo:Class (NoMethodError)
<Mattias> rippa: so I guess it's kind of like a linked list + hash combo
zakwilson_ has joined #ruby
<Gh0stInAShell> I am trying to dynamiccaly define class methods, but I fscked something up
moshee has joined #ruby
moshee has joined #ruby
<robacarp> Gh0stInAShell: well...post the code
davidcelis has joined #ruby
virunga has joined #ruby
<arturaz> why oh why def defines methods on EVERY SINGLE OBJECT?!
<rippa> because that's the way it works
<arturaz> % puts 3
<robacarp> arturaz: how would you have it work?
Spockz has joined #ruby
<arturaz> the bad thing is that it misses method_missing :(
<Gh0stInAShell> robacarp: Okay, I will. I'm embarassed. I now have one full day of ruby experience. ;)
<rippa> use BasicObject
clustermagnet has joined #ruby
Spockz` has joined #ruby
clustermagnet has quit [#ruby]
<arturaz> rippa, um?
<robacarp> Gh0stInAShell: well, I'll look at it...but if you only have one day of ruby experience you probably shouldn't be defining methods dynamically...
greenarrow has joined #ruby
<Gh0stInAShell> robacarp: It's all good, I'll figure it out :0
danishkhan has joined #ruby
<Gh0stInAShell> I have 20 years of programming experience ;)
<arturaz> rippa, oh, looked it up, thanks
<robacarp> fair enough
clustermagnet has joined #ruby
<clustermagnet> guys… something broke on my system
<clustermagnet> need to reinstall rubygems
<robacarp> Gh0stInAShell: you might consider using .responds_to? and .send instead
LockeVendetta has joined #ruby
banjara has joined #ruby
io_syl has joined #ruby
<seoaqua> how to filter the system msg in irc pls?
<seoaqua> i dont wanna see who joins or leaves this channel :(
clustermagnet has quit [#ruby]
<RubyPanther> seoaqua: Check the manual for your client. Usually you click on stuff.
<LockeVendetta> hi, having this: http://pastie.org/3527430 is there any way to obtain the referenced expected result? how does variable a can be a reference to f['a']?
gmas has joined #ruby
alfism has joined #ruby
<geekbri> when you call system() does it inherit your current working directory from ruby?
<seoaqua> thanks, its xchat, whats yours?
<gate> geekbri: I believe so, do system('pwd') to check
francisfish has joined #ruby
<gate> works for me
<RubyPanther> seoaqua: I use xchat I guarantee you that a) it is in the manual b) if you click around on stuff you'll find it close at hand where you would hope to find it
<geekbri> gate: yup, looks right to me, thanks :)
<Hanmac> geekbri Dir has also an pwd function
<seoaqua> i'll try thanks again
<geekbri> Hanmac: yeah, I am doing a bunch of system() calls inside a dir.chdir do block and I was having some errors. was just double checking :)
<seoaqua> got it :)
twqla has joined #ruby
trek1s has joined #ruby
wallerdev has joined #ruby
<seoaqua> is it able to join the favorite channels automatically?(not server)
Pheen has joined #ruby
ben225 has joined #ruby
Asher has joined #ruby
artOfWar has joined #ruby
n8ji has joined #ruby
badabim has joined #ruby
<RubyPanther> sure, it can do all that stuff. It can PONG with both hands.
Araxia has joined #ruby
Muz has joined #ruby
seoaqua has joined #ruby
<seoaqua> cool its working
jsdrk has joined #ruby
seoaqua has joined #ruby
sako has joined #ruby
badabim_ has joined #ruby
workmad3 has joined #ruby
Tuplario has joined #ruby
Sailias_ has joined #ruby
priteshjain has joined #ruby
dbgster has joined #ruby
mdw has joined #ruby
ed_hz_ has joined #ruby
ArielMT has joined #ruby
al3xnull has joined #ruby
kp666 has joined #ruby
enherit has joined #ruby
Tuplario has quit ["Konversation terminated!"]
manojhans has joined #ruby
c0rn has joined #ruby
burns180 has joined #ruby
knightMBP has joined #ruby
stephenjudkins has joined #ruby
emocakes has joined #ruby
mrsolo has joined #ruby
Jackneill has joined #ruby
adamkittelson has joined #ruby
Eiam has joined #ruby
ghanima has joined #ruby
Tearan has joined #ruby
burns180_ has joined #ruby
jgarvey has joined #ruby
KL-7 has joined #ruby
<shevy> one of you using a statically compiled ruby?
<shevy> I'd love to get rid of all .so
<shevy> (for ruby)
<shevy> or at least reduce them
nfluxx has joined #ruby
gianlucadv has joined #ruby
fr0gprince_mac has joined #ruby
fris has joined #ruby
mythmon has joined #ruby
ascarter has joined #ruby
havenn has joined #ruby
bwlang_ has joined #ruby
Richmond has joined #ruby
shadoi has joined #ruby
jgrevich has joined #ruby
kaspernj has joined #ruby
waxjar has joined #ruby
<fris> im trying to get a youtube id from a 1 liner from the console, this is what i have, a noob here, ruby -pe 'puts "http://www.youtube.com/watch?v=8WVTOUh53QY".match(/youtube.com.*(?:\/|v=)(\w+)/)[1]'
hooper has joined #ruby
<hooper> join #puppet
burns180 has joined #ruby
lorandi has joined #ruby
<Gh0stInAShell> robacarp: It was a stupid typo that I kept overlooking (as most things like that wind up being) Thank you for offering to help.
<Gh0stInAShell> 
<Gh0stInAShell> err sorrry
johndbritton has joined #ruby
Nowaker has joined #ruby
Russell^^ has joined #ruby
cjlicata has joined #ruby
<robacarp> Gh0stInAShell: no problem, good to hear
<ex0a> what would be the best way to unset a variable after n seconds? i'm going to add a flood control to one of my functions and i'm not sure the most "ruby" way to go about it
gmas has joined #ruby
Sailias_ has joined #ruby
yoklov has joined #ruby
jsaak has joined #ruby
<shevy> ex0a dont think anyone is unsetting variables
<shevy> you could assign it to nil again
<ex0a> yeah
tobym has joined #ruby
<ex0a> but my question is how do i tell it when to do it? i want to increment the variable when the code fires, and reset the variable after the code hasn't fired for a period of time
patrick99e99 has joined #ruby
<shevy> well
<shevy> here a thread that counts up http://pastie.org/3527877
<ex0a> ty but i think i need a timer or something that gets reset when the event fires
<ex0a> gonna do a bit more googling
knightMBP has joined #ruby
<shevy> perhaps via eventmachine
apok has joined #ruby
sgmac has joined #ruby
cbuxton has joined #ruby
shruggar has joined #ruby
Drewch has joined #ruby
bwlang_ has joined #ruby
hoipolloi has joined #ruby
stephenjudkins has joined #ruby
Mattias has quit ["WeeChat 0.3.7"]
n3m has joined #ruby
Squarepy has joined #ruby
nemesit|osx has joined #ruby
notbrent has quit [#ruby]
shruggar has joined #ruby
sgmac has quit [#ruby]
MrGando has joined #ruby
burns180_ has joined #ruby
PaciFisT has joined #ruby
j3r0m3 has joined #ruby
libertyp1ime has joined #ruby
Helius has joined #ruby
KL-7 has joined #ruby
Keva161 has joined #ruby
Foxandxss has joined #ruby
<scroat> ruby sucks.
scroat has quit [#ruby]
headius has joined #ruby
lorandi has joined #ruby
<davidcelis> ok
<apow> thanks for your insight.
<rippa> he left though
dbgster_ has joined #ruby
<apow> oh, I ignore joins/parts, too much pollution.
<davidcelis> same
_nephi has joined #ruby
zul_ has joined #ruby
nyuszika7h has joined #ruby
<RubyPanther> yeah, suck it Ruby... this is programming! (m-f!)
munx has joined #ruby
justinmcp has joined #ruby
munx has quit [#ruby]
<robert_> shevy: hai
al3xnull has joined #ruby
bwlang_ has joined #ruby
<robert_> question- so I'm trying to call member funcs from a block that gets passed to a library (one I didn't write); yet I seem to be getting a NameError; is there a particular reason for this? also, is there a workaround?
sako has joined #ruby
josemota has joined #ruby
Squarism has joined #ruby
gmas has joined #ruby
sdeobald_ has joined #ruby
<josemota> hi everyone, is it possible to define an instance variable inside a method_missing? i'm not being able to call that variable in another method, I get nil...
kaiwren has joined #ruby
Azure has joined #ruby
cristi_ has joined #ruby
<cristi_> hi
<cristi_> what is the diff between string.reverse and string.reverse! ?
<cristi_> as i see the result is the same
<apow> ! methods are destructive.
<rippa> usually
<apow> .reverse return a copy, reversed
<rippa> reverse! method modifies original instance
<apow> .reverse! does it in place.
kirun has joined #ruby
<cristi_> mutable and imutable
<cristi_> like
<cristi_> in java
ekaleido has joined #ruby
<cristi_> ?
jxpx777 has joined #ruby
<apow> if I'm not mistaken, in java, all strings are immutable.
<apow> String a = "whatever"; a = "whoever";
<apow> "whatever" and "whoever" are 2 different strings in memory, you're just changing which one you're pointing to, in _a_
<cristi_> got it thanks a lot !!! it makes sense now..
<cristi_> yes in java all are but there is the string buffer...
<cristi_> like
sako has joined #ruby
<apow> in ruby all strings are more like string buffer.
<apow> StringBuffer*
<apow> you can change the contents of a string. So, when you call reverse! that's what you're doing
<cristi_> and without ! it returns a new string reversed
<apow> .reverse clones the original string and performs the reverse operation in this clone, returns the reversed clone
<apow> yes
<apow> you now have 2 objects
bbttxu has joined #ruby
Gesh has joined #ruby
<apow> the original and the reversed string
<apow> with .reverse! only one.
<cristi_> there is GC in ruby right...i am reading now a tutorial but did not reached yet that part
<cristi_> ?
<apow> yes.
<cristi_> oki....
<cristi_> any particular IDE used ?
yoklov has joined #ruby
<apow> a = "mystring"; a = a.reverse
<cristi_> i am used with eclipse and i found for ruby aptana
<cristi_> eclipse like
<apow> the string "mystring" is still in memory, nothing points to it
<apow> eventually gc will collect it.
<cristi_> but after a while is GC
<cristi_> ok
<cristi_> yes more or less like in java
<apow> I don't use an IDE :( can't help you there.
<cristi_> text is enough for you ?
<apow> unless of course you're counting Operating Systems, then I use emacs, happens to have a nice text editor bundled
<apow> you want autocompletion, right?
<cristi_> emacs is for really true geeks...i am so used to eclipse
<cristi_> :)
<cristi_> yes for that
Knodi has joined #ruby
rbennacer has joined #ruby
<regedarek> Hi, how in ruby revert items in hash
<rbennacer> hey guys anyone can help me with heroku?
badabim_ has joined #ruby
<rbennacer> how can i specify an apps when i have several
<regedarek> rbennacer: #heroku or rubyonrails
kp666 has joined #ruby
<davidcelis> rbennacer: #heroku
<davidcelis> please not rubyonrails
<davidcelis> regedarek: what do you mean "revert items in hash"
<cristi_> apow: thanks Aptana i use
<apow> cristi_: scroll down, there are more.
Knodi has joined #ruby
<cristi_> apow: yee ...netbeans is really familiar to me :) ...but i would really love to be able to use emacs...but learning curve is harder and time pressure
<cristi_> so a lot of but 's :)
<ekaleido> Hash["a", 100, "b", 200]
<ekaleido> any reason that has couldnt include all the letter of the al[habet?
<apow> ekaleido: I'm sorry, I don't understand your question.
<ekaleido> "c", 300, "d", 400,
<ekaleido> etc
Knodi has quit [#ruby]
<apow> ekaleido: no, not really.
<davidcelis> why would there be a reason?
<robacarp> ekaleido: you can put whatever you want in an array
<ekaleido> just makin sure
coucher has joined #ruby
<apow> why would you think that in the first place?
<davidcelis> robacarp: that is a hash, good sir
<ekaleido> because i had a weekend of wrong assumptions
<ekaleido> :)
<cristi_> apow: you asked me ?
<apow> cristi_: no, ekaleido
burns180 has joined #ruby
sdeobald_ has joined #ruby
bwlang_ has joined #ruby
phantasm66 has joined #ruby
Divinite has joined #ruby
<rbennacer> help with heroku CLI
jxpx777 has joined #ruby
jxpx777_ has joined #ruby
Divinite has joined #ruby
luckyruby has joined #ruby
swarley has joined #ruby
<swarley> im trying to get "#{name} " + ' ಠ_ಠ ' "#{link}" to work
<swarley> invalid multibyte char (US-ASCII)
<swarley> i've tried # encoding: UTF-8
<swarley> never mind i got it
musee has joined #ruby
<Mon_Ouie> You don't need to call String#+
<Mon_Ouie> You can write it all in one string literal
bwlang_ has joined #ruby
kaneda has joined #ruby
timonv has joined #ruby
<shevy> hi robert_
<robert_> how's it going? :D
cwd1 has joined #ruby
willb has joined #ruby
jrist has joined #ruby
<patrick99e99> Hi everyone.. I just was reading some source code, and saw: ->(a,b, &block) do ...
<patrick99e99> what is the "->" ??
<patrick99e99> that returns a proc object, but I've never seen it before
<patrick99e99> is that a 1.9 thing?
willb has joined #ruby
td123 has joined #ruby
trivol has joined #ruby
roger_padactor has joined #ruby
Squarepy has joined #ruby
<roger_padactor> I can't seem to get hash.sort_by{|k,v|,v} to sort properly, v are integers but its not coming out in order.
thecreators has joined #ruby
bwlang_ has joined #ruby
burns180_ has joined #ruby
mensvaga has joined #ruby
choffstein has joined #ruby
Targen has joined #ruby
Divinite has joined #ruby
<mensvaga> Is there a good ruby code example that parses a tab(?) delimited file with the column names at the top of the file, and puts them into an array of hashes?
<mensvaga> I'm learning Ruby, and I have a strong Perl background, and I want to look at what are considered "good" examples for how to do things
tyman has joined #ruby
tilde` has joined #ruby
MMSequeira has joined #ruby
<jlogsdon> use a headers array and then a data hash, if headers.empty? set it to the current row, otherwise use that to set the keys for the current row in data
seanstickle has joined #ruby
<mensvaga> thanks.
<mensvaga> Perl has Text::CSV and Text::CSV_PP
<jlogsdon> oh wait... it looks like CSV has a #headers method that might help.
<jlogsdon> haven't used it myself
<mensvaga> and I'm new to this, so I want to see what the generally accepted equivalents are to things.
<jlogsdon> Yeah, do CSV.parse('path/to/file', headers: :first_row) should do what you want actually
<jlogsdon> errr... apparently parse doesn't taken a file path, though
<jlogsdon> read, not parse. durp
<jlogsdon> i know my ruby i swear
phantasm66 has joined #ruby
j3r0m3 has joined #ruby
mikeric has joined #ruby
seitensei has joined #ruby
booginga has joined #ruby
dlam has joined #ruby
danishkhan has joined #ruby
Mon_Ouie has joined #ruby
<mensvaga> jlogsdon: yeah, looks pretty standard. I just need to learn how to find what I'm looking for now :)
cyri_ has joined #ruby
startling has joined #ruby
sohocoke has joined #ruby
<jlogsdon> mensvaga: yeah, ruby has some pretty nice standard libraries
<jlogsdon> unfortunately the method i mentioned won't build a hash, I would build it out like this: https://gist.github.com/1980978 to save some iterations
tayy has joined #ruby
odinswand has joined #ruby
burgestrand has joined #ruby
y3llow has joined #ruby
MrGando has joined #ruby
s0ber has joined #ruby
vraa has joined #ruby
ysiad has joined #ruby
<mensvaga> That's not loading for me from 2 places.
<mensvaga> It could be this soopid VPN I'm on.
y3llow has joined #ruby
MMSequeira has joined #ruby
Divinite has joined #ruby
zen_ has joined #ruby
y3llow has joined #ruby
Faris has joined #ruby
<robert_> shevy: how's it going? :D
<shevy> robert_ chilling mostly
<shevy> less time than I used to have for ruby
<shevy> next on my todo list is to learn the observable pattern in ruby
<robert_> aha.
bwlang_ has joined #ruby
<shevy> but I dont have the time right now :(
<shevy> I need to find out how to sync data across objects of the same class
<shevy> ideally without class variables
y3llow has joined #ruby
roger_padactor has quit [#ruby]
<burgestrand> shevy: using the observable
<burgestrand> or making your own, since the observable only has support for one notification method :x
apeiros_ has joined #ruby
<shevy> :(
<shevy> hmm
A124 has joined #ruby
<shevy> I am trying to write a replacement for bash eventually, and while doing so, I look for nice ideas. One idea was this here:
<burgestrand> never really understood that, this is ruby, we can do better
y3llow has joined #ruby
<shevy> so I want to sync some data across the running shells, but without storing data in a file or database or tempfile or the like. I want to communicate with them all directly
<apeiros_> shevy: isn't that what windows' registry does? :)
aibo has joined #ruby
frontendloader has joined #ruby
<shevy> no idea. the registry kinda stinks though... \HKEY\SOMETHING_WHO_TYPES_THIS_CRAP
burns180 has joined #ruby
y3llow has joined #ruby
<shevy> there was the elektra project once to bring the registry to linux
<shevy> their idea was to use XML files for it
Guest____ has joined #ruby
<A124> XML = Lot of overhead
<shevy> though, the idea in itself is not a bad one
Divinite has joined #ruby
y3llow has joined #ruby
blischalk has joined #ruby
y3llow has joined #ruby
jergason has joined #ruby
trivol has joined #ruby
jergason has joined #ruby
y3llow has joined #ruby
KarlFreeman has joined #ruby
mickn has joined #ruby
trivol_ has joined #ruby
zen_ has joined #ruby
bwlang_ has joined #ruby
mattonrails has joined #ruby
y3llow has joined #ruby
<Divinite> How can I port development tools for a new platform?
<Divinite> *Ruby Dev tools
kp666 has joined #ruby
wookiehangover has joined #ruby
y3llow has joined #ruby
red5 has joined #ruby
ckrailo has joined #ruby
<shevy> Divinite what tools
burgestrand has joined #ruby
gmas has joined #ruby
libertyp1ime has joined #ruby
y3llow has joined #ruby
Divinite has joined #ruby
hubub has joined #ruby
<A124> LoL
dv_ has joined #ruby
ephemerian has joined #ruby
y3llow has joined #ruby
red5 has quit [#ruby]
<davidcelis> league of legends?
libertyp1ime has joined #ruby
swarley has joined #ruby
blacktulip has joined #ruby
<Divinite> Love that game!
zen__ has joined #ruby
frontendloader has joined #ruby
<Tasser> never played it, left DotA some years ago
<Divinite> LoL kinda got old though. Only 2 maps..
<geekbri> ruby-doc.org is so slow today that im considering just ending my own life.
<A124> Heroes of Newerth
<Divinite> geekbri: :O
<A124> LoL is just a cartoon.
i8igmac has joined #ruby
<geekbri> LoL is like the supermarket brand cereal of dota
<geekbri> thats all I have to say about that.
<Divinite> Basically!
<A124> geekbri: Ruby pages have problems today whole day, yes.
<geekbri> A124: yes it makes me want to die.
iMe has joined #ruby
<A124> geekbri: Agreed. About the docs... look at mirror. There is one.
<geekbri> A124: thanks, i'll try to find a good mirror
chimkan has joined #ruby
_adeponte has joined #ruby
<shajen> is there any expert of gruff in ruby?
<A124> geekbri: I know there is one good. Don't remember adress though ^^
<A124> Oh, and, Welcome
chimkan_ has joined #ruby
virunga has joined #ruby
danishkhan has joined #ruby
jbw_ has joined #ruby
aim-On has joined #ruby
johndbritton has joined #ruby
yoklov has joined #ruby
bwlang has joined #ruby
havenn has joined #ruby
zul_ has joined #ruby
ascarter has joined #ruby
jxpx777 has joined #ruby
QaDeS has joined #ruby
rickmasta has joined #ruby
themadcanudist1 has joined #ruby
themadcanudist1 has quit [#ruby]
QaDeS has joined #ruby
burns180_ has joined #ruby
shtirlic has joined #ruby
h4mz1d has joined #ruby
shtirlic has joined #ruby
zen__ has joined #ruby
shtirlic has joined #ruby
brett has joined #ruby
brett has quit [#ruby]
zen_1 has joined #ruby
shtirlic has joined #ruby
sdwrage has joined #ruby
_adeponte has joined #ruby
shtirlic has joined #ruby
zen_1 has joined #ruby
shtirlic has joined #ruby
zen_1 has joined #ruby
josemota has joined #ruby
emocakes has joined #ruby
<josemota> hi everyone, I'm trying to set an instance variable to the a class from method_missing. The next time I try to get that variable's value, I get nil...
<josemota> why is that happening?
nonotza has joined #ruby
<burgestrand> josemota: show us the code and we can show you the answer
<josemota> ok, hold on a second. I apologize
delinquentme has joined #ruby
<burgestrand> it always helps if it’s a minimal example and is runnable
<burgestrand> and displays the error, of course :)
<josemota> thank you.
minijupe has joined #ruby
<josemota> i'll make sure to post what you suggest
<burgestrand> dont worry, playing ssx, I am in no rush
<geekbri> Is there a way to retrieve the URL that a was used in a HTTP start ?
<geekbri> or rather, the full url used in the http.get ?
neilhulluni has joined #ruby
zen_1 has joined #ruby
Squarepy_ has joined #ruby
<neiled> Hi, if I have a method that returns either one object or an array of objects, what's the best way to iterate through the results? I want to do a '.each' but that fails if there's one returned...
<josemota> burgestrand: http://pastie.org/3529241
<josemota> does a spec help?
<josemota> i'll paste the error
<geekbri> neiled: why not return the one object as an array with 1 object?
<neiled> not my method, it's an API I'm calling...
pupoque has joined #ruby
Squarepy_ has joined #ruby
<josemota> burgestrand: updated, there's the error
<burgestrand> Avoid this kind of class variables
<burgestrand> You don’t need them unless you want subclasses to inherit the variable
mdw has joined #ruby
sohocoke has joined #ruby
<josemota> yea, i know. it's part of an exercise for a course.
<josemota> that code I written in that method is `@currency = ...`
kp666 has joined #ruby
<josemota> the* code
<josemota> the `in` method was also written by me
<josemota> what would you suggest?
<geekbri> neiled: you could do something like "response.kind_of?(Array)" although I probably wouldnt
<geekbri> neiled: you can also check if an object supports .each with responds to
<neiled> thanks, I just wondered if this was a common pattern I wasn't aware of. An array with one entry would make more sense to me too...
<burgestrand> josemota: 1.dollar, what does it return?
<burgestrand> josemota: (I know the answer, but you need to think about it)
<josemota> gotcha ;)
geekbri_ has joined #ruby
Helius has joined #ruby
<josemota> it should return a Numeric, either Fixnum or Float.
<burgestrand> josemota: indeed, will it return the same Numeric?
<josemota> well it should... does it not?
Morkel has joined #ruby
<josemota> :interesting:
<burgestrand> josemota: print the result of 1.dollar and see if it equals 1 :)
<josemota> ok hold on
<burgestrand> I might add using instance variables on Numeric is a bit of a strange thing to do :p
j3r0m3 has joined #ruby
<josemota> well, yea, kind of. That's the only way I found to keep a record of its currency...
<workmad3> josemota: maybe 1.dollar should return a currency object?
<josemota> workmad3: that's actually good, but I don't think that's what they want.
<josemota> they => the teachers
<josemota> burgestrand: 1.dollar.equals?(1) => ArgumentError ?
<josemota> damnm wron gs
<josemota> wrong s*
<josemota> and it does not equal.
<josemota> so it returns a different object?
<burgestrand> josemota: aye!
<josemota> so 1.dollar is a different object, I should be able to access it from the chain, or is that incorrect?
mensvaga has quit [#ruby]
<burgestrand> josemota: 1 * 1.0 == 1.0 ≠ 1
<burgestrand> josemota: new object, does not share instance variables, so @currency won’t be set
<workmad3> and can I now chime in with 'eww, floating point numbers storing currency' ;)
<josemota> workmad3: lol
<burgestrand> josemota: workmad3’s suggestion is probably the only sane way of horribly abusing the numeric class like this :p
<josemota> yea, i know... don't blame me
fayimora_ has joined #ruby
<workmad3> josemota: are you seriously of the opinion that your teachers would rather you mutilate Numeric to hell and back rather than follow some sane, OO design principles?
fayimora has joined #ruby
<josemota> workmad3: i know i wouldn't do it that way.
<workmad3> josemota: neither would anyone sane...
<workmad3> josemota: apart from as examples for serious Ruby Antipatterns maybe...
BrianE|mobile has joined #ruby
hydrozen has joined #ruby
<workmad3> josemota: well, apart from the floats storing currency... that's not a specific Ruby antipattern :)
<josemota> i need to check on those antipatterns
BSaboia has joined #ruby
<josemota> well anyway, I need to return that object with the instance variable set for now :P
<josemota> burgestrand: should i explicitly return self?
liluo has joined #ruby
<burgestrand> josemota: the thing is, numbers in ruby are not immutable, so if you return self you will always get the same number back and the self * @currencies thing is essentially useless
<burgestrand> …
<burgestrand> sorry
<burgestrand> numbers in ruby *are* immutable
<josemota> gotcha
<josemota> so basically my approach is incorrect, I'll try and create a new class that stores that currency.
scalebyte has joined #ruby
<josemota> and the value, of course.
<burgestrand> you could hack the instance variable onto the return value with instance_variable_set, but that’s just piling a hack on a hack and if your teacher really wants you to do that you should fill their office with eggs and spam
<dbgster> I have a class with an initialize method like (obj1, obj2)
<workmad3> josemota: yeah... and store the value as a BigDecimal or as integers of tenths of pence/cent etc, not as floats :)
<scalebyte> is there is better way to write this ?
<scalebyte> - if value.second == true && !value.first.empty?
<dbgster> now I can't create a new object without the 2 parameters, is there a way to have multiple con structures? (parameterless and one with 2 parameters)
<ged> scalebyte: You don't need to do '== true', just say: "if value.second && ..."
<josemota> thanks for the discussion, I appreciate it workmad3 burgestrand
<scalebyte> ged: thanks :)
<josemota> burgestrand: have fun with ssx
<josemota> loved that game 10 years ago
<scalebyte> is there a better way to write this ?
<scalebyte> !value.first.empty?
<scalebyte> if !value.first.empty?
<scalebyte> ged: ^^
<josemota> scalebyte: you can try and do `unless value.first.empty?`
<norm> unless value.first.empty?
<josemota> it keeps that "!" away
<scalebyte> so then how can i make this perfect if !value.first.empty? && value.second
<ged> It's fine as is, but I do prefer unless if it gets rid of a '!'.
<scalebyte> unless value.first.empty? && value.second
<josemota> if that's rails, you can try value.first.present?
<scalebyte> ged: josemota ^^
<ged> You occasionally need to be careful to invert the logic correctly.
<scalebyte> josemota: yes rails? so what do u recommend?
<scalebyte> unless value.first.present? && value.second
<scalebyte> ged: josemota ^^ correct and perfect ?
looopy has joined #ruby
<scalebyte> josemota: no present doesnt work only empty works
<ged> Case in point: "if !a && b" becomes: "unless a || b"
burns180 has joined #ruby
<josemota> true, that would be the juice of it.
bglusman has quit ["Leaving..."]
Seisatsu has joined #ruby
bglusman has joined #ruby
<josemota> hmm
<ged> Or no.
<josemota> that's odd
<josemota> present*
<josemota> sorry. present? isn't working?
<scalebyte> josemota: no
<bglusman> I can't figure out why/how, but my IRC client has a ruby in the bottom right corner of this channel :-) anyone know how "they" did that, or what the source is?
<scalebyte> unless value.first.empty? && value.second i did this but it prints a value whose value.second is false ? :-/
banister`sleep has joined #ruby
raluxgaza has joined #ruby
<josemota> should be ||, not && I believe
<ged> if !value.first.empty? && value.second becomes value.first.empty || !value.second, which just moves the !.
<josemota> true
<scalebyte> c i need to show values only if value.first is not empty (has some value) and value.first is set to true (value.second is boolean)
<scalebyte> now pls suggest
<ged> So I'd keep it 'if', since 'unless' is more confusing.
<scalebyte> ged: yes
<jlogsdon> if !values.first.empty? && values.second
Seisatsu has joined #ruby
<jlogsdon> do that
<jlogsdon> don't use unless for multiple conditions, it's hard to read
<scalebyte> as of now this works perfect for me : if !value.first.empty? && value.second
<ged> Yeah, that's fine.
<scalebyte> but i need to remove the ! from the code
<jlogsdon> why do you *need* to?
<scalebyte> ged: that ! looks wierd
<jlogsdon> so?
<jlogsdon> unless value.first.empty? || !value.second is eeven weirder
<scalebyte> jlogsdon: what's that ??
<jlogsdon> that's the only other way of writing it
tommyvyo has joined #ruby
<jlogsdon> and it's way worse than the if version
<scalebyte> unless value.first && value.second
<scalebyte> jlogsdon: ged ^^
<ged> So hide it in a predicate method on 'value' so you can say: "if value.has_the_stuff?"
<jlogsdon> ^^^^ also a great option
Simon2 has joined #ruby
<jlogsdon> predicates own, use judiciously
Pikkachu has joined #ruby
<jlogsdon> sorry... predicates are awesome. i should speak proper english in here
<scalebyte> as of now this works perfect
<scalebyte> if !value.first.empty? && value.second
<ged> Hehe.
<scalebyte> nothing else working perfectly.. some or the other bug.. all that I dnt like is this !
<ged> scalebyte: So hide it in a predicate method on 'value' so you can say: "if value.has_the_stuff?"
<scalebyte> ged: how to define predicate method ? where?
<jlogsdon> is value an array?
<scalebyte> jlogsdon: yes
<jlogsdon> is the test done inside of an object?
<scalebyte> value.first and value.second are values inside hash :)
<scalebyte> key is the name of the hash
<jlogsdon> make a method `has_the_stuff?` which takes `value` as a paramter, test as needed in that method
bigkm has joined #ruby
<jlogsdon> so you can just do "unless has_the_stuff?(value)"
<jlogsdon> (use a better name than has_the_stuff? though, something that represents what you are checking)
<scalebyte> jlogsdon: so i need to have that inside the corresponding model ?
<jlogsdon> valid? would be nice if it's not an ActiveRecord model
<A124> mouth.smoke unless has_the_stuff?( :weed)
<scalebyte> jlogsdon: its an active record model attribute
<jlogsdon> depends on when you're testing the stuff
<jlogsdon> okay so not #valid? :P
<jlogsdon> if the test is specific to a models domain-logic then yes, put it in the model.
<jlogsdon> if it's a controller-level thing, put it there.
<jlogsdon> anyway, i must be off
<jlogsdon> good luck
mdw has joined #ruby
<scalebyte> jlogsdon: thats too complicated i think il retain the line instead of having more lines of code and overheading the app since this is the only place where I do the comparison.
<scalebyte> if !value.first.empty? && value.second
ryannielson has joined #ruby
jxpx777 has joined #ruby
Pikkachu has quit [#ruby]
<scalebyte> is there .exist? for arrays in ruby ?
cpruitt has quit [#ruby]
hubub has joined #ruby
<burgestrand> scalebyte: include?
<scalebyte> burgestrand i need for string sorry
startling has joined #ruby
munx has joined #ruby
munx has quit [#ruby]
Limb has joined #ruby
Simon2 has quit [#ruby]
<Limb> What's the best way to override one attribute in a class? I'm trying to change has_attached_file in a pre-existing class, by declaring the class and inserting my own has_attached_file. When I do this though it seems to overwrite the entire class except for the functions
<burgestrand> scalebyte: then I have no idea what you mean
akem has joined #ruby
akem has joined #ruby
adurity has joined #ruby
<Limb> https://gist.github.com/1981734 if that helps explain what I'm trying to do better
<scalebyte> burgestrand: .empty? works
voodoofish430 has joined #ruby
xpot-mobile has joined #ruby
badabim_ has joined #ruby
musl has joined #ruby
davidd` has joined #ruby
sdwrage_ has joined #ruby
<davidd`> hey guys can you helping me out by upvoting this http://news.ycombinator.com/item?id=3668728
<davidd`> thank you :)
<banister`sleep> davidd`: have you heard of rubymonk.com ?
<davidd`> no
<davidd`> it's kind of the same
<banister`sleep> davidd`: seems like exactly the same, yes ;)
Kichael has joined #ruby
<davidd`> on rubeque though you compete
<davidcelis> davidd`: there can be only one
<davidd`> haha
<banister`sleep> and there's the original: tryruby
falsetto has joined #ruby
<davidd`> rubeque is like therubygame + ruby monk
<banister`sleep> davidd`: did u write it
<davidd`> yea :)
<davidd`> with some help
booginga has quit ["Leaving"]
<davidd`> I'm just trying to give back to the Ruby community
booginga has joined #ruby
IAmNotMyself has joined #ruby
<davidd`> Why's Poignant Guide is why I am a Ruby developer
burns180_ has joined #ruby
Sailias_ has joined #ruby
Hanmac has joined #ruby
Azure has joined #ruby
rushed has joined #ruby
<A124> davidd`: Thank you for your contribution. This sounds good so far.
Azure|netbook|dc has joined #ruby
<davidcelis> banister`sleep: you are not asleep
<banister`sleep> davidd`: yeah it looks cool :)
<davidcelis> banister`sleep: you are a liar is what you are
twqla has joined #ruby
<banister`sleep> davidcelis: im sleeping in my heart of hearts
<banister`sleep> curled inside is a slumbering zephyr who sleeps with gay chin!
<banister`sleep> in his bed of cotton
<A124> Oh. Methaphoric. I love that! xD
<A124> http://rubeque.com/problems/the-truth This one is the best xD
<banister`sleep> have you seen the regex for shellsplit? :P
Squarism has joined #ruby
<davidcelis> banister`sleep: it can't be worse than regexes for email addresses
<davidcelis> banister`sleep: or URIs
<banister`sleep> hm it's not as bad as i thought
virunga has joined #ruby
virunga_ has joined #ruby
indspenceable has joined #ruby
<davidd`> o rly
<indspenceable> is there any way to serialize fibers?
<davidd`> it's still kind of scarey
skipper has joined #ruby
<banister`sleep> indspenceable: you want to serialize an entire execution context? that's like asking if u can serialize a thread or an entire ruby program
<A124> This should be easy not medium. ^^
<apeiros_> banister`sleep: theoretically doable
<apeiros_> enough languages are capable
<apeiros_> gn8
<indspenceable> bannister`sleep: yeah, I know. but continuations seem to be the right solution for the problem i'm running into, for a project which is already using rails, so it seemed worth a shot to see if I can use ruby for this.
indspenceable has joined #ruby
kaneda has joined #ruby
<indspenceable> so i should assume it won't be possible to serialize fibers, any way?
<banister`sleep> indspenceable: yeah, unfortunately. I've been trying to do something similar using cryopid or even corefiles but it's not easy
<banister`sleep> and pretty platform dependent
<indspenceable> ah, dang.
<indspenceable> thanks anyway :)
<banister`sleep> indspenceable: np what language are you used to using that has this ability?
Azure|dc has joined #ruby
<banister`sleep> indspenceable: maglev ruby might have what u want
Azure|netbook has joined #ruby
<indspenceable> none, really; i had some experience with call/cc in scheme
burns180 has joined #ruby
<indspenceable> i just know it can be done, elsewhere.
<indspenceable> i'll look into it
demian`_ has joined #ruby
iocor has joined #ruby
<banister`sleep> indspenceable: maybe u could ask the #rubinius guys too
nricciar__ has joined #ruby
<indspenceable> thanks, i'll ask them when i get a moment
indspenceable has quit [#ruby]
vraa has joined #ruby
carlyle has joined #ruby
MMSequeira has joined #ruby
mikepack has joined #ruby
Pheen has joined #ruby
kandinski has joined #ruby
HektoR has joined #ruby
chimkan has joined #ruby
<kandinski> beginner question: in python I can just "import foo" from the interactive interpreter, and just use foo.$functionname that I defined in foo.py. IN irb I have tried to "require 'foo'", but it doesn't make my foo.rb methods available. What am I doing wrong?
<HektoR> Hello guys. How can I print instance variable from variable ? i mean something like $$variable in PHP. Is it possible to write something like this which will work ? @#{my_var} ?
<dominikh> HektoR: if you have to do that, your code is broken.
<workmad3> kandinski: is your 'foo.rb' file just a load of 'def method' declarations?
<kandinski> workmad3: yes, but the problem is earlier. irb can't find the file. LoadError: no such file to load -- first.rb
<kandinski> I have tried with and without the ".rb" part
<banister`sleep> kandinski: require './foo'
<kandinski> ah, ta
<workmad3> ah, yes... '.' isn't on the load path by default in 1.9.2+ :)
<kandinski> thanks, guys
rippa has joined #ruby
burns180_ has joined #ruby
sbanwart has joined #ruby
fukushima has joined #ruby
ceej has joined #ruby
sdwrage has quit [#ruby]
fr0gprince_mac has joined #ruby
irocksu has joined #ruby
<irocksu> hi
<irocksu> how do i require a custom app, that i created with bundle gem myapp?
<irocksu> it is basically a library that i want to test with irb
sbanwart has joined #ruby
<irocksu> currently i put a hello world script in the myapp.rb and i want it to be displayed
<CannedCorn> is Time.now - ( 60 * 60 * 24 * 7 ) the best way to get the Time 1 week ago?
robertjpayne has joined #ruby
<davidcelis> Time.now - 1.week
<davidcelis> oh this isn't #rubyonrails
sohocoke has joined #ruby
<davidcelis> MY B
<CannedCorn> yah
<CannedCorn> :-(
<davidcelis> so, yeah
<davidcelis> do that math
<deryldoucette> definitely a rails thing. ruby doesn't seen to know about week
sdwrage has joined #ruby
petercooper has joined #ruby
lorandi_ has joined #ruby
al3xnull has joined #ruby
<CannedCorn> no better way?
<CannedCorn> seems kinda janky
burns180 has joined #ruby