albemuth has quit [Quit: Computer has gone to sleep.]
randomautomator has quit [Remote host closed the connection]
kylemcgill has quit [Remote host closed the connection]
itnomad has quit [Ping timeout: 265 seconds]
MrGando has joined #ruby
zeade has quit [Quit: Leaving.]
<Hanmac>
shevy i dont know ... google for HPC ruby
<shevy>
is this the all-japanese thing again :-)
<shevy>
I am going to update ruby-fpdf in the next some days
<shevy>
not sure how useful it is considering we have prawn
<shevy>
but perhaps it has a niche in being smallish
macer1 has quit [Quit: macer1]
adamkittelson has quit [Ping timeout: 245 seconds]
pk1001100011 has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
Juul has quit [Read error: Operation timed out]
kenperkins has quit [Quit: Computer has gone to sleep.]
wpaulson has joined #ruby
benjammin891 has quit [Ping timeout: 260 seconds]
frishi has joined #ruby
Juul has joined #ruby
Fezzler has joined #ruby
QaDeS_ has joined #ruby
otters has quit [Quit: WeeChat 0.3.8]
<Paradox>
i cant seem to make rspec run be_instance_of
otters has joined #ruby
kenichi has quit [Remote host closed the connection]
<Paradox>
it always spits undefined method `be_instance_of' for #<Class:0x007ff8d1a2e4b0> (NoMethodError)
<Paradox>
no matter what i call it on
QaDeS has quit [Ping timeout: 245 seconds]
iocor has quit [Quit: Computer has gone to sleep.]
davidcelis_ has joined #ruby
davidcelis has quit [Read error: Operation timed out]
ken_barber has quit [Remote host closed the connection]
igaiga has quit [Remote host closed the connection]
frishi has joined #ruby
<GuidovanPossum>
line
A124 has quit [Quit: Leaving.]
pk1001100011 has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
pdtpatrick has quit [Quit: pdtpatrick]
freezey has quit [Quit: freezey]
<Paradox>
is there any way to get command-line input in rspec?
<Paradox>
eh
<Paradox>
nvm
<Paradox>
disregard that
<cout>
I once knew a Paradox from efnet.
<Paradox>
its not me
beilabs has joined #ruby
<Paradox>
heh
<cout>
coulda been :)
Juul has quit [Ping timeout: 264 seconds]
beilabs_ has joined #ruby
dv310p3r has quit [Ping timeout: 276 seconds]
fbernier has joined #ruby
seanstickle has quit [Quit: Nihil sub sole novum]
ryan0x2 has quit [Ping timeout: 265 seconds]
wilmoore has joined #ruby
vladiim has quit [Quit: vladiim]
mnaser has quit [Quit: Computer has gone to sleep.]
niklasb has quit [Ping timeout: 245 seconds]
emet has joined #ruby
<ekaleido>
efnet
<ekaleido>
brings back memories
havenn has joined #ruby
theRoUS has quit [Read error: Connection reset by peer]
umttumt has joined #ruby
Fezzler has quit [Quit: Leaving]
puchi has quit [Quit: leaving]
blendedbychris has joined #ruby
pdtpatrick has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
<ged>
GuidovanPossum: Do you mean that you want to open a filehandle, seek past the first line, and then read the rest?
quest88 has joined #ruby
kenperkins has joined #ruby
ilyam has quit [Quit: ilyam]
iori has joined #ruby
savage- has quit [Ping timeout: 264 seconds]
c0rn_ has quit [Quit: Computer has gone to sleep.]
zeromodulus has joined #ruby
wangr has quit [Ping timeout: 276 seconds]
eywu has quit [Quit: Leaving.]
kevinbond has quit [Quit: kevinbond]
<ged>
GuidovanPossum: Well, if that's what you meant, I forked your gist and added that.
brianpWins has quit [Quit: brianpWins]
mdaisuke has joined #ruby
soler has joined #ruby
jamesaxl has quit [Ping timeout: 252 seconds]
perryh is now known as perry
nari has joined #ruby
soler has left #ruby [#ruby]
dnyy_ has joined #ruby
skipper has joined #ruby
soler has joined #ruby
soler has left #ruby [#ruby]
skipper has quit [Remote host closed the connection]
havenn has quit [Ping timeout: 252 seconds]
blendedbychris has quit [Ping timeout: 252 seconds]
dnyy has quit [Ping timeout: 244 seconds]
Ontolog has quit [Remote host closed the connection]
blendedbychris has joined #ruby
blendedbychris has quit [Changing host]
blendedbychris has joined #ruby
Hanmac1 has joined #ruby
Enekoos has quit [Remote host closed the connection]
<blendedbychris>
but beyond that i'm just trying to pass a hash of hashes :
<blendedbychris>
(I presume)
maletor has quit [Quit: Computer has gone to sleep.]
<Spooner>
Well, to use strings, you would use { "frog" => 12 }, but as symbols, you'd use { frog: 12 }
<Spooner>
or using backwards compatible symbol syntax, { :frog => 12 }
<horesman>
Spooner: sup spoondiggitydogg
<Spooner>
Hi horesman
igaiga has quit [Remote host closed the connection]
<Paradox>
1.9 syntax > pre 1.9 syntax, imo
<Paradox>
same with -> vs lambda
<blendedbychris>
bleh
shadoi has joined #ruby
<horesman>
Paradox: some ppl feel very strongly about it and wil claw yoru eyes out if they heard u say dat
<Spooner>
I've had grief for using new syntax since some people still love to live in the past :P, so I give both. I'd use 1.9 syntax if you can.
<Paradox>
horesman, yeah, i know
<Paradox>
thats why i just stick ruby >= 1.9 in my gemfiles and whatnot
blendedbychris has quit [Quit: Leaving.]
<Spooner>
Oops, it was all too much for blendedbychris :(
<shadoi>
what syntax?
<Spooner>
Not 100% sure what language they were trying to write Ruby in :D
cjs has joined #ruby
ananthakumaran has joined #ruby
<Spooner>
horesman : How're the antipodes treating you?
<horesman>
Spooner: not bad not bad though it's winter it's a winters day and wintery evening and walking out into the winter now i may not return
<Spooner>
Oh yes, I had forgotten your backwards nature. Have fun in the snow.
<horesman>
cya
Sheehan has quit [Quit: Sheehan]
horesman has quit [Remote host closed the connection]
CheeToS has joined #ruby
Spooner has quit [Ping timeout: 246 seconds]
user__ has joined #ruby
akem has quit [Read error: Connection reset by peer]
jumpingcloud has quit [Remote host closed the connection]
freeayu has joined #ruby
Ontolog has quit [Remote host closed the connection]
<greyEAX>
okay so apparently its some kind of issue with trying to print the array
<greyEAX>
it always leaves the brackets and ""
<greyEAX>
i just want the string to print without all that
sbanwart has quit [Ping timeout: 265 seconds]
niku4i has quit [Remote host closed the connection]
blendedbychris has joined #ruby
blendedbychris has quit [Changing host]
blendedbychris has joined #ruby
Ontolog has joined #ruby
<greyEAX>
basically i'm pulling data from sqlite and trying to compare everything in the array to a specific string to see if it exists already, but it wont do it beacuse of the damn brackets and quotes
<deryl>
don't need the .to_s but i add it so I know its a string
<greyEAX>
ima try that thx deryl
<greyEAX>
kk
<deryl>
well if oyu want to *ensure* its a string then use the .to_s
<greyEAX>
kk
<Seventoes>
EC2 micro instances are so slow T_T
MrGando has quit [Quit: Bye]
<Seventoes>
been compiling ruby for like a half hour
stefanp has joined #ruby
stefanp has quit [Changing host]
stefanp has joined #ruby
<deryl>
if you have 'pry' gem installed just run pry and paste that entire line. you'll see it works. arr = ["1", "2", "3"] ; arr.each {|el| puts el.to_s }
<greyEAX>
perrfect
<greyEAX>
it works great thanks
<deryl>
np
<greyEAX>
how would i check one string against each of those though
<Paradox>
Seventoes, compiling is one of those times i splurge on a mega-instance
<greyEAX>
say x = 1
<greyEAX>
and i want to check if x is in that array
<Paradox>
the more processing power i can throw at a compiler, the faster it is, the less time i have to buy
<Seventoes>
i wanna stay in the free tier cuz i'm cheap :P
<greyEAX>
of 123
<Paradox>
i've done the math
<Seventoes>
i'm fine with compiling for an hour if it means the instance says totally free
<Seventoes>
stays*
<Paradox>
its more expensive to compile on the lowest price tear than it is to compile on the highest price one
<Paradox>
tier
<Paradox>
i failed
<Seventoes>
lol
freeayu has joined #ruby
<Seventoes>
this instance is just going to be a monitor for my physical servers so i don't need anything big
<greyEAX>
deryl
<deryl>
?
<greyEAX>
if i wanted to check a string against all of those how would i do that?
<bnagy>
but this is the result of a query - you SURE you want that to be used by more than one method?
<greyEAX>
ignore my dumb code comments
<greyEAX>
well i think
<greyEAX>
when i pull directly from the sqlite db it formats shit weird
<greyEAX>
so i cant test the string properly
horesman has quit [Ping timeout: 264 seconds]
<dmwit>
Is there a tutorial written for people who already know a handful of other languages? Something that jumps straight to the stuff that's new and different in Ruby -- the syntax/semantics, an overview of the toolchain, and maybe a quick tour of the standard libraries?
lkba has quit [Read error: Connection reset by peer]
<bnagy>
pickaxe I guess?
<greyEAX>
ergh i have no idea what im doing with this
<greyEAX>
well i mean im an autodidact. i wish i could have someone that i could just constantly ask questions, but i cant
<dmwit>
thanks
<bnagy>
I was looking for the updated version
<greyEAX>
so most of it is just pieced together from various tutorials and guessworkl
benjammin891 has quit [Ping timeout: 255 seconds]
<cjs>
RubyPanther: thanks. Neither is quite what I'm looking for, but both are helpful.
<bnagy>
dmwit: you can get a long way by skimming the poignant guide
<bnagy>
but the cartoons are an irritant if you are trying to move fast
<bnagy>
however I honestly think that the metaprogramming / introspection stuff in there is as good as any
<bnagy>
and that's the main 'ahha' area of ruby if you're coming from another language
<RubyPanther>
You're trying to move fast buy you're stuck in Dwemthy's Array being eaten by a dragon.
<bnagy>
apart from slicker syntax and Enumerable
<bnagy>
all of above imho ymmv etc
<bnagy>
greyEAX: my suggestion: get rid of all the $vars, put stuff into a class
<bnagy>
also, in general, sqlite is fricking USELESS
<bnagy>
use a real db
<greyEAX>
like what? why is sqlite bad?
<greyEAX>
the idea of trying to maintain a sql server for this doesn't work
<bnagy>
I'm just saying, it sucks balls. If you're happy with that then fine
<greyEAX>
well i mean i dont know anything about dbs
<bnagy>
I would use the Sequel gem, at least
<greyEAX>
basically i had an idea
<greyEAX>
picked ruby
<greyEAX>
and have been googling my way through everything
<bnagy>
but ultimately I'd look at a KV store, judging by the stuff you're storing, but they do depend on external libs. Oklahoma Mixer is great, ime
<dmwit>
bnagy: Okay, I'll look at that one, too. Thanks for the pointers.
<greyEAX>
for example i dont understand why 'while true do' works
<greyEAX>
to me thats an incomplete thought
<greyEAX>
but it works
daym0n has joined #ruby
dnyy_ has quit [Remote host closed the connection]
<bnagy>
because true is always true, I hate that idiom though
<bnagy>
loop do ...
<bnagy>
while true just makes you sound like a retard who is trying to be a smartass
<greyEAX>
oic
<bnagy>
nothing against you, I guess you saw it somewhere - a lot of people use it
<bnagy>
dmwit: also, the docs
<greyEAX>
well like i said i don't know anything. i tried learning properly, but going from 'this is how you write an if statement' to 'lets write an irc bot' is a massive jump
<bnagy>
The cool thing about using classes is that we can instantiate them to make objects
<bnagy>
so make an IRCRelay.new, and then you can change most of your $globals to @instance_variables
abionic has joined #ruby
<bnagy>
and those @ivars will be visible between methods, for just that instance of your class
ryanf has quit [Quit: leaving]
andrewhl has joined #ruby
<bnagy>
also I would move the db stuff into a methods called 'initialize'
<bnagy>
which is a special method that gets run when the class is first instantiated
<greyEAX>
oic
RainbowDashh has quit [Quit: SLEEP MODE. <@suborbital> no i filtered out RainbowDashh join quit msgs - appearantly it filtered out everything]
<greyEAX>
okay ill change it and paste it because i'll probably be totally wrong here
<bnagy>
also, if it's not too much trouble
mikeycgto has quit [Remote host closed the connection]
<bnagy>
could you change to 2 or 4 space indent and not use pstebin?
<greyEAX>
i'm using a 4 space indent actually
<greyEAX>
i guess pastebin is being weird about it
<greyEAX>
also what should i use instead?
<bnagy>
well it's coming out as 8, so maybe you're using tabs or something
<bnagy>
pastie gist codepad ...
ABK has quit [Ping timeout: 276 seconds]
<greyEAX>
kk
mobilegamelabs has joined #ruby
<greyEAX>
erm im using tabs but it should be 2 width now
<greyEAX>
idk why its changing to 8 width
<greyEAX>
i dont know how to fix it
<Mon_Ouie>
A tab is a tab, there are no 8-width tabs or 2-width tabs because they are exactly the same character
josefig has quit [Quit: Textual app]
<Mon_Ouie>
There are file viewer configured to assume tab width is 8 or 2 or whatever though
horesman has joined #ruby
siekoku has joined #ruby
<greyEAX>
oic
Sheehan has quit [Quit: Sheehan]
TPFC-SYSTEM has joined #ruby
<bnagy>
so people who like tabs say 'tabs are awesome because you can view them however you want in your editor'
alexmin has joined #ruby
ZachBeta has quit [Quit: Computer has gone to sleep.]
<bnagy>
and people who like spaces say 'tabs suck balls because they're TABS' and you can't view them properly in normal text viewing tools
crankycoder has quit [Remote host closed the connection]
<greyEAX>
oic
<greyEAX>
i just use tabs because its easier than SPACE SPACE SPACE SPACE
<greyEAX>
every time
<bnagy>
but tabs vs spaces are one of the third rails of programming debate
maxpenguin has joined #ruby
<bnagy>
like vim vs emacs
<greyEAX>
oic
<Mon_Ouie>
Most text editors can indent automatically with spaces and tabs alike
<bnagy>
but in any case, unless you use 4 space indent and vim, you are a fucking retard
<greyEAX>
where am i supposed to make the IRCRelay.new btw? i have one at the bottom but its inside a Thread.new
<greyEAX>
since running a udp server and a tcp connection needs two threads
<greyEAX>
and it doesn't seem to be working
lorn has quit [Read error: Operation timed out]
<bnagy>
if you want to share it between threads (dunno if it's threadsafe) then before you start the threads, otherwise inside the thread where you're using it is fine
<greyEAX>
share it? well i know i'm passing data read from the tcp stream to the udp server, and passing udp input to the tcp stream
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
vladiim has quit [Quit: vladiim]
Ttech has quit [Ping timeout: 250 seconds]
kiin has quit [Quit: Peace]
maxpenguin has quit [Client Quit]
cout has quit [Ping timeout: 244 seconds]
jgrep has joined #ruby
lorn has joined #ruby
macmartine has joined #ruby
cout has joined #ruby
Utkarsh_ has quit [Quit: No Ping reply in 180 seconds.]
<greyEAX>
do thread { all the code from ircinch method }
<greyEAX>
?
tewecske has quit [Quit: Leaving.]
<bnagy>
the in the first thread you have relay=IRCRelay.new
<bnagy>
then relay.udpserv
<Mon_Ouie>
matled: Yep ;)
davidokner has left #ruby [#ruby]
tonini has joined #ruby
bradhe has joined #ruby
<greyEAX>
im totally lostr
<bnagy>
greyEAX: and I think that should be almost there... you have a typo on line ~39 (I can't see if it's 39 or 40 cause it's indented half way across the screen)
<greyEAX>
oic
<matled>
Mon_Ouie: do you have any idea what was wrong with my config file? it didn't seem to get called when pressing ^U http://ix.io/2AK/
<greyEAX>
though the problem i had originally is still there
beilabs_ has quit [Ping timeout: 245 seconds]
<greyEAX>
i cant do anything with the stupid database
<Mon_Ouie>
Yeah, that's something I had forgotten about — You need to add \C-u *before* other bindings, otherwise the \C-a..\C-z binding (which is a no-op) will get matched first
beilabs has quit [Ping timeout: 255 seconds]
<greyEAX>
i guess i can switch over to Sequel
<Mon_Ouie>
That's why I added that Coolline.bind method now
j0llyr0tten has joined #ruby
<j0llyr0tten>
hey, i'm moving from 1.8 to 1.9 and i hit an upgrade issue
<bnagy>
greyEAX: I would put the threads back how you had them t1=Thread.new {IRCRelay.new.updserv}; t2=Thread.new {IRCRelay.new.ircinch}
<greyEAX>
but it wasnt working when i did that
<bnagy>
that should work
<greyEAX>
ill try it again
<dominikh>
what exactly are you guys trying to solve?
<j0llyr0tten>
undefined reference to rb_str2cstr and STR2CSTR in a C extension, anybody got any ideas ? :)
<bnagy>
dominikh: nothing, personally, I'm just helping him refactor
<Mon_Ouie>
Use StringValueCStr
<greyEAX>
yeah if i put it back like before i get this error undefined method `udpserv' for IRCRelay:Class (NoMethodError)
<bnagy>
I guess the actual problem will become obvious soon
<j0llyr0tten>
Mon_Ouie: thx
<greyEAX>
oh wait
<bnagy>
greyEAX: you need to do it like I said. It's an instance method
<greyEAX>
IRCRelay.
RainbowDashh has joined #ruby
<j0llyr0tten>
Mon_Ouie: instead of ... ?
<matled>
Mon_Ouie: ah, so Settings.unshift would've worked? :)
<Mon_Ouie>
matled: Yeah
freeayu has quit [Ping timeout: 250 seconds]
<Mon_Ouie>
j0llyr0tten: instead of the funciton and macro you mentioned
<dominikh>
bnagy: uhm, shouldn't he only create one instance?
<j0llyr0tten>
Mon_Ouie: ok, thx, i'll try it out. I'm trying to make the extension work for both 1.8 and 1.9 so i might #ifdef it
<bnagy>
dominikh: yeah, the cinch thing should be broken out
<greyEAX>
okay i did it like that and its working now
<bnagy>
that's next
timonv has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
<Mon_Ouie>
Even 1.8 has StringValueCStr
hemanth has joined #ruby
<greyEAX>
now i have to break out the Cinch thing?
wvdschel has joined #ruby
<bnagy>
greyEAX: ok, now just break out the cinch code. Personally I would make a new class called CinchRelay or something, and put all that cinch stuff in a start method
<bnagy>
so in t2 you change to Thread.new {CinchRelay.new.start}
<greyEAX>
k
<j0llyr0tten>
Mon_Ouie: hmm, ok ...
<bnagy>
then you can rip that code out of the IRCRelay class
sent-hil has quit [Remote host closed the connection]
<greyEAX>
thats the one im reading but again i don't know enough about ruby to understand it.
<greyEAX>
i can do guesswork but that's why nothings working
<greyEAX>
i dont know what [:etc] does
<greyEAX>
and so on
<bnagy>
it's a hash lookup
<bnagy>
you need to spend some time working with basic classes, maybe
<cjs>
Maybe use the dlopen() interface?
<bnagy>
you're already using hashes in your existing code, though
<greyEAX>
well yeah but this is syntax i'm not familiar with
<cjs>
I guess I need to go digging into the Ruby source code...
<greyEAX>
i honestly don't know why there are like 5 different ways to write the same thing
zeade has quit [Quit: Leaving.]
<greyEAX>
als, for example, after doing OklahomaMixer.open do |db| he does db.size.zero
<greyEAX>
i have no way of knowing the methods in oklahoma mixer
<greyEAX>
because theres no api
<hoelzro>
cjs: hang on
<hoelzro>
what exactly are you trying to do?
wilmoore has quit [Remote host closed the connection]
<bnagy>
greyEAX: cause it acts like a Hash
<bnagy>
that's the api
<bnagy>
[], []= etc etc
ipoval has quit [Quit: ipoval]
<cjs>
hoelzro: When I try to call ossl_x509ext_new(), which is a function in the Ruby openssl extension, from my extension, I get an...oh...forgot to include the header file. :-)
<bnagy>
nosql takes a bit of getting used to, and it's definitely not right for everything
<bnagy>
but it's a lot easier to use and more flexible if you can make it fit
mwilson_ has quit [Excess Flood]
<greyEAX>
oic
CheeToS has quit [Ping timeout: 245 seconds]
mwilson_ has joined #ruby
perry is now known as perryh_away
<hoelzro>
cjs: ok, so why are you trying to call that function from another extension?
<hoelzro>
it seems like a bad idea to me right now, but I'm not sure what problem you're trying to solve
nadirvardar has quit [Ping timeout: 245 seconds]
sent-hil has joined #ruby
<cjs>
hoelzro: I have an X509_EXTENSION* (defined in the OpenSSL C library), and would like my function to return the Ruby version of that defined by the openssl extension.
MrGando is now known as Goles
<greyEAX>
so i just tried oklahoma mixer and it still didnt work
<cjs>
hoelzro: The function (marked "public") ossl_x509ext_new in ext/openssl/ossl_x509ext.c will do that for me.
<hoelzro>
cjs: does the Ruby openssl extension offer up a Ruby method for getting that?
<hoelzro>
if so, I would invoke that
<cjs>
hoelzro: But it looks as if I don't actually even have the header file on my system (except in my Ruby source code directories).
<cjs>
hoelzro: Ah, it is a Ruby method! That's what I was missing. Thanks!
Markvilla has quit [Ping timeout: 265 seconds]
<greyEAX>
i cant even tell why it's not working
<greyEAX>
the error doesnt make any damn sense to me
maletor has quit [Quit: Computer has gone to sleep.]
<hoelzro>
greyEAX: could you paste the error somewhere so others can have a look?
<cjs>
hoelzro: Oh, wait, it's not a Ruby method. There can't be one, because the struct I want to convert is not a Ruby object. (If it were, I'd just return it.) So I need to make a call to a C function that will convert it to a Ruby object for me.
<greyEAX>
hoelzro, yeah im doing that now
nadirvardar has joined #ruby
<cjs>
hoelzro: So it seems clear that I need to make a call into the other extension (possibly making sure it's loaded, first, if I'm fussy).
<cjs>
hoelzro: The way I create the ruby version of that struct is to call that function in the openssl extension.
lonre has quit [Quit: lonre]
<cjs>
hoelzro: I think I can do it by finding the dlopen() handle for that extension, if you happen to know how to do that. If not, I'll dive in to the 350 heavily-#ifdef'd lines of dln_load() in the Ruby source code (ow!), figure out out, and let you know what I find.
SiliconDon has quit [Quit: SiliconDon]
<hoelzro>
cjs: I know how, but I'm not convinced that's the best solution =(
<hoelzro>
I'm not a Ruby expert, however, so I can only guess at an alternative solution
<cjs>
hoelzro: I'll happily take your guesses, but this does look to me like the correct solution. After all, it is a Ruby class defined by the openssl extension.
vantage has joined #ruby
preller has quit [Read error: Operation timed out]
<cjs>
hoelzro: So, dln_load() was not so bad, I pretty quickly figured out that it returns the dlopen() handle. and rb_require_safe() (in eval.c) pushes that on to the ruby_dln_librefs array.
<hoelzro>
that part makes sense
<hoelzro>
but circumventing Ruby's loading mechanism and grabbing a C symbol by name seems like a bad idea to me
<vantage>
Hi, I have a command line program that takes three unnamed paramaters and then passes them to a method. What's the best way to do this so that if an optional parameter is not entered, nothing is passed to the method?
<hoelzro>
vantage: so prog foo bar baz calls method(), but prog --opt foo bar baz calls method(*%w(foo bar baz))?
<cjs>
hoelzro: I'm not circumventing Ruby's loading mechanism (I hope): I'm relying on Ruby having loaded the openssl extension in the standard way.
<hoelzro>
mkay
<hoelzro>
I may be completely wrong on this
<cjs>
So, ruby_dln_librefs is actually an interpreter global (Ruby) variable, a Ruby array, set with rb_global_variable(&ruby_dln_librefs).
timonv has joined #ruby
<vantage>
hoelzro: prog.rb foo bar baz, then calls method(foo, bar, baz). But if you call prog.rb foo bar, then it calls method(foo, bar) instead of method(foo, bar, baz)
<vantage>
hoelzro: I want to only pass the parameters that are entered by the user
<hoelzro>
oh, I see
jcromartie has quit [Ping timeout: 246 seconds]
<vantage>
hoelzro: that way the method can assign defaults to missing parameters
<hoelzro>
use splat
<cjs>
Hm. But that does just does a rb_gc_register_address() on it. It's also a C global, but declared (as well as defined) only in eval.c. Guess that means I declare it myself, too. I'd better check if it's the same in Ruby 1.9.....
<vantage>
hoelzro: say more about splat? (This is my first day with Ruby)
<hoelzro>
vantage: well, the splat operator (*) expands an array inline
<hoelzro>
ex. a = %w(foo bar baz) method(*a)
<hoelzro>
that's the exact same as method('foo', 'bar', 'baz')
<cjs>
Ah, yes Ruby 1.9 has the same C global ruby_dln_librefs. So, dodgy since it's clearly not a really "official" API, but usable.
<cjs>
But how the heck do I figure out which dlopen() handle in ruby_dln_librefs is the openssl extension handle?
<vantage>
hoelzro: What is %w? How would ARGV fit in to this?
<cjs>
I guess maybe I try them all with dlsym() and see which has the symbol I want....
jgrep has quit [Read error: Connection reset by peer]
<hoelzro>
vantage: %w is Ruby syntax for creating an array of strings very easily
<hoelzro>
%w(foo bar baz) is ('foo', 'bar', 'baz')
<hoelzro>
cjs: o_O
<hoelzro>
this sounds so dodgy
jgrep has joined #ruby
<hoelzro>
vantage: you'd probably do something like method(*ARGV)
mwilson_ has quit [Excess Flood]
mwilson_ has joined #ruby
alup has quit [Ping timeout: 265 seconds]
fayimora has quit [Quit: Be back in a gifii]
<cjs>
hoelzro: You are darn right it's dodgy. :-) I've just realized, what I'm trying to do is access an executable's global variable from a shared library that it's loaded.
fayimora has joined #ruby
jxf has quit [Ping timeout: 276 seconds]
drmegahertz has quit [Quit: Lost terminal]
<vantage>
hoelzro: That seemed to work. Thanks!
<cjs>
hoelzro: I'm asking about this in ##c, if you're curious and want to follow along.
fra000 has joined #ruby
ciopte7 has quit [Quit: ciopte7]
blacktulip has joined #ruby
<wallunit>
Is there any difference between or and || ?
<vantage>
hoelzro: any reason why numeric parameters are strings and how to convert them easily?
<vantage>
hoelzro: it seems weird to be doing .to_i all the time
<hoelzro>
wallunit: precedence
<hoelzro>
vantage: ARGV only contains strings
<hoelzro>
because that's what the OS gives you
ephemerian has joined #ruby
bearlulz has quit [Quit: Computer has gone to sleep.]
<fayimora>
What is the difference between the core and standard library?
<hoelzro>
vantage: you might want to use a gem for command line applications
<hoelzro>
I don't know of any though =(
<vantage>
hoelzro: no duck typing, eh?
<hoelzro>
well, a String just doesn't behave like a number =)
<vantage>
hoelzro: in Perl it does (if you want it to) :)
<hoelzro>
vantage: I know, but Ruby != Perl
<vantage>
hoelzro: As I'm discovering tonight :)
<hoelzro>
heh
<wallunit>
hoelzro: can i write code like "n || 2", in order to return n if it i not nil (or 0) and otherwith 2?
preller has joined #ruby
<hoelzro>
wallunit: n || 2 will still return 0 if n is 0
<hoelzro>
it will only return 2 if n is 2, nil, or false
yonggu has joined #ruby
<wallunit>
hoelzro: ok, that's also fine in my particular case.
<wallunit>
thanks
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
<Mon_Ouie>
To parse command line arguments, you can use a gem like slop or optparse from stdlib
boo1 has joined #ruby
darthdeus has joined #ruby
keppy has joined #ruby
hakunin has quit [Remote host closed the connection]
hakunin has joined #ruby
<apeiros_>
fayimora: core is what the ruby executable already contains
<apeiros_>
stdlib is what is supposed to be installed with every ruby, but you still have to require it
<apeiros_>
@supposed: some distros/package managers (apt, I'm looking at you!) decide that they know better what a complete ruby is than the ruby maintainers, so they don't install it along with the ruby package.
pk1001100011 has joined #ruby
ryanf has quit [Quit: leaving]
<boo1>
why does rvm installer is trying to install rvm to '/usr/share/ruby-rvm' not to $HOME?
<Hanmac>
cjs you could access the variable from an shared library ... if you know the name
<boo1>
And how can I install it to $HOME
williamcotton has joined #ruby
jgrevich has quit [Quit: jgrevich]
banisterfiend has joined #ruby
hakunin has quit [Ping timeout: 276 seconds]
cyong has quit [Quit: Leaving.]
urbann has joined #ruby
Goles has quit [Quit: Computer has gone to sleep.]
<cjs>
Hanmac: turns out I can just access the function directly from the other shared library, since I know the name.
<Hanmac>
"extern" is allmighty
Guest24250 has joined #ruby
<cjs>
hoelzro: So, problem solved. I don't need anything from the Ruby interpreter at all. The other shared library (the openssl extension) was dlopen()'d with RTLD_GLOBAL, so if I'm loaded after it, my symbols will be resolved against it. I just need to declare the function I want to call, and it will be linked at runtime.
<hoelzro>
ah
<hoelzro>
cjs: I did something like that with Perl and Lua once
twinturbo has joined #ruby
keyvan has quit [Ping timeout: 245 seconds]
<cjs>
The only danger here is that the declaration is not available with a distribution of Ruby since it's ossl_x509.h is not included in the ruby dev packages. So I simply have to declare it myself and hope it doesn't change.
<twinturbo>
hey. I can I setup a variable in a superclass that can be customized in further subclasses?
workmad3 has joined #ruby
<twinturbo>
but each modification is distinct to that class
<cjs>
The other quibble is that I might blow up if someone loads my extension before openssl, but rather than try to deal with that (e.g., I could wrap the load in ruby code that ensures that happens) I think I'll just leave it for the moment.
Ttech has quit [Ping timeout: 265 seconds]
<cjs>
Oh, wait, no I do have a convenient place to fix that. Done, then.
andreime has joined #ruby
Nigel has quit [Ping timeout: 248 seconds]
keyvan has joined #ruby
Nigel has joined #ruby
rking has quit [Ping timeout: 265 seconds]
Ttech has joined #ruby
iamlacroix has quit [Remote host closed the connection]
<Mon_Ouie>
(Does it recursively if no argument is passed)
<greyEAX>
oh god
<greyEAX>
no wonder
<greyEAX>
well now it's working
<greyEAX>
thanks
<boo1>
Why is rvm installer trying to install rvm to '/usr/share/ruby-rvm' not to $HOME?
<greyEAX>
it took three hours but thx for sticking with me
<bnagy>
boo1: because you're root
<boo1>
bnagy, you mean in root group?
<bnagy>
no, like hashprompt
<boo1>
bnagy, is it possible to specify installation directory?
<bnagy>
boo1: probably, I don't like rvm very much
alup has joined #ruby
<greyEAX>
thx bnagy, thx Mon_Ouie
<bnagy>
but if you run it as a user it will install in $HOME, if you run as root it will do a 'system install' which, in my experience, will usually fuck everything up
<bnagy>
greyEAX: no worries
hemanth has joined #ruby
<bnagy>
I really don't understand how grep was... ohhh right, he was evaluating it for truthiness, anything would have returned true
<bnagy>
yes, I am retarded
mdaisuke has quit [Remote host closed the connection]
<boo1>
bnagy, but I'm trying to install it as regular user
<boo1>
bnagy, and is there better solution then rvm?
cyong has quit [Quit: Leaving.]
<bnagy>
I prefer rbenv, this is OPINION only
Desmond has quit [Ping timeout: 246 seconds]
<hoelzro>
bnagy: what is it about rbenv that you prefer?
dwaynecrooks has joined #ruby
<hoelzro>
I've only ever used rvm
<Hanmac>
my system has latest ruby as system package
<banisterfiend>
bnagy: hey naggy, i'm thinking of shifting to rbenv as rvm is giving me bundler hell
<bnagy>
rbenv knows how to unix
<banisterfiend>
bnagy: it's putting all my apps in a bundler jail without me even saying anything about bundler!
vantage has quit [Remote host closed the connection]
<tintin>
I'm trying to know how it works internally.
<hoelzro>
"In order to conserve space, RVM does not automatically generate and install each Ruby's ri / rdoc documentation." Is there a configuration setting to override this?
umttumt has joined #ruby
codelette has quit [Remote host closed the connection]
<tintin>
Hanmac: Any idea?
Niamkik has quit [Ping timeout: 272 seconds]
<tintin>
Hanmac: Can you contact in #ruby-lang?
<Hanmac>
no you can "contact" in ruby-lang itself
<tintin>
I'm banned there.
bluenemo has joined #ruby
jgrep has quit [Read error: Connection reset by peer]
<bnagy>
hahaha
dr_diamond has joined #ruby
* Hanmac
wonders why
iocor has joined #ruby
jgrep has joined #ruby
<banisterfiend>
tintin: you're banned because you're a horrible person
<banisterfiend>
tintin: you need to go to therapy to improve yourself
<tintin>
lol
<banisterfiend>
:P
<tintin>
You need therapy too, because that should be banisterfriend, not banisterfiend
umttumt has quit [Remote host closed the connection]
<banisterfiend>
tintin: the therapists all banned me, too
<Hanmac>
no that is currect
<Hanmac>
"fiend" is a word too
<hoelzro>
fun stuff: I have to run "rvm docs generate all" from ~/.rvm/src
<banisterfiend>
hoelzro: i dont need to generate docs :P
nari has quit [Ping timeout: 245 seconds]
umttumt has joined #ruby
<Hanmac>
tintin: does your test shows some responce? i think your "redefinition of rb_ary_initialize is WRONG
<tintin>
Hanmac: I think so
<Hanmac>
look at the function head and say to me whats missing
<tintin>
Hanmac: I just can't understand how to handle with RARRAY
<tintin>
Which parameter is taking the array? rb_ary_initialize(int argc, VALUE *argv, VALUE ary)
<tintin>
argv or ary?
malkomalko has joined #ruby
<Hanmac>
try to guess ... but this not what i mean ... your function HEAD is still wrong
<banisterfiend>
hoelzro: my documentation tool extracts documention on the fly without requiring things to be pregenerated
<workmad3>
hoelzro: I don't think there's a config option to override it, but it tells you how to generate
jgrep has quit [Read error: Connection reset by peer]
<workmad3>
hoelzro: or just use google like the rest of us :P
<banisterfiend>
workmad3: did u know pry can even show module/class source now? :D
yaasii has quit [Quit: Leaving...]
<tintin>
Hanmac: static VALUE
yaasii has joined #ruby
<workmad3>
banisterfiend: I did not... if I used pry, I might know more :P
<Hanmac>
tintin yeah, VALUE as return type ... did you did this in your function too?
<tintin>
Hanmac: All are same, i just added the switch
<banisterfiend>
workmad3: you should use it, it's truly a heart breaking work of staggering genius
<banisterfiend>
Hanmac agrees
<banisterfiend>
;)
<workmad3>
banisterfiend: yeah, Hanmac would :P
cjs has quit [Ping timeout: 246 seconds]
<Hanmac>
i use it when pry is updated to an newer slop version
<banisterfiend>
Hanmac: it's updated on HEAD
mvangala_ has joined #ruby
<banisterfiend>
Hanmac: we're on slop 3.3.2 iirc
jbw_ has quit [Ping timeout: 246 seconds]
<Hanmac>
and its updated on rubygems too?
mnaser has joined #ruby
<banisterfiend>
Hanmac: not yet, probably doing a new release in under a week (i hope). We also added the ability to show C source for methods defined in 3rd party extensions (outside of core)
mvangala_ has quit [Remote host closed the connection]
mvangala_home has joined #ruby
<Hanmac>
... interesting ... i will test it on my c++ gems :P
arkiver has joined #ruby
<tintin>
Hanmac: Any idea?
<banisterfiend>
Hanmac: dont u have to wrap a member function in a pure C function before u bind it to a ruby method though?
<banisterfiend>
it'll likely show the source for that C wrapper
<banisterfiend>
so maybe not so useful
<Hanmac>
banisterfiend ... yeah i need to do, but i use macros for that ...
<banisterfiend>
yeah with macros all bets are off
<Tasser>
Hanmac, there are c++ gems? Isn't the API quite c-heavy?
<banisterfiend>
as you can build any syntax u like with that..
<Hanmac>
Tasser, not realy ... but to support external c++ libs my gems are need to be c++ too
<workmad3>
banisterfiend: run the source through the preprocessor before displaying it?
<workmad3>
hmm, probably a bit too heavy... would require work setting up load paths, etc
<banisterfiend>
workmad3: well we're actually using yard to parse the c file and extract the code, so we dont actually take part in any of that stuff
hemanth has quit [Read error: Connection reset by peer]
<banisterfiend>
but i guess if we got realy serious about it we could add that in the future
<workmad3>
banisterfiend: would probably make sense to push it into yard if you were interested in that :)
hemanth has joined #ruby
<banisterfiend>
workmad3: maybe
<workmad3>
banisterfiend: although I guess it would depend on what is more useful... trying to track something back to an 'original' definition before macroisation, or displaying it unprocessed
<workmad3>
err, just realised both of those statements were the same :)
<workmad3>
would it be better to display before or after preprocessing?
<workmad3>
that's what I meant :)
eka has joined #ruby
<eka>
hi all
<eka>
is there any way I can detect if a string is HTML?
dhruvasagar has quit [Ping timeout: 245 seconds]
berkes has joined #ruby
frishi has joined #ruby
<Tasser>
eka, I think that was a stackoverflow question some time ago
Spooner has joined #ruby
<eka>
Tasser: ok, I will try to look over it
execute has joined #ruby
<banisterfiend>
workmad3: another cool feature we have, is show-source -a ClassName it'll show u all monkeypatches (and the full source for each monkeypatch) for a given class/module
<eka>
Hanmac: without having to depend on Nokogiri? but still, useful thanks
dhruvasagar has joined #ruby
<Hanmac>
eka, depend on what you want ... is <br> valid for you?
<eka>
Hanmac: ah, is installed... lol
<workmad3>
banisterfiend: nice, it shows me all the AS additions to array :)
jcromartie has joined #ruby
jbw_ has joined #ruby
acidrain has joined #ruby
<banisterfiend>
workmad3: cool
<hoelzro>
what's the recommended way to document a C module in Ruby?
<banisterfiend>
workmad3: it's more powerful on HEAD as i detect class_eval extensions too
<Hanmac>
hoelzro you mean a c-gem?
ph^ has joined #ruby
<eka>
Hanmac: yes it's just a snippet, not a whole HTML page.. .that will not validate
mvangala_home has quit [Ping timeout: 260 seconds]
<hoelzro>
Hanmac: yes, thanks
<banisterfiend>
workmad3: type 'help' for more info on stuff
<workmad3>
banisterfiend: found a bug :P
<Hanmac>
hoelzro: i would use rdoc for documenting ... what works with rdoc should work for yard too
<banisterfiend>
workmad3: gist
<workmad3>
banisterfiend: something like a rails model is loaded on demand... so if I show-source before its loaded, it doesn't find it :P
bier has quit [Ping timeout: 252 seconds]
<banisterfiend>
workmad3: yeah autoload stuff is a real pain
<Hanmac>
thats why autoload will be rermoved
<workmad3>
banisterfiend: yeah, I'm not saying it's a *valid* bug... :)
mengu has quit [Remote host closed the connection]
<banisterfiend>
workmad3: thankfully they're getting rid of it sometime in the future :) (at least according to matz). But if you file an issue we might be able to do something about it in the meantime: https://github.com/pry/pry/issues
<workmad3>
banisterfiend: and it would be fine in prod where that sort of stuff is loaded at boot
<workmad3>
and autoload is slated for removal in ruby 3.0 at the earliest, iirc
<workmad3>
seeing as we're not even at 2.0, that's likely another 5-10 years
<banisterfiend>
yeah
<workmad3>
and the main reason it's being removed is because of thread issues with it...
<banisterfiend>
workmad3: run a method that generates an exception, then type: cat --ex multiple times
<workmad3>
banisterfiend: nice :)
hemanth has quit [Read error: Connection reset by peer]
<banisterfiend>
workmad3: edit --ex, also opens the editor to the line that generated the exception
<banisterfiend>
anyway, enough marketing
hemanth has joined #ruby
jgrep has quit [Read error: Connection reset by peer]
<workmad3>
banisterfiend: shouldn't it bottom out at the line typed into pry though, not 'result = target.eval(code, Pry.eval_path, Pry.current_line)'?
jgrep has joined #ruby
Lachryma has joined #ruby
<banisterfiend>
workmad3: i like making the full backtrace available, esp. when pry is used to debug pry, it would make things difficult if we clipped off pry internal stuff
<workmad3>
banisterfiend: well, why does it bottom out at the repl invocation then? there's still more stacktrace available after that I bet
fra000 has quit [Quit: Leaving]
Ste11a has quit [Read error: Connection reset by peer]
<workmad3>
banisterfiend: oh, it's just because I had multiple layers of repl available
<banisterfiend>
workmad3: well it goes through the actual stacktrace, i dont prune it at all, so if it's in the stacktrace it'll bring you through it
Ste11a has joined #ruby
<banisterfiend>
cat --ex actually moves throgh _ex_.backtrace where _ex_ is the last exception
<workmad3>
banisterfiend: just looked like it stopped at that pry line :)
<banisterfiend>
oh ok
<workmad3>
banisterfiend: I like that it loops back around :)
<banisterfiend>
workmad3: if you include pry-stack_explorer and pry-exception_explorer, then u can actually move through the stack frames to access the state, rather than just looking at code
<boo1>
I have created group 'rwm', created user 'username' in this group, loged in as 'username', ran rwm installation script and got 'can not create directory /usr/shar/ruby-rwm'. And question, how can I install rwm to $HOME?
CannedCorn has joined #ruby
lahwran- has quit [Changing host]
lahwran- has joined #ruby
lahwran- is now known as lahwran
niku4i has joined #ruby
nari has joined #ruby
sailias has joined #ruby
yugui is now known as yugui_zzz
Doc_X1 is now known as Doc_X
g0bl1n has joined #ruby
CannedCorn has quit [Quit: Computer has gone to sleep.]
dhruvasagar has joined #ruby
niku4i has quit [Ping timeout: 252 seconds]
dhruvasa1ar has quit [Read error: Connection reset by peer]
vectorshelve has quit [Quit: Page closed]
RainbowDashh has quit [Quit: SLEEP MODE. <@suborbital> no i filtered out RainbowDashh join quit msgs - appearantly it filtered out everything]
iocor has quit [Ping timeout: 265 seconds]
miho has joined #ruby
iocor has joined #ruby
SeanLazer has quit [Quit: SeanLazer]
mirash has joined #ruby
grendlme has quit [Quit: grendlme]
chson has quit [Remote host closed the connection]
mirash has quit [Read error: Connection reset by peer]
QaDeS has joined #ruby
saispo has quit [Ping timeout: 260 seconds]
g0bl1n has quit [Quit: Ex-Chat]
g0bl1n has joined #ruby
mirash has joined #ruby
saschagehlich_ has joined #ruby
My_Hearing has joined #ruby
My_Hearing has quit [Changing host]
My_Hearing has joined #ruby
Mon_Ouie has quit [Ping timeout: 276 seconds]
saispo has joined #ruby
saschagehlich has quit [Ping timeout: 246 seconds]
saschagehlich_ is now known as saschagehlich
riginding has joined #ruby
arkiver has quit [Quit: Leaving]
abionic has quit [Ping timeout: 248 seconds]
td123 has joined #ruby
ken_barber has joined #ruby
francisfish has joined #ruby
linoj has joined #ruby
jrist-afk is now known as jrist
Criztian has joined #ruby
Solnse has joined #ruby
saschagehlich has quit [Ping timeout: 276 seconds]
SeanLazer has joined #ruby
minijupe has joined #ruby
pu22l3r has quit [Remote host closed the connection]
davidpk has joined #ruby
saschagehlich has joined #ruby
minijupe has quit [Client Quit]
hynkle has joined #ruby
<davidpk>
Is there any way to set an instance variable, knowing its name beforehand as a symbol, without having to set up attr_(accessor|writer)s?
djdb has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
carloslopes has joined #ruby
<davidpk>
Obviously I could use eval, but is there a better way?
ikaros has joined #ruby
arussel` has joined #ruby
krusty_ar_ has joined #ruby
<banisterfiend>
davidpk: instance_variable_set
Progster has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
<enroxorz>
Hey Guys, hoping i can get a knowledge nugget with my situation. First, I have a gem that can either be called as a library and pulls down all images in a 4chan board. Right now, it pulls it once into the directory called and if called again skips the images that have been already pulled. I want to run this indefinately until the board 404's and I cannot figure an elegant way of doing this.
<teampoop>
hi there.. I have an env quesiton.. I have a variable, CODAPATH set in my .bash_rc, but when I run a gem it's not picking up the ENV['CODAPATH']
<teampoop>
any idea why?
itnomad has joined #ruby
<teampoop>
when I echo $CODAPATH in terminal it echos just fine
deryl is now known as Guest60214
BeLucid has quit [Read error: Operation timed out]
nateberkopec has quit [Quit: Leaving...]
deryldoucette is now known as deryl
<shevy>
teampoop did you export it
Guest60214 has quit [Ping timeout: 272 seconds]
<shevy>
when you exported it, test in irb
<shevy>
it will show up 100% in irb
xaq_ has joined #ruby
RLa has left #ruby ["Leaving"]
savage- has joined #ruby
sadasd has quit []
<teampoop>
oh no.. thank you shevy!
mneorr3 has joined #ruby
kpshek has joined #ruby
Vert has joined #ruby
<shevy>
\o/
mnaser has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
xaq has quit [Ping timeout: 244 seconds]
mneorr2 has quit [Ping timeout: 246 seconds]
timonv has quit [Remote host closed the connection]
xaq has joined #ruby
mnaser has joined #ruby
rambda has joined #ruby
CheeToS has quit [Ping timeout: 250 seconds]
kenichi has joined #ruby
dhodgkin has joined #ruby
grendlme has quit [Quit: grendlme]
dhodgkin is now known as Guest80820
<rambda>
quick question about Net::Telnet, is Prompt required? The equipment I'll be connecting to doesn't give any feedback that it's waiting for input...
<tcopp>
/pa/
tcopp has left #ruby [#ruby]
xaq_ has quit [Ping timeout: 260 seconds]
akem has quit [Ping timeout: 265 seconds]
hoelzro is now known as hoelzro|away
Guest80820 is now known as dhodgkin
bradhe has joined #ruby
<shevy>
rambda not sure, I think telnet usually did not display any prompt
<shevy>
but under windows, with their telnet client, I think there was an option to display what one types at least
<shevy>
hmm and in MUDs, the prompt usually was a '>'
ghanima has joined #ruby
darthdeus has quit [Quit: Leaving...]
cantonic_ has joined #ruby
freeayu has quit [Quit: 离开]
albemuth has joined #ruby
Juul has joined #ruby
cantonic has quit [Ping timeout: 240 seconds]
cantonic_ is now known as cantonic
axl_ has quit [Read error: Connection reset by peer]
wilmoore has quit [Remote host closed the connection]
cherrypeel has joined #ruby
zeade has joined #ruby
axl_ has joined #ruby
yannis has quit [Read error: Connection reset by peer]
<Hanmac>
but when you only want the years: 10.times.map(&Date.today.year.method(:+))
<Mon_Ouie>
You must really hate blocks
b26 is now known as brendan`
xclite has joined #ruby
<Hanmac>
Mon_Ouie do you mean me?
wallerdev has joined #ruby
<Hanmac>
nono i LOVE blocks, but i know that &stuff is faster
<Mon_Ouie>
Yeah. It seems so much more natural just to do 10.times.map { |n| Date.today.year + n }
<apeiros_>
Hanmac: depends
<eam>
I like (1..10).map
luckyruby has joined #ruby
<Mon_Ouie>
(1..10) != 10.times though
chienpo has joined #ruby
akem has quit [Read error: Connection reset by peer]
<eam>
Mon_Ouie: how do you figure?
<Mon_Ouie>
(10.times iterate from 0 to 9, not 1 to 10)
Drewch has joined #ruby
mnaser has quit [Ping timeout: 260 seconds]
tvw has joined #ruby
<eam>
Mon_Ouie: well that's what he asked for above
<eam>
wasn't it?
akem has joined #ruby
<eam>
Mon_Ouie: either way, 0..9 :)
<Mon_Ouie>
I think he wanted 0..10 actually
<eam>
expressing the start and end of the sequence is better than "X.times"
<luckyruby>
I have a script that outputs data to a file. If I run into an exception midway through, how do I take care of deleting the file I've already opened for writing, since it's only partially complete?
<eam>
because the indices are explicit
<luckyruby>
is it as simple as removing the file in rescue?
mnaser has joined #ruby
<eam>
luckyruby: probably yes
rippa has joined #ruby
<Mon_Ouie>
Maybe ensure if you need to remove the file when you're done with it even if no error occured
<Mon_Ouie>
(Ok, actually that makes no sense, nvm)
davidcelis has joined #ruby
Axsuul has joined #ruby
<shadoi>
Anyone else used PacketFu::StructFu?
banghouse has quit [Remote host closed the connection]
arussel` has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
Jake232 has joined #ruby
jxpx777 has joined #ruby
hynkle has quit [Read error: Connection reset by peer]
mnaser has quit [Ping timeout: 240 seconds]
xaitec has joined #ruby
lbostic1 has joined #ruby
<xaitec>
Has anyone used brightened on ubuntu
tintin has joined #ruby
<tintin>
Anybody?
lbostic has quit [Quit: Page closed]
<xaitec>
Brightbox
mnaser has joined #ruby
<tintin>
Has anyone worked with ruby source code?
<lbostic1>
How do you use a class within another class? I tried to require the class file but got an error "cannot load file"
Juul has quit [Ping timeout: 276 seconds]
<shevy>
lbostic1 you mean you have problem to require the file
<shevy>
lbostic1 how do you try to require the file
<davidcelis>
tintin: where's snowy
<shevy>
require_relative should work on 1.9.x
<lbostic1>
I guess... did know if I was doing it wrong
<lbostic1>
Require_relative? What does that do?
SQLStud has joined #ruby
<tintin>
davidcelis: snowy is crying , because none can solve my problem
<lbostic1>
I did it this way: require 'class file name.rb'
mobilegamelabs has quit [Ping timeout: 252 seconds]
<shevy>
lbostic1 if the filename is "santa_claus.rb" then you must require that name
sailias has joined #ruby
<lbostic1>
That is what I did
<shevy>
lbostic1 our file name is 'class file name.rb' ? with the ' ' ?
mengu has joined #ruby
<shevy>
are you on windows :)
beneggett has quit [Remote host closed the connection]
<lbostic1>
yes
<shevy>
aaaah
<shevy>
ok I see
nadirvardar has quit [Ping timeout: 246 seconds]
<shevy>
make some test file, call it foo.rb, in irb you should be able to do: load 'foo.rb'
<shevy>
then you know that loading a file works
<lbostic1>
ok
<shevy>
next step is to either use require_relative 'foo.rb' instead, or to add the load path
<shevy>
like so:
<shevy>
$: << File.dirname(__FILE__)
<shevy>
that appends to $:
<shevy>
in irb, you can also do:
<lbostic1>
I specified the full path name and it still failed
<shevy>
require 'pp'; pp $:
<shevy>
did you use load
<lbostic1>
no
<shevy>
did you skip some of my steps ;P
<lbostic1>
let me try all these first
<shevy>
we need to work on things that are sure to work for you first
<lbostic1>
I was just sharing what I did previously
<shevy>
load() should work
<lbostic1>
I'll try it
beneggett has joined #ruby
<lbostic1>
thx!
araujo has quit [Quit: Leaving]
SiliconDon has joined #ruby
fermion has quit [Quit: P]
<shevy>
ok load works?
<shevy>
you should then test require, which will fail I suppose, but require_relative should work
dnyy has joined #ruby
<shevy>
after that, try the $: << File.dirname(__FILE__) trick
<shevy>
or perhaps
trend has quit [Read error: Connection reset by peer]
<shevy>
$: << File.dirname(Dir.pwd)
trend has joined #ruby
<shevy>
I dont remember, I added so much to my irbrc
<lbostic1>
Shevy: still got "No such file to load"
<shevy>
via require right?
<tintin>
RubyPanther: Any idea?
<tintin>
davidcelis: Any idea?
<shevy>
lbostic1, this is because the current dir is not in the path where ruby looks for by default
<shevy>
do pp $:
<RubyPanther>
tintin: yeah, 2 of them. one is, are you sure it is a long not an int? And the other is, why do you convert it to a NUM if you want to print it with the C printf?
jxpx777 has quit [Quit: Be back later]
<tintin>
RubyPanther: What should i do?
<RubyPanther>
"Should" is rather broad
samuel02 has quit [Remote host closed the connection]
<RubyPanther>
IMO you probably "should" just leave the arrays as Ruby objects and pull the C values out through the Ruby API instead of trying to juggle C arrays
selvakumaran has joined #ruby
flakrat has quit [Quit: Leaving]
araujo has joined #ruby
jcromartie has joined #ruby
<lbostic1>
I am using RubyMine not irb Should not matter but just thought you should know.
<RubyPanther>
I mean you have Ruby sitting right there, let it do the stuff it is good at, and let the C parts just be glue
Bosma has quit [Quit: leaving]
<tintin>
RubyPanther: Can you pastebin the code?
<bnagy>
tintin: still trollin?
<RubyPanther>
I am not going to write it, I already have a bunch of Ruby C open in emacs :P
<bnagy>
hopefully you die of cancer soon
<RubyPanther>
Thanks to mRuby and RiteVM I'm busy trying to learn Ruby ASM
beneggett has quit [Ping timeout: 240 seconds]
<shevy>
yay
<bnagy>
all - there is a reason tintin is banned on ruby-lang
<shevy>
not only RubyPanther is back, he'll also use mRuby!
<shevy>
I used mirb
<shevy>
and I can not load or require anything with it
<shevy>
:(
<RubyPanther>
Wait, I was talking up mRuby long before we had the code :)
<shevy>
but 5+5 works... so mirb is 50% functional
<tintin>
RubyPanther: I could not understand what you said me to do.
<RubyPanther>
Yeah, that is the big question... what are we going to do instead of rubygems
<shevy>
dunno
<shevy>
matz will go to the state before rubygems existed
<shevy>
;)
<shevy>
and autoload won't be in mruby either
<shevy>
haha
<tintin>
bnagy: Still trollin?
<RubyPanther>
Perhaps there is need for some sort of rubygems-replacement for RiteVM binaries
Bosma has joined #ruby
<tintin>
RubyPanther: I could not understand what you said me to do. Can you show example code?
<elux>
looks like the author on stackoverflow shows the output of this working.. but maybe something with namespacing in thor has changed since then?
<RubyPanther>
tintin: for example instead of doing RARRAY_PTR(ary) ... you could use rb_funcall(ary,rb_intern("some_ruby_method_on_Array"),0)
<Jackneill>
can you help me? i cant install a gem.... no error, just in the end it wouldnt install it. but i get the correct messages...
ph^ has joined #ruby
<RubyPanther>
If all the messages are correct, everything is working.
<lbostic1>
Shevy: RubyMine has a setting for load path. This is already set for the directory where the code is.
<lbostic1>
Question when I specify the require should it be in the class or be fore the class or does it matter
yankhates has quit [Ping timeout: 245 seconds]
Guest43828 has quit [Ping timeout: 260 seconds]
<Jackneill>
rubypanther: when i do gem list or gem1.8 list i get only 1 gem: rake
<shevy>
lbostic1 I have no idea what is RubyMine
<Jackneill>
so its not working, i am using ubuntu 12.04
tvw has quit [Remote host closed the connection]
<shevy>
I would not trust things like RubyMine too much if I were you
<lbostic1>
It is an IDE made by JetBrains
<shevy>
lbostic1, it does not matter much where the require happens
<shevy>
usually it comes bundled right at the top of the file
<lbostic1>
made just for Ruby
cuppsy has quit [Read error: Connection reset by peer]
jgarvey has joined #ruby
ghanima has joined #ruby
<RubyPanther>
require goes at the start unless it is conditional, then it may or may not go somewhere else
visof has quit [Ping timeout: 276 seconds]
<lbostic1>
This is really a simple thing ... I am sure there is a stupid reason why it is not working
monkegjinni has quit [Remote host closed the connection]
yankhates has joined #ruby
<lbostic1>
Should I package it in a module or something?
pcboy_ has quit [Ping timeout: 246 seconds]
<Jackneill>
rubypanther im not as pro any idea what should i do?
digitalcakestudi has quit [Quit: Leaving.]
<RubyPanther>
Jackneill: well the first question is, are you using rvm or rbenv or the system ruby, and the second question is, did you run gem install as root?
pcboy_ has joined #ruby
jrist-gym is now known as jrist
<Jackneill>
rubypanther: i use rvm, and yes, root.
itnomad has quit [Quit: Leaving]
<Jackneill>
cause i need to be as root
<Jackneill>
cause permissions..
<shevy>
the superuser
<shevy>
superman is superuser all the time
<shevy>
he laughs about sudo
<lbostic1>
Shevy: this is my structure : class foo require 'TheClassFileIWantToUse' cls = TheClass.new end ... would this be correct?
jekhokie has quit [Ping timeout: 264 seconds]
<Hanmac>
until he installs bumblebee
<Jackneill>
sudo su ?
<shevy>
lbostic1 but it at the top
<shevy>
lbostic1 also, I wrote it before, require alone like this wont work, unless you installed it into the SITE PATH of ruby
pu22l3r_ has quit [Ping timeout: 272 seconds]
cuppsy has joined #ruby
<Jackneill>
hm interesting
<RubyPanther>
Jackneill: normally it would be system gem and run as root, or rvm and run as user... you might have to reload rvm or exit the shell and open a new one
<Jackneill>
in sudo su, when i do gem list i got the colorize lib, and many others.
atmosx has quit [Ping timeout: 276 seconds]
<RubyPanther>
Jackneill: you might have to install it like sudo /path/to/rvmruby/gem instead of just sudo gem
<RubyPanther>
I think there is some rvm shortcut for that case
<Jackneill>
hm
<RubyPanther>
presumably /usr/bin/gem list shows the one you installed
<bricker88>
gks: the nginx executable is at /etc/init.d/nginx, but that doesn't have a -v option
<bricker88>
I guess it was installed via yum on this system
yankhates has joined #ruby
<gks>
err, you sure it's in /etc/? that is probably just the shell script that launches it on boot
<gks>
it's probably in /usr/bin or /usr/local/bin
<bricker88>
gks: You're probably right - I just don't know where the actual one is
<bricker88>
okay I'll look there
monkegjinni has joined #ruby
<gks>
i'm not familiar with rpm or yum. but you could use that to tell you where it was installed
<gks>
you could also open the shell script and check there
<bricker88>
good idea
<bricker88>
thank you
<gks>
it has to have the full path to the executable
<bricker88>
good idea
KaOSoFt has joined #ruby
makkura has quit [Remote host closed the connection]
tcopp has left #ruby [#ruby]
<KaOSoFt>
Hello there.
* offby1
checks his wallet
chico_chicote has joined #ruby
<KaOSoFt>
I’m curious. While doing something like “gem spec -r” to gems like RedCloth, serve and goliath, I get garbled text in most places where there should be a summary or a gem dependancy name. Is it just me?
<KaOSoFt>
offby1, can you try it yourself? gem spec -r goliath
<offby1>
I wonder if the garbling could be either a) escape codes to colorize the output; or b) non-ASCII characters
<offby1>
hm, let's see
vlad_starkov has quit [Remote host closed the connection]
kenichi has quit [Remote host closed the connection]
<KaOSoFt>
Never happened to me, and I think I had used RedCloth in the past.
<offby1>
I don't see anything weird, offhand
<offby1>
just a couple of long numbers preceded by an ampersand
visof has joined #ruby
<KaOSoFt>
Try the summary, at the end of the response.
<KaOSoFt>
This is my goliath summary: “QXN5bmMgZnJhbWV3b3JrIGZvciB3cml0aW5nIEFQSSBzZXJ2ZXJz”
Gavilan has joined #ruby
<KaOSoFt>
How weird. Oh, well, I just wanted to check that it wasn’t just me.
kenichi has joined #ruby
stephenjudkins has joined #ruby
Ethan has quit [Ping timeout: 276 seconds]
ryan0x2_ has joined #ruby
<Xethron>
Heya. I have a prepared SQL statement. But its being generated based on conditions. Meaning I don't know what the end SQL will look like. How can I add the relevant variables to the excecute ( ) command?
<Xethron>
Like, there might be only two variables - excecute ( var1, var2 ) - or there might be none - excecute ( ) -or there might be more.......
<Xethron>
But seeing as they aren't added in a single string line, I am not sure how to handle it :/
<Xethron>
unlike the sql...
mnaser has quit [Ping timeout: 276 seconds]
<offby1>
KaOSoFt: summary: Async framework for writing API servers
mnaser has joined #ruby
<stephenjudkins>
Xethron: you haven't mentioned what library you're using to access the DB. the answer depends almost entirely on that.
<Xethron>
stephenjudkins: My apologies
<KaOSoFt>
Okay... now I am curious, given it’s only a handful with such response. In any case, thanks for confirming my doubts, offby1. :)
<Xethron>
the MySQL lib
graspee has quit [Quit: leaving]
<stephenjudkins>
Xethron: oh, you're just asking for varargs. nevermind
<stephenjudkins>
execute(*array_of_arguments)
<Xethron>
stephenjudkins: Thanks! :D
stat1x has quit [Remote host closed the connection]
<project2501a>
*wave* hihihi. i am reading the o'reilly book. question: i see a var declared here cash = 1000.00 does that mean that ruby will remember that as float and will keep only the two more significant floats?
<apeiros_>
elektronaut: could just write class << klass directly.
<elektronaut>
true
<shevy>
project2501a no, only one
<shevy>
it will be 1000.0
gyre007 has quit [Quit: Ex-Chat]
<shevy>
dunno if there is a "scientific calculation" mode for ruby
<apeiros_>
um, no shevy
<apeiros_>
and no project2501a
<chico_chicote>
apeiros_: if i did a class_eval, would it work then?
burgestrand has joined #ruby
<apeiros_>
1000.00 is just a float. with float precision.
<project2501a>
single precision?
<apeiros_>
native double
<project2501a>
hokay!
<project2501a>
thank you!
<apeiros_>
so `cash = 1000.00` is actually a very bad example
<apeiros_>
since floats & currency == horrible idea
geekbri has quit [Remote host closed the connection]
<project2501a>
you can have apeira cash
<Xethron>
stephenjudkins: should I just go "array_of_arguments = Array.new" / "array_of_arguments[0] = var1" / "array_of_arguments[1] = var2" / "array_of_arguments[2] = var3" / "execute(*array_of_arguments)"
<apeiros_>
see BigDecimal (stdlib) or Monetary (gem)
<chico_chicote>
well, any recommended readings for metaprogramming? it'd be nice to grok this
niku4i has joined #ruby
fivre has left #ruby [#ruby]
<project2501a>
apeiraos, rtfming already
<Hanmac>
shevy do you mean like this? 3.5e10 ?
<apeiros_>
project2501a: you can tab-complete nicks in almost all chat clients
kaneda has joined #ruby
<apeiros_>
avoids typos
<stephenjudkins>
Xethron: well, that would technically work... but that's a terrible way to build an array
<shevy>
Hanmac no I meant if you weigh something and need the least significant amount
<project2501a>
apeiros_: what typo?
kaneda is now known as Guest65264
<Xethron>
stephenjudkins: That is?
<stephenjudkins>
Xethron: yes
<apeiros_>
project2501a: apeiraos != apeiros_
<Xethron>
stephenjudkins: whats a better way?
<project2501a>
i said "apeira"
<shevy>
apeiraos is a pharao of old egypt
<project2501a>
I'm Greek dude :P
<stephenjudkins>
so... [var1, var2, var3] is much more readable and less code
<project2501a>
that was no typo
<apeiros_>
project2501a: um, no, `22:41 project2501a: apeiraos, rtfming already ` is apeiraos
<shevy>
project2501a man why did you lose in soccer against germany ;(
<project2501a>
ah. *that* typo
<project2501a>
r.
<stephenjudkins>
but you should be building enumerable object through #map, #select from other enumerables
<Xethron>
stephenjudkins, yes, but they are added under if statements, so its not all done in one line.......
<project2501a>
if we done, they would have raised interest rates
<Tasser>
shevy, well, germany kinda owns the greeks
<project2501a>
fucking autocorrect
berserkr has quit [Quit: Leaving.]
<luckyruby>
I'm using File.open to write a file. If I write to a directory that doesn't exist, I get no such file or directory exists (no surprise here). How do I make it so if a directory doesn't exist, create that directory and retry? Should I just use rescue with a system call to mkdir -p followed by a retry?
<project2501a>
s/done/won/
<apeiros_>
project2501a: lol @ autocorrect
<project2501a>
apeiros_: anyway, thank you.
<shevy>
hehe project2501a
<apeiros_>
didn't think about *that* as a possible cause… :)
* apeiros_
off
<stephenjudkins>
Xethron: ok, do whatever you want... you can check if it works yourself. but expressions are almost always better to use than statements
<shevy>
luckyruby something like FileUtils.mkdir(i) unless File.exist? i
<shevy>
luckyruby I dont think you need retry. simply check before you continue.
LowKey has quit [Quit: changing servers]
akem has quit [Quit: Forget progress by proxy. Land on your own moon.]
niku4i has quit [Ping timeout: 248 seconds]
<Hanmac>
shevy "why did Greek lose against germany in soccer?" "Because we paid them"
<Spooner>
luckyruby shevy: FileUtils.mkdir_p(i) will create unless it exists.
<Boohbah>
class names and constants start with capitals, not method names
<Boohbah>
oh, and modules too
<burgestrand>
method names might, useful sometimes
<burgestrand>
Array(x) is one
bearlulz has quit [Quit: Computer has gone to sleep.]
<Boohbah>
oh
<burgestrand>
Not very often though, and you can’t call them without arguments without parentheses
tylersanders has joined #ruby
<burgestrand>
so Array is still a constant, Array x is a method call, not confusing at all
<burgestrand>
:p
<shevy>
spycrab0 you put it into a module
<shevy>
so you must tell ruby where to find it
jonathanwallace has joined #ruby
<shevy>
ParseCommand::Parse should work
<shevy>
or include ParseCommand
<Spooner>
Or ParseCommand.Parse (which makes it look more methody perhaps).
<spycrab0>
thanks
<spycrab0>
okay next time im using include
<Spooner>
Oops no, it is not a module method but an instance one, so you need to include ParseCommand; Parse
carloslopes has quit [Quit: Leaving.]
carloslopes has joined #ruby
Synthead has quit [Quit: p33 ba115]
<atmosx>
hello
Guest17156 has quit [Ping timeout: 246 seconds]
<spycrab0>
ParseCommand::Parse and ParseCommand.Parse doesnt work
yankhates has quit [Ping timeout: 264 seconds]
graft has joined #ruby
ilyam has joined #ruby
<shevy>
indeed, use include
<shevy>
or def self.Parse
ringotwo has quit [Remote host closed the connection]
<spycrab0>
can i use include like require (for Example include "ParseCommand")?
<stephenjudkins>
spycrab0: include is a totally different thing from require
SeanLazer has quit [Quit: SeanLazer]
<socomm>
when i run 'ri' i get Classes and Modules known to ri:
akem has quit [Ping timeout: 252 seconds]
<stephenjudkins>
it's used for mixing modules into each other. require is used to load and parse ruby source files.
<socomm>
but nothing after it, im guessing i have to install the docs?
jgrevich has quit [Read error: Connection reset by peer]
<apeiros_>
socomm: have you installed ruby via rvm?
<socomm>
apeiros_: apt-get
jgrevich has joined #ruby
olrrai has joined #ruby
<apeiros_>
ew
<apeiros_>
you usually get horribly outdated rubies from apt-get
<apeiros_>
also incomplete
kstephens has quit [Ping timeout: 260 seconds]
<apeiros_>
but yes, with apt-get, the docs are a separate package.
<socomm>
apeiros_: any idea what they'd be called?
<apeiros_>
I'd try #ubuntu or #debian
<spycrab0>
i cant find a include syntax
<apeiros_>
something with ruby-*doc*
rowanu has quit [Remote host closed the connection]
<apeiros_>
I'd guess
leifmadsen has joined #ruby
<atmosx>
debian is easy to use, IU should switch from Gentoo to Debian... I'm too bored to learn how to use apt-get properly
<shevy>
lol
<socomm>
atmosx: ?
<atmosx>
socomm: what? :-P
<shevy>
atmosx is hilarious :-)
<shevy>
rking uses gentoo too btw
kstephens has joined #ruby
tylersanders has quit []
<socomm>
rubygems-docs, could that be it?
* atmosx
is on a rdc-based chipset, you can imagine the hours it takes for a kernel recompile
<socomm>
disregard, looks like that was it
<atmosx>
socomm: are you in ruby1.8?
<shevy>
spycrab0 you use include with module names. If your module is called "module Foobar", then you do this "include Foobar". all without "quotes"
<atmosx>
ok
<atmosx>
rking is a "racer" :-p
<shevy>
he is also a vimster
<spycrab0>
i still get the error: uninitialized constant ParseCommand (NameError)
<shevy>
and looks like a hamster
<shevy>
spycrab0, no. then you did not require the file properly before. you must (a) require, then you can (b) include it. ruby does not know that module before you loaded it
<leifmadsen>
hey all, I think I'm grasping at straws here, but maybe someone knows. This maybe slightly OT. I'm using minitest specs with chef via minitest-handler on a machine with ruby 1.8 (CentOS 6). I'm getting this TypeError when using file("foo").must_exist.with(:owner, "root), but if I drop everything after .must_exist, it seems to execute correctly. http://pastebin.ca/2163954
<atmosx>
I think I like rking a lot
<shevy>
there is no python import like functionality in ruby spycrab0
DanBoy has joined #ruby
<atmosx>
bbl
bigkevmcd has quit [Quit: outta here]
<spycrab0>
it works no
<spycrab0>
*now
<shevy>
\o/
<socomm>
I'm doing 'ri File' but i don't see the read method under class methods http://pastebin.com/hjuwfDz4 what am i doing wrong?
cherrypeel has quit [Ping timeout: 240 seconds]
<shevy>
somehow I hate require_relative :(
<shevy>
require is so much less to type
<shevy>
socomm could be it is defined somewhere else perhaps
<shevy>
IO.read perhaps?
yankhates has joined #ruby
<Hanmac>
shevy: i could overwrote to this: require path, true for relative :P
<shevy>
elektronaut, problem is I would have to carry this modification with me in all my projects
explody has joined #ruby
<shevy>
I wonder how mruby will solve this
<shevy>
will it have all ... a load and a require AND a require_relative
chson has quit [Remote host closed the connection]
k_89 has joined #ruby
<k_89>
is there a class-autoloader of sorts in ruby?
<shevy>
I think there is via autoload
<shevy>
Bundler.autoload
<shevy>
Hanmac's favourite method
xnm has joined #ruby
atmosx has quit [Ping timeout: 276 seconds]
<burgestrand>
k_89: there is a method that is executed when a constant is requested that does not exist
vlad_starkov has joined #ruby
S1kx has joined #ruby
jonathanwallace has quit [Read error: Connection reset by peer]
<burgestrand>
k_89: you can also define certain files to be loaded when certain constant names are requested (essentially you say, if constant A is requested, then load this file and try again)
cbuxton1 has joined #ruby
jonathanwallace has joined #ruby
<burgestrand>
However, I believe the autoload feature is getting removed in the future in ruby, so it’d be deprecated
cbuxton has quit [Ping timeout: 265 seconds]
<k_89>
oh
<k_89>
i was just going to make an autoloader based on it
rippa has quit [Ping timeout: 248 seconds]
<Hanmac>
it may work on ruby 2.0 but it will be gone in 3.0
<wunz>
do i have to write all my code in ONE file?
<wunz>
burgestrand: i used required but didn't work
atmosx has joined #ruby
<k_89>
wunz, have you used php ?
<burgestrand>
wunz: it does
S2kx has quit [Ping timeout: 265 seconds]
<wunz>
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- Monitor (LoadError)
<k_89>
pardon me for taking that name here
* burgestrand
shrugs
<wunz>
although the file is in the same dir
<burgestrand>
wunz: it’s a bit more complicated than that
<Hanmac>
wunz you use ruby1.9
<Hanmac>
you need require_relative
SeanLazer has joined #ruby
<wunz>
ah that worked. thanks hanmac
<burgestrand>
require is actually fairly complicated in ruby, now that I think of it, it’s probably best you just do require './monitor' or require_relative 'monitor'
<burgestrand>
the ins and outs of require come with time
k_89 has quit [Quit: Leaving]
vlad_starkov has quit [Ping timeout: 248 seconds]
minijupe has quit [Quit: minijupe]
aantix has quit [Remote host closed the connection]
aantix has joined #ruby
<wunz>
thanks Hanmac and burgestrand
beneggett has joined #ruby
mnaser has quit [Quit: Computer has gone to sleep.]
<shevy>
burgestrand hmm require './monitor' will only work if called from the same dir right?
<burgestrand>
shevy: yep
<mjb2k>
I'm trying to list contents of a directory on ftp, but I seem to be blocking on FTP#list, I am following the example on the 1.9.3 stdlib page, is there some common "gotcha" I'm missing?
<burgestrand>
you eventually run into issues with that approach, which hopefully leads people to learning more about how require works :p
<shevy>
mjb2k, depends how it is "blocking"
<shevy>
mjb2k do you use passive or active ftp mode
<mjb2k>
shevy: it never returns
<burgestrand>
using require_relative everywhere appears like an easy solution, but it might lead to people using it ALL the time, and that’s bad
<shevy>
try ftp_object.passive = true
<shevy>
burgestrand well. that will happen because people hate that require 'foo.rb' fails now... with require_relative 'foo.rb' it'll ... work
<shevy>
:>
<shevy>
what I dont understand is
<shevy>
why does load 'foo.rb' work?
<Hanmac>
because there is no load_relative
<Hanmac>
:D
wilmoore has joined #ruby
<mjb2k>
shevy: that was it, needed passive mode, thanks. I'm surprised I forgot to try that
<Hanmac>
... C as also two different kind of include ... one with "" and one with <>
<shevy>
Hanmac, yeah but you can omit the ./ in load
sailias has quit [Quit: Leaving.]
<shevy>
since they said there is a security risk to allow the current dir be used with require, it must not happen via load, which confuses me
<elektronaut>
wunz: require File.join(File.expand_path(File.dirname(__FILE__)), 'monitor') should work in both 1.8 and 1.9
<shevy>
mjb2k, I had that problem once myself, I think I found the answer on stackoverflow
ebanoid has quit []
<shevy>
mjb2k I also wrote a few helpers for FTP! I'll make a gem this weekend, perhaps you have suggestions to improve it :)
wpaulson has joined #ruby
<wunz>
thanks elektronaut
robotmay has joined #ruby
ph^ has quit [Remote host closed the connection]
iaj has quit [Ping timeout: 246 seconds]
josefig has quit [Quit: Leaving]
johnjohnson has joined #ruby
chomp has quit [Quit: Leaving]
<mjb2k>
shevy: I don't usually deal with FTP, but I will be for a small script to pull a bunch of *.gz files from an FTP. I'd definitely be willing to try it out
atmosx has quit [Ping timeout: 276 seconds]
<shevy>
ok that is a good use case
luckman212 has joined #ruby
<shevy>
you'll probably have solved it already, but once I made it a gem, I'll be curious if it would have been less work with my gem :)
Vert has joined #ruby
gyre007 has joined #ruby
<Mon_Ouie>
load loads relatively to the current working directory, require does not — they're not intended for the same use
<mjb2k>
that's what I'm thinking, I'll get this all worked out, but then I can do it from scratch with the gem and compare the efforts
samuel02 has quit [Remote host closed the connection]
mnaser has joined #ruby
voodoofish430 has quit [Quit: Leaving.]
CannedCorn has joined #ruby
<havenn>
I guess "require './this' is safely presumed to be the directory the file was opened in, whereas '.' in $LOAD_PATH with "require 'this'" could actually be a different working directory.
CannedCorn has quit [Quit: Computer has gone to sleep.]
<werdnativ>
shevy: a.length > 1 ? a : a.first
havenn has quit [Remote host closed the connection]
yankhates has quit [Ping timeout: 244 seconds]
<werdnativ>
basically that, but wondering if there was a cleaner method on array to do that.
nadirvardar has joined #ruby
<shevy>
macmartine did you try to move alias_method below that method yet?
<macmartine>
shevy: oh, no
<werdnativ>
like the reverse of Kernel.Array()
<shevy>
hmm is it only me or is ruby-gnome kinda dormant project now
<shevy>
:(
<mjb2k>
that's kinda funny, I had to do the opposite of that in javascript before because something was returning just the object if the was only one, instead of an array with one element
<elektronaut>
oops, now I have a folder named ~, and rming it is a bit scary
eurbach has quit [Quit: Leaving.]
<macmartine>
shevy: that worked, thanks
RichGuk has joined #ruby
<shevy>
macmartine \o/
TLFADE has joined #ruby
TLFADE has left #ruby [#ruby]
gyre007 has quit [Quit: Ex-Chat]
cpruitt has joined #ruby
mahmoudimus has joined #ruby
<mjb2k>
elektronaut, yeah, I think I'd make sure and use an absolute path on that one, lol
leifmadsen has quit [Quit: This is how I roll; animal print pants outta control!]
the_jeebster has quit [Quit: Leaving.]
<elektronaut>
mjb2k: no big deal, rmdir would have bailed on a nonempty dir
r0bby has joined #ruby
carlyle has quit [Remote host closed the connection]
jalljo has quit [Quit: leaving]
<shevy>
playing with fire eh? :>
<shevy>
I once somehow managed to pass in "/" to a rm_rf
<mjb2k>
shevy: here's my crude solution to the FTP directory listing: match(/^[a-z\-]{10}\s+\d+\s+\S+\s+\S+\s+(\d+)\s+(\w+\s{1,2}\d{1,2}\s{1,2}\d{1,2}:\d{2})\s+(\S+)$/i)
<shevy>
ack
<shevy>
my eyes man
<davidcelis>
dude
<davidcelis>
fuck
<shevy>
now that's a really proud regex you got there
robbyoconnor has quit [Ping timeout: 260 seconds]
<elektronaut>
i had a capistrano task rm -rfing everything relative to my home dir once
<epochwolf>
interesting regex
<shevy>
I am too scared of regexes... if there are more than... 15 chars in a regex, it will be labelled wrong by my brain automatically
<mjb2k>
I'm disappointed I had to resort to such measures just to get basic info on an FTP file
<shevy>
yeah mjb2k
<elektronaut>
luckily it had only started eating into ~/backups when I realized what was going on
<shevy>
I've kinda been there at one point too, that was why I wrote to bugs.ruby-lang.org
<shevy>
ah well
<epochwolf>
shevy: I've worked on regexen with hundreds of characters
<shevy>
epochwolf you have a wolverine brain that can take punishment
<davidcelis>
elektronaut: it started with ~/backups? not your dotfiles?
<shevy>
I have a teletubby brain, things that are harmful must be kept away from it
<epochwolf>
shevy: it's just a matter of patience.
<shevy>
I am very very impatient :)
<mjb2k>
that one is actually overly simplistic and will probably only really work for my case
<dmwit>
FTP was not designed for machine consumption, and it really shows.
<mjb2k>
no doubt
<epochwolf>
gopher is where it's at
<elektronaut>
davidcelis: * globbing doesn't include dotfiles, at least not in zsh
<shevy>
elektronaut, well for me it usually is not such a big problem, because I keep several and regular backups... but I still lose time when recovering, a few hours usually, and I hate losing time
<dmwit>
SFTP doesn't suck.
<davidcelis>
elektronaut: ah you're on zsh. good for you
<mjb2k>
I'd much rather scp my files, alas, I dont control every file server on the internet
* dmwit
nods supportively
<shevy>
mjb2k, not you but google perhaps will one day :D
<mjb2k>
lol, shevy, perhaps
<shevy>
or it will merge with ... facebook ...
<dmwit>
ftp.google.com, ftp.facebook.com...
<shevy>
facegle... goobook
wilmoore has quit [Remote host closed the connection]
* dmwit
shudders
berkes has quit [Ping timeout: 272 seconds]
<shevy>
alright, I guess google would not want a rebranding of their name... and facebook won't either
Desmond has quit [Ping timeout: 276 seconds]
<elektronaut>
facebook.com/Google
Criztian_ has quit [Remote host closed the connection]
* apeiros_
often wondered why no superior protocol really supplanted ftp on a wide front…
<epochwolf>
apeiros_: because of existing tooling around ftp
<mjb2k>
what superior protocol?
<Boohbah>
scp/sftp
<apeiros_>
mjb2k: that's the point. no one made one. parts, yes. like rsync.
<apeiros_>
but I'm unaware of something that does all
<apeiros_>
(and webdav sadly ain't superior to ftp in any way…)
<epochwolf>
webdav is horrid shit
workmad3 has joined #ruby
<mjb2k>
right, there hasn't really been anything to fill all the functionality and offer at least some backwards compatibility
jlogsdon has quit [Remote host closed the connection]
<apeiros_>
mjb2k: fuck backwards compat :)
<shevy>
:)
<apeiros_>
at least if it is to ftp
<mjb2k>
and even though FTP sucks, it does still get the job done
<apeiros_>
barely
rcj_ has joined #ruby
<apeiros_>
you need more than two hands to recount all the problems and issues with it…
crankycoder has quit [Remote host closed the connection]
<shevy>
I think FTP works for only one thing really - transferring single files :P
<workmad3>
it doesn't even do that particularly well
<workmad3>
at least, not trustworthy
<apeiros_>
yes. see rsync & scp.
DrShoggoth has quit [Quit: Leaving]
<workmad3>
hell, sftp at a minimum
<apeiros_>
the technology is all there…
<mjb2k>
how much support is there for scp and sftp on windows?
<eam>
ssh has completely replaced ftp
<workmad3>
mjb2k: putty, winscp, probably many others
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
<mjb2k>
I know there is desktop apps like WinSCP and Putty, but what about serverside
<eam>
which is why you see people using sftp (ssh) instead of ftps (ftp + ssl)
<mjb2k>
(putty make me vomit in my mouth a little)
<workmad3>
mjb2k: don't know... I've never been crazy enough to run a windows server seriously :P
<eam>
mjb2k: openssh client and server run fine on windows
<eam>
have for over a decade
<luckyruby>
how do I use gsub to remove all '{','}' from a string?
<mjb2k>
workmad3: problem is there are many other people out there who do thing Windows is a suitable server
<workmad3>
mjb2k: there are many people out there who think PHP is a suitable language... doesn't make them any more correct
<mjb2k>
hey now!, lol
<workmad3>
:)
<workmad3>
mjb2k: also, the people who think windows is a suitable server don't tend to be sat in an IRC channel about ruby...
suborbital has quit [Quit: to the batcave!]
<mjb2k>
I will always defend php as a suitable language, suitable for what exactly is up to debate however
<elektronaut>
suitable for getting non-php developers riled up at least
<workmad3>
mjb2k: true, you can print out it's implementation to turn good paper into toilet paper...
<workmad3>
heh :)
mpereira_ has joined #ruby
<workmad3>
I'm in an odd mood tonight
havenn has joined #ruby
Monofu has joined #ruby
<workmad3>
I should probably stop talking about things before I say stuff I'll regret tomorrow :)
<Boohbah>
luckyruby: string.gsub(/{|}/,'')
<mjb2k>
I think it's funny when I see people talk bad about php then praise python, I don't see very much difference between them
<Boohbah>
luckyruby: the | means or
<Boohbah>
mjb2k: python is much more sane than php
Foxandxss has joined #ruby
<eka>
mjb2k: you should try both
<sepp2k>
mjb2k: Seriously? Do you see many differences between PHP and Ruby? Because honestly I see more differences between PHP and Python than between Python and Ruby.
<elektronaut>
timecube.com is more sane than php
<mjb2k>
I do know far more about php than python
Markvilla has joined #ruby
<luckyruby>
Boohbah: ty
albemuth has quit [Quit: Computer has gone to sleep.]
spycrab0 has quit [Ping timeout: 256 seconds]
suborbital has joined #ruby
<mjb2k>
php definitely lets you do horrible things, but it is also capable of proper design
<mjb2k>
python seems to encourage bad design
zeade has quit [Quit: Leaving.]
<eka>
mjb2k: so you didn't use python at all
<workmad3>
mjb2k: I'd say PHP encourages bad design personally...
eka has left #ruby [#ruby]
td123 has joined #ruby
saschagehlich has quit [Quit: saschagehlich]
<sepp2k>
mjb2k: In what way?
kevinbond has joined #ruby
Markvilla has quit [Read error: Connection reset by peer]
maahes has quit [Ping timeout: 244 seconds]
<elektronaut>
i was a php developer for 6 years or so. the only nice thing i have to say about it is that it runs pretty much everywhere.
<mjb2k>
in python all object members are public, right? that is frightening in itself
ryan0x2_ has joined #ruby
mpereira_ has quit [Ping timeout: 248 seconds]
<mjb2k>
i dont think php encourages bad design, but I sure dont think it encourages good design either
<mjb2k>
php is more anarchic, if you can find your way fine, but dont look to the language spec to guide you anywhere
awarner has quit [Remote host closed the connection]
frishi has joined #ruby
benjammin891 has joined #ruby
kevinbond has quit [Quit: kevinbond]
Markvilla has joined #ruby
akem has quit [Read error: Operation timed out]
apeiros_ has quit [Remote host closed the connection]
<mjb2k>
I'm not trying to say php is really all that good, I just dont think it's quite as bad as people say, and python really isnt nearly as good as people say
<workmad3>
mjb2k: I don't say python is good though...
<workmad3>
mjb2k: but it's at least better than PHP :P
<elektronaut>
i wish i still had my old php code, I made a gloriously terrible hack implementing missing oop features in php4 via parsing backtraces
sailias has joined #ruby
techazard has joined #ruby
carloslopes has quit [Quit: Leaving.]
Jdubya has quit [Ping timeout: 245 seconds]
* offby1
backs away slowly
<mjb2k>
I think maybe one of the biggest details to know about php and it's suckage, is that it started out sucking real bad, but they added quite a bit of non-suck-real-bad stuff but also never took out the old garbage
<mjb2k>
so even though it has some decent features in it now, the fact that they live along side old rotting garbage just adds to the problem
frishi has quit [Quit: Leaving...]
akem has quit [Ping timeout: 272 seconds]
shadoi has quit [Quit: Leaving.]
peterhil has quit [Ping timeout: 272 seconds]
sepp2k has quit [Remote host closed the connection]
wpaulson has joined #ruby
qos has joined #ruby
Karmaon has quit [Ping timeout: 260 seconds]
ephemerian has quit [Quit: Leaving.]
beilabs has quit [Ping timeout: 264 seconds]
beilabs_ has quit [Ping timeout: 265 seconds]
baroquebobcat has quit [Ping timeout: 245 seconds]
<mjb2k>
time to go home!
SQLStud has quit [Read error: Connection reset by peer]
cherrypeel has joined #ruby
linoj has quit [Quit: linoj]
minijupe has quit [Quit: minijupe]
<mjb2k>
next time we should talk vi vs emacs, lol
rbanffy has quit [Quit: Ex-Chat]
mjb2k has quit [Quit: Leaving]
RudyValencia has quit [Read error: Connection reset by peer]
RudyValencia has joined #ruby
RudyValencia has quit [Read error: Connection reset by peer]
jimeh has quit [Ping timeout: 245 seconds]
linoj has joined #ruby
mpereira_ has joined #ruby
randomautomator has quit [Remote host closed the connection]
<bgupta>
If I am trying to pass a cutom header via rest_client, does this seem right:
pk1001100011 has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
bradhe has quit [Read error: Connection reset by peer]
Siphonblast has joined #ruby
brianpWins has quit [Quit: brianpWins]
jimeh has joined #ruby
Monofu has quit [Quit: quit]
oooPaul has quit [Quit: Ciao for now!]
seanstickle has joined #ruby
thecreators has quit [Remote host closed the connection]
hemanth has quit [Read error: Connection reset by peer]
hemanth has joined #ruby
teampoop has quit [Quit: Leaving.]
<offby1>
OK, I feel dumb, but I _did_ Google: how do I time a ruby expression?
<offby1>
I was expecting something like { something }.call_with_timings
burgestrand has quit [Quit: Leaving.]
stephenjudkins has quit [Read error: Connection reset by peer]
Karmaon has joined #ruby
litheum has joined #ruby
luckyruby has quit [Remote host closed the connection]
<seanstickle>
offby1: look into the Benchmark module
<seanstickle>
offby1: built in!
<offby1>
tx
stephenjudkins has joined #ruby
Chryson has joined #ruby
bradhe has joined #ruby
bradhe_ has quit [Read error: Connection reset by peer]
atmosx has quit [Ping timeout: 276 seconds]
ePirat- has quit [Excess Flood]
banseljaj is now known as imami|afk
carlyle has quit [Remote host closed the connection]
atmosx has joined #ruby
Desmond has joined #ruby
ilyam has quit [Quit: ilyam]
macmartine has quit [Quit: macmartine]
albemuth has joined #ruby
cwang has quit [Remote host closed the connection]
robotmay has quit [Remote host closed the connection]
Jake232 has quit [Quit: Computer has gone to sleep.]
Desmond has quit [Read error: Connection reset by peer]
Aaton is now known as Aaton_off
tewecske has quit [Quit: Leaving.]
Siphonblast has quit [Ping timeout: 260 seconds]
Natch has quit [Ping timeout: 248 seconds]
Yugo has joined #ruby
yannis has joined #ruby
carlyle has joined #ruby
itnomad has quit [Quit: Leaving]
carlyle has quit [Remote host closed the connection]
Natch has joined #ruby
<queequeg1>
I could use a pointer. I'm using rake to run my minitests, but I would like to use guard. So I installed guard-rake and when my minitests pass guard works fine, but when my minitests fale, rake has a trace and guard prints out that trace. Or rather I would rather not see the trace and only see my pass fail listing. Any hints on how I could do that?
igaiga has joined #ruby
sepp2k has joined #ruby
kenichi has quit [Remote host closed the connection]
artOfWar has quit [Remote host closed the connection]
artOfWar has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
adamkittelson has quit [Remote host closed the connection]