apeiros_ changed the topic of #ruby-lang to: Ruby 1.9.3-p327: http://ruby-lang.org (ruby-2.0.0-preview2) || Paste >3 lines of text on http://gist.github.com
srbaker has joined #ruby-lang
pxjorge has quit [Quit: Leaving]
CaptainJet has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
Darkspiel has quit [Remote host closed the connection]
havenn has joined #ruby-lang
rue has quit [Remote host closed the connection]
micaeked has quit [Ping timeout: 260 seconds]
apeiros_ has quit [Remote host closed the connection]
Guest9041 has quit [Ping timeout: 252 seconds]
Guest9041 has joined #ruby-lang
Denommus has joined #ruby-lang
bcardarella has left #ruby-lang [#ruby-lang]
marr has quit [Ping timeout: 265 seconds]
cultureulterior_ has joined #ruby-lang
homer has joined #ruby-lang
homer is now known as Guest29760
Guest29760 has quit [Client Quit]
cored has joined #ruby-lang
cored has quit [Client Quit]
eydaimon has joined #ruby-lang
<eydaimon> what's the method to find out what all the arguments passed to a function is?
<eydaimon> tohught it had local in the name
agarie has quit [Read error: Connection reset by peer]
cultureulterior_ has quit [Quit: cultureulterior_]
agarie has joined #ruby-lang
jtoy has joined #ruby-lang
krz has joined #ruby-lang
gix has quit [Ping timeout: 252 seconds]
agarie has quit [Ping timeout: 252 seconds]
rue has joined #ruby-lang
scottschecter has joined #ruby-lang
gsav has joined #ruby-lang
rue has quit [Ping timeout: 256 seconds]
srbaker has quit [Quit: Computer has gone to sleep.]
apeiros_ has joined #ruby-lang
apeiros_ has quit [Ping timeout: 252 seconds]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
scottschecter has quit [Ping timeout: 246 seconds]
havenn has quit [Ping timeout: 256 seconds]
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
Jake232 has quit [Quit: Computer has gone to sleep.]
jtoy has quit [Ping timeout: 245 seconds]
srbaker has joined #ruby-lang
chendo_ has joined #ruby-lang
jtoy has joined #ruby-lang
havenn has joined #ruby-lang
Darkspiel has joined #ruby-lang
<rking> eydaimon: local_variables will get you a hash of the names
<rking> (Which in 1.8 and rbx and stuff is strings, in 1.9 is symbols)
<rking> Then you can eval to get them
lordnaz has quit [Quit: leaving]
chendo_ has quit [Quit: Computer has gone to sleep.]
sent-hil has joined #ruby-lang
<sent-hil> i'm confused about Object.new.instance_eval and Object.new.singleton_class.instance_eval
tdy has quit [Read error: Operation timed out]
jtoy has quit [Quit: jtoy]
tdy has joined #ruby-lang
tdy has quit [Read error: Connection reset by peer]
tdy has joined #ruby-lang
jtoy has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
ryanf has joined #ruby-lang
Denommus has quit [Remote host closed the connection]
Denommus has joined #ruby-lang
jtoy has quit [Quit: jtoy]
ryanf has quit [Quit: broken pipes |||]
ryanf has joined #ruby-lang
jtoy has joined #ruby-lang
ryanf_ has joined #ruby-lang
jtoy has quit [Client Quit]
nerd has joined #ruby-lang
JohnBat26 has joined #ruby-lang
methods has joined #ruby-lang
methods has left #ruby-lang [#ruby-lang]
jxie_ has joined #ruby-lang
jxie has quit [Ping timeout: 255 seconds]
sent-hil has quit [Remote host closed the connection]
ryanf_ has quit [Ping timeout: 250 seconds]
ryanf has quit [Ping timeout: 251 seconds]
Darkspiel has quit [Quit: Leaving]
Darkspiel has joined #ruby-lang
Darkspiel has quit [Read error: Connection reset by peer]
Guest9041 has quit [Ping timeout: 246 seconds]
Guest9041 has joined #ruby-lang
nerd has quit [Quit: WeeChat 0.3.9.2]
ryanf has joined #ruby-lang
ryanf has quit [Client Quit]
ryanf has joined #ruby-lang
dhruvasagar has joined #ruby-lang
Denommus has quit [Ping timeout: 276 seconds]
chendo_ has joined #ruby-lang
chendo_ has quit [Quit: Computer has gone to sleep.]
nerd has joined #ruby-lang
chendo_ has joined #ruby-lang
davidbalber|away is now known as davidbalbert
ryanf has quit [Ping timeout: 252 seconds]
nerd has quit [Quit: WeeChat 0.3.9.2]
fire has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
chendo_ has quit [Quit: Computer has gone to sleep.]
<eydaimon> rking: thanks
<rking> eydaimon: Np. ☺
vlad_starkov has joined #ruby-lang
davidbalbert is now known as davidbalber|away
gsav has quit [Ping timeout: 265 seconds]
srbaker has quit [Quit: Computer has gone to sleep.]
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
havenn has quit [Ping timeout: 244 seconds]
drbrain has joined #ruby-lang
drbrain has quit [Ping timeout: 244 seconds]
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
rippa has joined #ruby-lang
gsav has joined #ruby-lang
ddd has quit [Quit: Leaving.]
havenn has joined #ruby-lang
loladiro has joined #ruby-lang
akram has joined #ruby-lang
rippa has quit [Ping timeout: 240 seconds]
havenn has quit [Ping timeout: 252 seconds]
ryanf has joined #ruby-lang
Asher has quit [Quit: Leaving.]
thufir_ has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
rippa has joined #ruby-lang
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
micaeked has joined #ruby-lang
havenn has joined #ruby-lang
drbrain has joined #ruby-lang
rippa has quit [Ping timeout: 240 seconds]
wallerdev has quit [Quit: wallerdev]
ryanf has quit [Quit: broken pipes |||]
gsav has quit [Ping timeout: 255 seconds]
drbrain has quit [Ping timeout: 256 seconds]
havenn has quit [Ping timeout: 244 seconds]
hakunin has quit [Read error: Connection reset by peer]
hakunin has joined #ruby-lang
akram has quit [Ping timeout: 250 seconds]
phlipper has quit [Ping timeout: 246 seconds]
akram has joined #ruby-lang
ryanf has joined #ruby-lang
rue has joined #ruby-lang
Paradox has quit [Ping timeout: 252 seconds]
fire has quit [Read error: Connection reset by peer]
mercwithamouth has joined #ruby-lang
nipara has quit []
micaeked has quit [Ping timeout: 252 seconds]
vlad_starkov has quit [Read error: Connection reset by peer]
xalei has joined #ruby-lang
vlad_starkov has joined #ruby-lang
drbrain has joined #ruby-lang
neocoin_ has joined #ruby-lang
havenn has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
mercwithamouth has quit [Ping timeout: 246 seconds]
neocoin has quit [Ping timeout: 252 seconds]
ryanf has quit [Ping timeout: 252 seconds]
havenn has quit [Ping timeout: 265 seconds]
charliesome has joined #ruby-lang
<charliesome> haha
<charliesome> attr_accessor is encoding oblivious
<charliesome> http://eval.in/5351
drbrain has quit [Ping timeout: 265 seconds]
<shachaf> Well, to be fair, UTF-16 is evil.
<charliesome> looks like everything to do with methods is encoding oblivious actually
<charliesome> http://eval.in/5352
<charliesome> which is interesting because rb_attr seems to have some code related to encodings
sulo has joined #ruby-lang
cyri_ has joined #ruby-lang
sulo has quit [Remote host closed the connection]
gaveen has joined #ruby-lang
gnufied has joined #ruby-lang
loladiro has quit [Quit: loladiro]
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
dhruvasagar has quit [Read error: Connection reset by peer]
dhruvasagar has joined #ruby-lang
loladiro has joined #ruby-lang
JohnBat26 has joined #ruby-lang
marr has joined #ruby-lang
tbuehlmann has joined #ruby-lang
vlad_starkov has joined #ruby-lang
<heftig> at least it's broken pretty consistently: http://eval.in/5363
shemerey has joined #ruby-lang
<heftig> however, i guess this means mixing code written in different encodings won't go well
chendo_ has joined #ruby-lang
<heftig> yeah, utter failure
<thufir_> use nokogiri to parse html?
vlad_starkov has quit [Remote host closed the connection]
drbrain has joined #ruby-lang
socialcoder has joined #ruby-lang
havenn has joined #ruby-lang
sulo has joined #ruby-lang
<socialcoder> http://dpaste.com/852496/ Can someone look at the code there please
<socialcoder> have a question
<socialcoder> why is passwords() repeated in line 8
havenn has quit [Ping timeout: 252 seconds]
<socialcoder> nevermind...got it haha
drbrain has quit [Ping timeout: 252 seconds]
chendo_ has quit [Quit: Computer has gone to sleep.]
loladiro has quit [Ping timeout: 252 seconds]
<thufir_> can I get the result of %x[firefox google.com] back? Instead of having firefox actually open the webpage, I want firefox to just send the results back. Rather than nokogiri.
<heftig> you could use lynx -dump google.com
<thufir_> heftig: thx
<thufir_> watir looks interesting, too
akram has quit [Ping timeout: 252 seconds]
<thufir_> but what is selenium? not really sure what selenium is. sounds familiar. also sounds radioactive...LOL
<thufir_> I think it is an element, actually. or not. hmm.
sulo has quit [Remote host closed the connection]
<heftig> actually, lynx -dump -display_charset=utf8 google.com
<thufir_> I can drive that from within ruby?
adambeynon has joined #ruby-lang
<socialcoder> preferance=STDIN.gets.chomp()
<socialcoder> convpref = preferance.to_i
<socialcoder> what is convpref here
<socialcoder> actually what is the second line saying?
<heftig> convert preferance to integer
<socialcoder> and convpref is just a variable name?
<heftig> yes
<socialcoder> thx
<socialcoder> a string cannot start with an integer right?
<thufir_> heftig: thanks. I found http://h3manth.com/content/methods-submit-form-post-using-curl-perl-python-ruby-lynx once you suggested lynx that put me on the right path.
socialcoder has quit []
marr has quit [Ping timeout: 252 seconds]
Nisstyre-laptop has quit [Ping timeout: 244 seconds]
<thufir_> help correcting syntax pls: value = %x [{#lynx -dump -display_charset=utf8 google.com}] I want to run that as a command
zork_ has joined #ruby-lang
shemerey has quit [Read error: Connection reset by peer]
<thufir_> never mind. got it: value = %x(lynx -dump -display_charset=utf8 google.com)
Paradox has joined #ruby-lang
<thufir_> where uri is a string, how do I use the variable correctly in: value = %x(lynx -dump -display_charset=utf8 uri) having syntax trouble.
mhi^ has joined #ruby-lang
Spaceghostc2c has quit [Excess Flood]
<badeball> thufir_: is there are reason for using lynx or do you just want to post to an url and read something back?
Spaceghostc2c has joined #ruby-lang
<thufir_> firefox or lynx would be ok. I'd like to use the actual browser. which browser is immaterial. at the moment, I'm more stuck on the syntax. I thought it it was {uri} but that doesn't seem to be correct.
chendo_ has joined #ruby-lang
<badeball> thufir_: value = %x(lynx -dump -display_charset=utf8 #{url})
<badeball> thufir_: but what are you trying to accomplish?
<thufir_> badeball: lol. thanks. I wasn't that far off.
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
<thufir_> well, not really thought out that far ahead. for now I just want to get back the raw html. down the road use nokogiri to parse the html. (nokogiri would be best?)
<badeball> thufir_: in that case, use something else than lynx. invoking lynx from ruby is a terrible way to just fetch html over http! :P
<badeball> i suggest Net. Net::HTTP.get('google.com', '/index.html')
<badeball> that will return the html.
<thufir_> heh, yeah. well, I was reading about browser sniffing on wikipedia and so I want to use a real, actual browser. firefox would be ideal.
<thufir_> but, yeah, using Net like you suggest will probably get me there faster. I shouldn't get caught up in perfection at this stage.
<badeball> using lynx or mozilla to avoid browser sniffing is NOT perfection.
<badeball> you can specify headers when using Net and make it look exactly like firefox and *that* would be perfect.
mhi^ has left #ruby-lang [#ruby-lang]
<thufir_> right, but what about running javascript against the browser and doing client side checking?
<thufir_> the user agent will do the server side checks, but I think it's more complex than that.
krz has quit [Quit: krz]
gix has joined #ruby-lang
tbuehlmann has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
<badeball> for that i would suggest using capybara with poltergeist. poltergeist is a driver for PhantomJS, which is a headless webkit.
<badeball> with that, you can open a webpage in a headless webkit instance and execute arbritary javascript on the web page, all from ruby.
gix has quit [Client Quit]
gix has joined #ruby-lang
<thufir_> oooh, very fancy :)
<badeball> capybara and poltergeist is some pretty awesome pieces of stuff. i used it last summer to create an automated, cucumber based test suite for an extjs application. *
drbrain has joined #ruby-lang
krz has joined #ruby-lang
<thufir_> in terms of OOP and mixins, let's say I have three primary scripts. one uses IMAP to read e-mails and grab a URI. The second receives the URI and gets back raw html. The third parses the html, and the fourth puts it into a database. Or, do those just sound like methods in one script?
krz has quit [Client Quit]
<thufir_> mixins confuse me. I get the justification, work-around for multiple inheritance, but the mechanics of it escape me.
zork_ has quit [Quit: Linkinus - http://linkinus.com]
<thufir_> I looked up poltergeist, and starred the project. looks intriguing :)
vlad_starkov has joined #ruby-lang
drbrain has quit [Ping timeout: 252 seconds]
anannie has joined #ruby-lang
fire has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 252 seconds]
krz has joined #ruby-lang
<thufir_> badeball: well, thanks for the help. g'night.
thufir_ has quit [Quit: Leaving.]
bluepojo has joined #ruby-lang
Criztian has joined #ruby-lang
rcvalle has joined #ruby-lang
apeiros_ has joined #ruby-lang
bluepojo has quit [Quit: Leaving.]
apeiros_ has quit [Remote host closed the connection]
chendo_ has quit [Quit: Computer has gone to sleep.]
marr has joined #ruby-lang
jonahR has quit [Quit: jonahR]
dhruvasagar has quit [Ping timeout: 264 seconds]
dhruvasagar has joined #ruby-lang
chendo_ has joined #ruby-lang
krz has quit [Quit: krz]
rue has quit [Remote host closed the connection]
Guedes0 has quit [Quit: Saindo]
rue has joined #ruby-lang
d3vic3_ has joined #ruby-lang
d3vic3 has quit [Ping timeout: 264 seconds]
jstemmer has quit [Ping timeout: 260 seconds]
drbrain has joined #ruby-lang
charliesome has joined #ruby-lang
Hakon has joined #ruby-lang
havenn has joined #ruby-lang
Hakon has quit [Client Quit]
drbrain has quit [Read error: Operation timed out]
leopard_me has joined #ruby-lang
havenn has quit [Ping timeout: 265 seconds]
nick_h has quit [Ping timeout: 255 seconds]
nick_h has joined #ruby-lang
marr has quit [Ping timeout: 252 seconds]
<charliesome> http://eval.in/5372 wtf
swav has joined #ruby-lang
chendo_ has quit [Quit: Computer has gone to sleep.]
burgestrand has joined #ruby-lang
chendo_ has joined #ruby-lang
jmeeuwen has quit [Read error: Operation timed out]
jmeeuwen has joined #ruby-lang
jxie_ has quit [Quit: leaving]
nibbo has joined #ruby-lang
chendo_ has quit [Quit: Computer has gone to sleep.]
drbrain has joined #ruby-lang
postmodern has quit [Quit: Leaving]
xalei has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
Guedes has joined #ruby-lang
Guedes has joined #ruby-lang
drbrain has quit [Ping timeout: 251 seconds]
swav has quit [Remote host closed the connection]
<gnufied> lol
<gnufied> what is that text?
vlad_starkov has quit [Ping timeout: 252 seconds]
jonahR has joined #ruby-lang
chendo_ has joined #ruby-lang
jonahR has quit [Client Quit]
burgestrand has quit [Ping timeout: 260 seconds]
cyri_ has quit [Quit: cyri_]
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
larrylv has joined #ruby-lang
cyri_ has joined #ruby-lang
FiXato has quit [Quit: Quit my IRC client. I'll probably be back soon after a restart of it.]
dhruvasagar has quit [Ping timeout: 264 seconds]
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
kurko_ has joined #ruby-lang
socialcoder has joined #ruby-lang
scottschecter has joined #ruby-lang
<socialcoder> def print_all(f) what is f here
<socialcoder> def print_all(f)
<socialcoder> puts f.read()
<socialcoder> end
<socialcoder> thats the whole thing
<socialcoder> what is f in line 1 and line 2
<socialcoder> pls help someone
drbrain has joined #ruby-lang
<canton7> in line 1, f is a the name of a variable which is passed, as the only argument, to the print_all function
<socialcoder> so it can be a, b, c, f, d, anything?
havenn has joined #ruby-lang
<manveru> sure
<canton7> sure, or any valid variable name
<canton7> foo, bar, hello_everyone, etc
<socialcoder> why does it say f.read
<socialcoder> what is it trying to read
<manveru> f
swav has joined #ruby-lang
<manveru> i'd say it's some kind of IO instance maybe?
<canton7> yeah, looks v likely
<manveru> no way to be sure, it can be anything that responds to #read
<canton7> socialcoder, have you done any programming, ever?
<manveru> he's been here a few times before
havenn has quit [Ping timeout: 252 seconds]
<rue> What’s v?
<manveru> vanishingly
<canton7> very :P
drbrain has quit [Ping timeout: 260 seconds]
d3vic3_ has quit [Ping timeout: 246 seconds]
nick_h has quit [Ping timeout: 265 seconds]
<socialcoder> back
<socialcoder> canton
<socialcoder> no
<socialcoder> I am learning programming now
<socialcoder> let me share the entire code
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
<socialcoder> pls go there
<socialcoder> in case u took a look, does F havew any significance other than what u mentioned
nick_h has joined #ruby-lang
<socialcoder> well, I looked closely. I guess itsjust a variable
<canton7> no. it's a variable. See line 15, current_file is set to a new File instance. Then on line 20, it's passed as the first argument to print_all. So that file instance is the first argument to print_all. Program execution jumps to line 3, where f is the name given to the first argument: that file instance
JohnBat26 has joined #ruby-lang
nick_h has quit [Remote host closed the connection]
swav has quit [Ping timeout: 252 seconds]
nick_h has joined #ruby-lang
<socialcoder> yes, I noticed that
<socialcoder> thanks canton
<socialcoder> ur question wheteher I have programmed before kinda acted a catalyst to think
<socialcoder> thanks for the push
<socialcoder> hey
<socialcoder> just noticed something
<socialcoder> what does it say in line 8
<socialcoder> f.seek(0, IO::SEEK_SET)
<socialcoder> whats that
<socialcoder> the stuff in the parenthesis
kurko_ has quit [Ping timeout: 264 seconds]
<canton7> I found that page through googling "ruby File", since f is an instance of File. The ruby-doc pages are fantastic resources
swav has joined #ruby-lang
<canton7> actually, that ones a bit more complex, as File inherits from IO, which defines methods like #seek. See http://www.ruby-doc.org/core-1.9.3/IO.html
<socialcoder> hmm
<socialcoder> ok, will see it
scottschecter has quit [Ping timeout: 244 seconds]
pesnk has joined #ruby-lang
Ridders24 has joined #ruby-lang
<Ridders24> hi all, why does the STDIN, not appear to work in the following? http://pastebin.com/YYRuqNP6
scottschecter has joined #ruby-lang
<canton7> Ridders24, do you mean STDIN.gets.chomp ?
<Ridders24> canton7: yeah, I don't appear to be getting an error, not an output any more
Mellett68 has quit [Ping timeout: 248 seconds]
<telemachus> Ridders24: I think the point is, did you try STDIN.gets.chomp as opposed to STDIN.chomp?
<telemachus> And you often see it written just as gets.chomp (STDIN being the default): https://gist.github.com/4380526
<Ridders24> telemachus: im pretty sure I have, but will test again. But i think the error i got last time, was cant convert string to integer
<canton7> right that sounds more promising
<Ridders24> give me a sec to just check that
breakingthings has joined #ruby-lang
<telemachus> yeah, that suggests you got the item you wanted but put it somewhere ruby expected a number (though I can't see that right off in your paste)
<Ridders24> going to repaste
<telemachus> btw, anything coming to you from user input is interpreted as a string (even if the user enters 42), so you must use .to_i or .to_f to make it a number (integer or float)
<telemachus> Ruby isn't Perl (or others): it won't auto-cast the item to a number if you try to add it or whatever
<canton7> it's often safer to use Integer() instead of #to_i, as "x".to_i # => 0, while Integer("x") # => ArgumentError
scottschecter has quit [Quit: WeeChat 0.3.9.2]
<telemachus> canton7: good point
<canton7> (similarly, gets.chomp can fall over, as gets can return nil
<canton7> but it comes down to how much you care
<Ridders24> im not after an integer though, I actually do just want the string
<canton7> let's see your error then :P
<Ridders24> I can't seem to get it to error now, this is daft
<Ridders24> ah ok, got it, I'll repaste now
<Ridders24> http://pastebin.com/zw5Cqwid try that guys
<canton7> what error, what line?
<Ridders24> sorry
<telemachus> can you post the error please?
<canton7> (in general, people on IRC are too lazy to run things themselves)
<telemachus> (We don't necessarily want to buy a windows computer and install your gems :) )
swav has quit [Remote host closed the connection]
swav has joined #ruby-lang
<Ridders24> not to worry, will post error
<Ridders24> thats the error
jonahR has joined #ruby-lang
<telemachus> The json response is an array and you're treating it like a hash?
<telemachus> or rather, the item you get each iteration is an array - tweet
drbrain has joined #ruby-lang
<telemachus> use p to print out what tweet looks like to ruby, or use irb for same
<Ridders24> when I print out just "tweet" im getting a not authorised" error
<telemachus> right, don't print it, use p
<Ridders24> im getting a rate limit exceeded now
<canton7> it does irritate when people rate-limit apis. Not that I'm saying they shouldn't...
<telemachus> Well, my best guess, based on that error is that you're trying to treat an array like a hash (indexing it by a string rather than an integer)
<Ridders24> its odd, as I have the script working when you define the argument in commmand line, but I wanted to change that and specifiy it in the script with chomp
<canton7> telemachus, yeah, that brings up that error
<telemachus> Is it possible the script fails when you use it too many times in relatively rapid succession?
<telemachus> That is, it works until you get rate limited - at which point the error value is an array, not a hash of the tweet
<telemachus> so you see a failure
<Ridders24> I'll have to wait an hour I guess before I can try again
drbrain has quit [Ping timeout: 244 seconds]
<Ridders24> when i test the output for tweet when I provide the argv in the command line, tweet is all of the profile from the api
<Ridders24> from what i remember
gaveen has quit [Remote host closed the connection]
<Ridders24> what can I do to solve the issue?
jxie has joined #ruby-lang
<telemachus> Without knowing the API better, it's hard to say. But a first thought is to check the response code of res before trying to work with it.
<telemachus> Presumably if you weren't authorized, you don't have a 200 response, so you can branch off of that
<Ridders24> don't think the api is the problem, as the only thing ive change is how I provide the input
JoelMcCracken has joined #ruby-lang
<telemachus> Ridders24: sure. But either way, with a web response, it pays to check it's response code before trying to use it, no?
srbaker has joined #ruby-lang
<Ridders24> telemachus: yeah thats fair enough
<telemachus> And if the response is not 200, you can use p to try to see what the object you receive looks like. Then you can figure out how to treat it (or if to treat it at all).
<Ridders24> when I was testing the script before I got the problem, I output res and req and was getting somthing like 0x1758, what is that?
sush24 has joined #ruby-lang
burgestrand has joined #ruby-lang
mercwithamouth has joined #ruby-lang
mistym has joined #ruby-lang
<telemachus> looks like a hex value (maybe?) but impossible to say without knowing more
Mellett68 has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
socialcoder has quit [Ping timeout: 248 seconds]
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
thone_ has joined #ruby-lang
thone has quit [Read error: Operation timed out]
CoverSlide has joined #ruby-lang
stardiviner has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 245 seconds]
srbaker has quit [Quit: Computer has gone to sleep.]
apeiros_ has joined #ruby-lang
rippa has joined #ruby-lang
<Ridders24> ok so the script works perfectly when STDIN is removed: http://pastebin.com/mEfAYCYC
<Ridders24> and I can make requests again by the way
drbrain has joined #ruby-lang
havenn has joined #ruby-lang
davidbalber|away is now known as davidbalbert
io_syl has quit [Quit: Computer has gone to sleep.]
havenn has quit [Ping timeout: 252 seconds]
methods has joined #ruby-lang
drbrain has quit [Ping timeout: 255 seconds]
swav has quit [Remote host closed the connection]
jonahR has quit [Quit: jonahR]
srbaker has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
krz has joined #ruby-lang
<Ridders24> ok so ive tested the script, and the reason I get the error, is because the the var "us" is not being seen in the req line. But i dont know why?
<canton7> is it being passed to backup() correctly? SO a 'p us' on line 16 works?
sush24 has quit [Quit: This computer has gone to sleep]
mercwithamouth has joined #ruby-lang
methods has left #ruby-lang [#ruby-lang]
krz has quit [Quit: krz]
krz has joined #ruby-lang
MaddinXx has joined #ruby-lang
zwevans has joined #ruby-lang
mercwithamouth has quit [Ping timeout: 245 seconds]
mercwithamouth has joined #ruby-lang
apeiros_ has quit [Remote host closed the connection]
mercwithamouth has quit [Client Quit]
mercwithamouth has joined #ruby-lang
<Ridders24> canton7: so "def backup (p us) ?
<canton7> Ridders24, no. so `def backup(us) \n p us \n`
<Ridders24> canton7: im getting a syntax error for the \n
<canton7> that means "newline"
<Ridders24> ahh, learnt somthing new
<canton7> puts "one\ntwo", see the \n being turned into a newline? same in most languages
<Ridders24> canton7: still getting a not authorised error. when I look at the tweet output "/1/statuses/user_timeline.json?screen_name=&count=200&page=6" its still not including 'us' in the screen_name : http://pastebin.com/HUkskEQg
srbaker has quit [Quit: Computer has gone to sleep.]
<canton7> Ridders24, I'm interested in what is printed to the console by the 'pp' line
<canton7> Ridders24, and how are you calling the script?
<canton7> ruby myscript.rb username ?
<canton7> I just noticed line 46, which takes ARGV[0] and passes that in as the 'us' param to #backup
<Ridders24> no i used to do that, but now im trying to do it by just calling ruby myscript.rb
<canton7> so line 7 does bugger all
krz has quit [Quit: krz]
<canton7> does that make sense?
<Ridders24> oh hang on, I'll # line 46
<Ridders24> yh that makes sence
blazes816 has joined #ruby-lang
<Ridders24> when I # line 46 and run the script, I get no error, but no output either now
<canton7> how are you calling it?
<canton7> are you running 'ruby myfile.rb yourusername' ?
<Ridders24> no just 'ruby myscript.rb' then it asks for the username, which is what the STDIN is for and I type the username
MaddinXx has quit [Remote host closed the connection]
<canton7> but that gets assigned to the 'us' variable, and then you don't do anything with it!
Asher has joined #ruby-lang
<canton7> instead, when you call #backup, you pass in ARGV[0], NOT us
<canton7> it's like this script: http://pastebin.com/24yaGUQ5
<canton7> and you're wondering why it isn't printing what was returned by STDIN.gets
sush24 has joined #ruby-lang
sailias has joined #ruby-lang
<canton7> am I being clear?
<Ridders24> yh I understand that, just making some changes
<Ridders24> so ive changed line 46 to TwitterBackup.new.backup(us)
<Ridders24> which now gives me the username with a /n at the end of it
<canton7> that's why you need STDIN.gets.chomp
<canton7> particularly, the "chomp" bit
jonahR has joined #ruby-lang
drbrain has joined #ruby-lang
imajes has quit [Excess Flood]
fire has quit [Read error: Operation timed out]
imajes has joined #ruby-lang
imajes has quit [Excess Flood]
cyri_ has quit [Quit: cyri_]
imajes has joined #ruby-lang
cyri_ has joined #ruby-lang
<Ridders24> canton7: many thanks for being patient with me, and I really appreciate the help, the script works again
<canton7> sweet
<Ridders24> going to try and convert it with ocra again, and hopefully it wont package the input this time
drbrain has quit [Ping timeout: 245 seconds]
mistym has quit [Remote host closed the connection]
srbaker has joined #ruby-lang
sush24 has quit [Quit: Leaving]
zhul_mechanos has joined #ruby-lang
io_syl has joined #ruby-lang
fire has joined #ruby-lang
Criztian has quit [Remote host closed the connection]
ttilley has joined #ruby-lang
danneu has joined #ruby-lang
tbuehlmann has joined #ruby-lang
vlad_starkov has joined #ruby-lang
Criztian has joined #ruby-lang
stonerfish has joined #ruby-lang
msch is now known as msch_
msch_ is now known as msch
imajes has quit [Excess Flood]
FiXato has joined #ruby-lang
imajes has joined #ruby-lang
stonerfish has quit [Ping timeout: 276 seconds]
havenn has joined #ruby-lang
apeiros_ has joined #ruby-lang
zwevans has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
apeiros_ has quit [Ping timeout: 260 seconds]
Ridders24 has quit [Read error: Connection reset by peer]
Ridders24 has joined #ruby-lang
b3nt_pin_ has joined #ruby-lang
b3nt_pin has quit [Ping timeout: 245 seconds]
<whitequark> 1.9.3-p362 added to RXR! http://rxr.whitequark.org/mri/source/?v=1.9.3-p362
<whitequark> (indexes are still rebuilding)
drbrain has joined #ruby-lang
__butch__ has joined #ruby-lang
drbrain has quit [Ping timeout: 260 seconds]
mercwithamouth has quit [Ping timeout: 264 seconds]
briantrust has quit [Remote host closed the connection]
Mellett68 has quit [Ping timeout: 256 seconds]
cyri_ has quit [Quit: cyri_]
pesnk has quit [Quit: Saindo]
Ridders24 has quit [Ping timeout: 245 seconds]
burgestrand has quit [Quit: Leaving.]
sush24 has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
ivanoats has joined #ruby-lang
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
burgestrand has joined #ruby-lang
tbuehlmann has joined #ruby-lang
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
msch has quit [Excess Flood]
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
breakingthings has quit []
msch has joined #ruby-lang
neocoin_ has quit [Remote host closed the connection]
msch has quit [Client Quit]
burgestrand1 has joined #ruby-lang
kurko_ has joined #ruby-lang
burgestrand has quit [Ping timeout: 250 seconds]
wallerdev has joined #ruby-lang
danneu has quit [Quit: WeeChat 0.3.8]
imajes has quit [Excess Flood]
msch has joined #ruby-lang
imajes has joined #ruby-lang
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
drbrain has joined #ruby-lang
havenn has quit [Ping timeout: 252 seconds]
Ridders24 has joined #ruby-lang
drbrain has quit [Ping timeout: 252 seconds]
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
banisterfiend has joined #ruby-lang
larrylv has quit [Remote host closed the connection]
Mellett68 has joined #ruby-lang
Ridders24 has quit [Ping timeout: 260 seconds]
<banisterfiend> injekt: ping
Banistergalaxy has quit [Quit: Bye]
Banistergalaxy has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
Ridders24 has joined #ruby-lang
richardjortega_ has joined #ruby-lang
FiXato has quit [Ping timeout: 252 seconds]
llaskin has joined #ruby-lang
<llaskin> https://gist.github.com/4382236 i know my syntax on line 18 is incorrect. How would I force a retry if the condition in the if is not met?
richardjortega_ has quit [Ping timeout: 252 seconds]
<banisterfiend> llaskin: throw/catch
<llaskin> and put the retry in the catch?
<llaskin> banisterfiend: like this: https://gist.github.com/4382305 ?
larrylv has joined #ruby-lang
mercwithamouth has joined #ruby-lang
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
wallerdev has joined #ruby-lang
rippa has quit [Ping timeout: 240 seconds]
breakingthings has joined #ruby-lang
drbrain has joined #ruby-lang
JoelMcCracken has quit [Ping timeout: 246 seconds]
larrylv has quit [Remote host closed the connection]
FiXato has joined #ruby-lang
sailias has quit [Quit: Leaving.]
pablo_ has joined #ruby-lang
drbrain has quit [Ping timeout: 255 seconds]
havenn has joined #ruby-lang
havenn_ has joined #ruby-lang
havenn has quit [Read error: No route to host]
<injekt> banisterfiend: pong
<injekt> llaskin: yes you don't need two begin blocks though
cyri_ has joined #ruby-lang
<banisterfiend> injekt: yo, it would be cool to be able to document slop commands
<banisterfiend> injekt: something like: cmd.on :list, "List the available gems"
<injekt> banisterfiend: of course you can do that
<llaskin> ok so this is what I have now...https://gist.github.com/4382305 but I don't think it ever restarts
<banisterfiend> injekt: oh how?
<injekt> banisterfiend: exactly like you just did :D
<banisterfiend> injekt: hm let me try
<injekt> banisterfiend: it's stored as 'description' on the option object
<injekt> banisterfiend: [1] pry(main)> o = Slop.new { on :foo, 'something fooey'; }; o.fetch_option(:foo).description
<injekt> => "something fooey"
<llaskin> sorry i've been fighting this annoying thing for probably 2 days
<banisterfiend> injekt: are you talking about options or commands?
kyrylo has joined #ruby-lang
<banisterfiend> injekt: I'm talking about stuff of the form "git log"
<banisterfiend> where 'log' is a command
<injekt> banisterfiend: oh
<injekt> my bad
<banisterfiend> injekt: i can document the options that commands take
<banisterfiend> but i can't seem to document the commands themeslves
<injekt> yeah I rarely use the command system and it already needs an overhaul, I just need to know how people want to use it
<banisterfiend> and some commands don't take options at all, and i don't appear to have a way to document them at all
<banisterfiend> ah ok
<injekt> yeah that makes sense. each command is an instance of slop, though, so what if you open up cmd.banner ?
<injekt> might be able to leverage on that
<banisterfiend> injekt: yeah i could do that, but it's pretty slick to have slop auto-generate that from a doc string that i give the command, hopefully kyrylo is working on a patch for u
<banisterfiend> kyrylo: right? :)
ebouchut has joined #ruby-lang
<kyrylo> Not yet, but… Yes.
<injekt> cool, any patches for commands are welcome, they need a lot of input from people who use them (you guys)
<llaskin> can someone at least tell me if I am using throw/catch correctly ? https://gist.github.com/4382645
msch has quit [Read error: Connection reset by peer]
lagzilla has quit []
larrylv has joined #ruby-lang
<injekt> llaskin: why dont you try it and read the docs?
banisterfiend has quit [Ping timeout: 250 seconds]
<manveru> heh
<manveru> "nothing should happen here"... so you want foo to never return?
<manveru> oh, rerun
<manveru> why would it do that?
<manveru> throw/catch isn't goto
burgestrand1 has quit [Quit: Leaving.]
burgestrand has joined #ruby-lang
larrylv has quit [Ping timeout: 244 seconds]
cyri_ has quit [Quit: cyri_]
kyrylo has left #ruby-lang ["Charging my eyes"]
micaeked has joined #ruby-lang
kurko_ has quit [Ping timeout: 252 seconds]
banisterfiend has joined #ruby-lang
<llaskin> manveru: so I should use a goto?
<manveru> there is no goto
<manveru> you can call foo again to recurse, or use a loop
cyri_ has joined #ruby-lang
drbrain has joined #ruby-lang
banisterfiend has quit [Ping timeout: 246 seconds]
<ddv> lol goto
emocakes has joined #ruby-lang
drbrain has quit [Ping timeout: 265 seconds]
ttilley has quit [Quit: ttilley]
sush24 has quit [Quit: This computer has gone to sleep]
s0ber_ has joined #ruby-lang
gregmoreno has joined #ruby-lang
ebouchut has quit [Quit: This computer has gone to sleep]
s0ber has quit [Ping timeout: 256 seconds]
s0ber_ is now known as s0ber
leopard_me has quit [Quit: Computer has gone to sleep.]
Mellett68 has quit [Ping timeout: 252 seconds]
mercwithamouth has quit [Ping timeout: 260 seconds]
nignaztic has joined #ruby-lang
Ridders24 has quit [Ping timeout: 252 seconds]
havenn_ has quit [Remote host closed the connection]
havenn has joined #ruby-lang
ivanoats has quit [Remote host closed the connection]
havenn has quit [Read error: Connection reset by peer]
havenn has joined #ruby-lang
Ridders24 has joined #ruby-lang
nignaztic is now known as nazz
nignaztic has joined #ruby-lang
nazz has quit [Quit: Leaving]
Mellett68 has joined #ruby-lang
nignaztic has quit [Client Quit]
naz has joined #ruby-lang
msch has joined #ruby-lang
havenn has quit [Remote host closed the connection]
holgerno has joined #ruby-lang
Mellett68 has quit [Read error: Operation timed out]
Nisstyre has joined #ruby-lang
drbrain has joined #ruby-lang
Mellett68 has joined #ruby-lang
rcvalle has quit [Quit: Leaving]
mpan has joined #ruby-lang
drbrain has quit [Ping timeout: 244 seconds]
Spaceghostc2c has quit [Excess Flood]
Mellett68 has quit [Read error: Connection reset by peer]
Spaceghostc2c has joined #ruby-lang
llaskin has quit [Quit: Leaving.]
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
<zzak> you can compile with SUPPORT_JOKE=1 you can use goto ;)
Ridders24 has quit [Quit: Leaving]
srbaker has quit [Quit: Computer has gone to sleep.]
Criztian has quit [Remote host closed the connection]
ebouchut has joined #ruby-lang
srbaker has joined #ruby-lang
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
Alaude has joined #ruby-lang
ebouchut has quit [Quit: This computer has gone to sleep]
stevechiagozie has joined #ruby-lang
gregmoreno has quit [Remote host closed the connection]
__butch__ has quit [Quit: Leaving.]
lsegal has joined #ruby-lang
ivanoats has quit [Remote host closed the connection]
caemir has joined #ruby-lang
drbrain has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
tomzx_ has joined #ruby-lang
ivanoats has joined #ruby-lang
Guest9041 has quit [Read error: Connection reset by peer]
ivanoats has quit [Remote host closed the connection]
Guest9041 has joined #ruby-lang
Alaude has quit [Quit: Leaving]
ivanoats has joined #ruby-lang
ivanoats has quit [Changing host]
ivanoats has joined #ruby-lang
stonerfish has joined #ruby-lang
marr has joined #ruby-lang
drbrain has quit [Ping timeout: 260 seconds]
cyri_ has quit [Quit: cyri_]
gregmore_ has joined #ruby-lang
gix has quit [Ping timeout: 255 seconds]
MaddinXx has joined #ruby-lang
gix has joined #ruby-lang
mjio has joined #ruby-lang
tomzx_ has quit [Ping timeout: 256 seconds]
Criztian has joined #ruby-lang
Criztian has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
breakingthings has quit []
gregmore_ has quit [Remote host closed the connection]
srbaker has quit [Quit: Computer has gone to sleep.]
tbuehlmann has quit [Ping timeout: 244 seconds]
srbaker has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 244 seconds]
havenn has joined #ruby-lang
mjio has quit []
kurko_ has joined #ruby-lang
mjio has joined #ruby-lang
drbrain has joined #ruby-lang
holgerno has quit [Quit: Leaving...]
nick_h has quit [Ping timeout: 256 seconds]
MaddinXx has quit [Remote host closed the connection]
nick_h has joined #ruby-lang
sailias has joined #ruby-lang
drbrain has quit [Ping timeout: 255 seconds]
Mellett68 has joined #ruby-lang
ryanf has joined #ruby-lang