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
<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
<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
<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...
<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>
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
<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
<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?
<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.
<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
<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
<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
<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?
<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
<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?
<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
<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
<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>
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>
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>
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
<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
<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