apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<gurugeek_> Axsuul: many thanks you rock :P
<gurugeek_> shadoi: thank you too
<rking> Naming question here. If you have like a thingeroo that is the signal to skip a computation and use the cached results, what is it called? Like the timestamp of a .c file for a Makefile, or the status bar of my IRC client (when it is unchanged, I don't switch to IRC. When it is changed, I do switch).
<rking> There has to be a good name for this, it's surely a common pattern. A real-life example may be a kitchen timer: if timer.status == previous_status; return end
PragCypher has joined #ruby
Araq has joined #ruby
MasterIdler_ has joined #ruby
<rking> That might be a better way to describe it, in code: It's of the form: previous = obj.property; ... loop do if obj.property == previous; puts "Time to wake up!" end end
<rking> I guess I can call it previous_status. =\
<gurugeek_> dumb question if In bash I have dscl . -create /Users/$USER
<gurugeek_> how do I put the variable that is user in ruby ?
<rking> gurugeek_: You mean like ENV['USER'] ?
<gurugeek_> just /Users/user ?
<gurugeek_> rking: no the variable user
<gurugeek_> user = ARGV[0]
<rking> Oh, so your script is the "dscl"?
<gurugeek_> no that is the command line command
<gurugeek_> like useradd on linux/bsd
<rking> I am lost in the apple sauce.
<gurugeek_> ah I guess is #{user}
tommyvyo has joined #ruby
<rking> Ok. =)
<Axsuul> rking: hmm i still don't understand your scenario lol
pokui has joined #ruby
<rking> Axsuul: OK, the reason I'm having a hard time naming it is probably exactly the same as why I'm having a hard time describing it.
williamcotton_ has joined #ruby
<denysonique> Axsuul: QtR is more ruby'esque https://gist.github.com/2296564
dalkor has joined #ruby
<rking> Axsuul: The issue is that I have an expensive operation that I don't want to perform unless a certain indicator tells me it's time to.
<rking> Axsuul: I'll tell you the exact scenario, maybe that will help. =)
<Axsuul> denysonique: sweet, when will it be ready? I really like Shoes DSL ツ
dalkor has joined #ruby
luckyruby has joined #ruby
ZachBeta has joined #ruby
<rking> I'm writing a bit of code for a 3D editing program, and only when the topology changes (that is, when there are new faces, edges or verts) is it time for me to run a big function that analyzes the topology for mistakes. I am in a situation where my code is hooking into a busy-loop, so I don't want to do the full analysis on each iteration, I only want to compare the vert/edge/face count to see if it's time to run the checks or not.
<Vert> Aww, I thought I had a highlight then. =(
<rking> Vert: LOL
<rking> Oops.
<Vert> :p
<Axsuul> rking: hmm, how about.. topology_changed
<rking> Vert: If it is any consolation, when I IRC from my cell phone (using AndroIRC), it makes an audible chime every time somebody says "it's not working".
<banisterfiend> rking: use AndChat instead, much better than AndroIRC IMO
<Vert> rking: Oh wow. :D
<rking> Axsuul: But that's the thing - it's not storing the changedness. It's storing the counts of the elements and some other stuff.
williamcotton_ has joined #ruby
<rking> banisterfiend: Wonderful to know. I did a simplistic search. Thank you.
<Vert> Yeah AndChat is pretty good.
<banisterfiend> rking: maybe you can use an observer pattern?
Guedes has joined #ruby
Guedes has joined #ruby
<shadoi> gurugeek_: if you just want a ruby version here's one: ruby -e 'puts %x(dscl . -list /Users UniqueID).lines.map(&:split).sort_by{|u|u[1]}.last[1].to_i + 1'
<rking> banisterfiend: Let me dust off my GoF knowledge.
<banisterfiend> or some kind of notification center system
CCCPSpy has joined #ruby
<rking> Wow. WTG Wikipedia, using crufty Java code for the example.
<rking> banisterfiend: Even within such a system I would still have to name this thingeroo.
<scientes> rking, then change it, it IS wikipedia after all
<rking> It's almost a status_hash
<gurugeek_> in ruby command line you would do add_user << "-s #{shell} " to pass a command right? so how would you pass a raw command line command from a ruby script
<gurugeek_> I did dscl . -create << "/Users/#{user}" and got like undefined local variable or method `dscl' :(
<rking> scientes: I seriously might. What part of this helps you understand the Observer pattern?: if (arg instanceof String) { resp = (String) arg; System.out.println("\nReceived Response: "+ resp ); }
<rking> As far as I can tell that is only this: def foo arg; puts arg end
<shadoi> gurugeek_: in ruby you'd do %x(dscl . -create /Users/#{user})
Ttech has joined #ruby
<gurugeek_> shadoi: thanks what %x satands for ?
williamcotton_ has joined #ruby
<gurugeek_> shadoi: thanks :D
Squee-D has joined #ruby
<rking> gurugeek_: I assume it stands for 'eXecute'
<rking> shadoi: Thanks for that link -- there were some bits I didn't know.
<denysonique> Axsuul: in coupe of weeks it should grow and provide most of the widgets for building apps.
<shadoi> yeah it's in my permanent reference :)
<denysonique> Axsuul: follow it on GH if you would like to track its progress
<Axsuul> denysonique: sweet, will do. I'm your second watcher!
<denysonique> sweet, thanks
<shadoi> Another great quick reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
<Axsuul> nice refs
andrewhl has joined #ruby
* Axsuul pinboards it
phantasm66 has joined #ruby
rking_ has joined #ruby
Guest71832 has joined #ruby
lottadot has quit ["Leaving"]
EzeQL has joined #ruby
Clordio has joined #ruby
ZachBeta has joined #ruby
antillas21 has joined #ruby
Araq has quit [#ruby]
eko has joined #ruby
eko has joined #ruby
seanstickle has joined #ruby
EvanR has joined #ruby
frishi has joined #ruby
cafesofie has joined #ruby
shevy has joined #ruby
PragCypher has joined #ruby
SolarisBoy has quit [#ruby]
mikeric has joined #ruby
cbuxton1 has joined #ruby
nobitanobi has quit [#ruby]
irrationalfab has joined #ruby
CheeToS has joined #ruby
<denysonique> Could somone please point me to a nice web page about Ruby method chaining and lazy evaluation?
artOfWar has joined #ruby
tatsuya_o has joined #ruby
williamcotton has joined #ruby
igotnolegs has joined #ruby
<banisterfiend> denysonique: yes
<banisterfiend> denysonique: http://www.michaelharrison.ws/weblog/?p=163
fmcgeough has joined #ruby
luckyruby has joined #ruby
twelvechairs has joined #ruby
rook_flood has joined #ruby
juul has joined #ruby
zunnyohno has joined #ruby
sbanwart has joined #ruby
mikeric has joined #ruby
monokrome has joined #ruby
brngardner has joined #ruby
<juul> I've seen code like this around: name: 'value'
<juul> what does that mean? is it equivalent to: :name => 'value' ?
<seanstickle> It's the new style of :name => 'value'
<juul> oh, from which version and up?
<seanstickle> 1.9
<juul> is the old style deprecated?
<seanstickle> Nope.
CodeFriar has joined #ruby
<juul> so I should be able to do {foo: 'bar'} in any 1.9 ruby?
nari has joined #ruby
<seanstickle> Yup
<juul> because tryruby.org reports "1.9.2" when i type RUBY_VERSION
<antillas21> juul: {foo: 'bar'} works the same as {:foo => 'bar'}
<juul> and if I type {foo: 'bar'} then it says "the code you submitted is not valid ruby"
<seanstickle> juul: I dunno what to tell you
<seanstickle> juul: I don't know how tryruby works
<juul> ok
<juul> thanks for the help :)
<denysonique> banisterfiend: Thank you
<denysonique> hmm
<denysonique> How do I find the last method in a chain?
<denysonique> e.g. Method.foo.bar
<denysonique> err
<denysonique> Class.foo.bar
<denysonique> bar is the last method
<denysonique> How can I detect that bar is last?
<denysonique> In the definition of bar
<banisterfiend> denysonique: u dont, u just check whether it's been passed a block
<denysonique> hmm
<banisterfiend> denysonique: what are oyu trying to do
<denysonique> But somtimes I would like to do User.find(1)
<denysonique> and have it displayed in irb
<denysonique> Rails can do this
<denysonique> ActiveRecord
<denysonique> I do not need pass a block
<denysonique> banisterfiend: I am writing a scraper and developing a nice API for it
<denysonique> So for example users can be found by their id
<denysonique> ids*
<denysonique> etc
<twelvechairs> can anyone recommend a decent widget toolkit for ruby that I can run opengl inside????
<denysonique> twelvechairs: Qt
<denysonique> QtRuby
<philcrissman> denysonique: I don't think I understand your actual question. What does activerecord have to do with the question about "the last method in a chain"?
<denysonique> twelvechairs: also RubyGame maybe will be someting of your interet
Clordio has joined #ruby
<banisterfiend> denysonique: i have a feeling your mental model is slightly wrong
<denysonique> philcrissman: ActiveRecord is an example of this
<denysonique> well
<philcrissman> denysonique: in Class.foo.bar, bar can't "know" that it is the last method. It just returns whatever it returns...
fmcgeough has joined #ruby
<philcrissman> denysonique: how is AR an example of this?
<twelvechairs> denysonique: Thanks for the suggestion. Have you tried others to be able to compare? I've been using GTK but its giving me problems
<denysonique> twelvechairs: yes
<denysonique> Qt is the best so far
<denysonique> which is also cross platform
Divinite has joined #ruby
<denysonique> twelvechairs: I can help you with QtRuby if you have any probems
<denysonique> problems*
<philcrissman> denysonique: a method has a return value. If you chain methods, each successive method is being called on whatever object the previous method returned. None of the methods "know" that they are even in a "chain". As far as the method is concerned, it is called on an object, and it returns something.
<denysonique> yep
<denysonique> ok
<denysonique> hmm
<philcrissman> denysonique: I'm just not getting your question, I guess. :/
<denysonique> I will ask again (;
<philcrissman> lol
<twelvechairs> denysonique, : thanks. will give it a look
KnowTheLedge has joined #ruby
kpshek has joined #ruby
Ontolog has joined #ruby
adeponte has joined #ruby
flaccid has joined #ruby
<flaccid> is it possible for irb to accept a script by stdin? i have a basic multiline
<twelvechairs> denysonique: have you ever used qt with opengl inside?
dbgster has joined #ruby
<denysonique> twelvechairs: nope, but give it a try, it shouldn't take you longer than 10 minutes to test opengl in QtRuby
<twelvechairs> ok. cheers thanks.
mikeric has joined #ruby
<denysonique> philcrissman: The quesiton: How is this accomplished?
<denysonique> AR lazy evaluates methods. e.g.
<denysonique> User.where(age: 21).where(gender: 'female') -- the first 'where' adds only an age condition to the underlying SQL query, it does not return an object executing the query. Only the last where actually executes the SQL query.
<seanstickle> The last where doesn't execute the query either
<seanstickle> Until you move into all or each or some other processing
<denysonique> seanstickle: if you run it in Rails console it does
<denysonique> or in irb
<philcrissman> denysonique: look at the code; where returns a relation. The method can't "know" whether or not another method will be called on whatever it returns. It can't "know" it's the "last" method in the chain...
<seanstickle> denysonique: console runs an explicit to_s
<denysonique> seanstickle: unlike, IRB right?
<seanstickle> Both do
<seanstickle> Console is just a spiced-up irb
<seanstickle> Same with pry
ringotwo has joined #ruby
shadoi has joined #ruby
<denysonique> hmm
<denysonique> I probably have made a mistake when checking in irb whether to_s is called on class methods
<denysonique> hence the confusion
<denysonique> heh
<seanstickle> User.where(age: 21).where(gender: 'female').class
<denysonique> philcrissman: seanstickle thank you guys
<denysonique> guys*
<seanstickle> #=> ActiveRecord::Relation
<seanstickle> Oh, sure!
<denysonique> is there an irb which does syntax highliting as you type?
<shadoi> I hope 1.9.4 includes named parameters.
AndChat| has joined #ruby
<shadoi> sick of abusing hashes
<seanstickle> Maybe in 2
<seanstickle> ;)
<denysonique> that would be nice
<denysonique> hmm
<denysonique> is this planned?
<denysonique> somewhere?
<shadoi> yeah
<banisterfiend> shadoi: nah it's coming in 2
<denysonique> cool, hmm I will then probably stop coding and wait until Ruby 2
<denysonique> ;)
<denysonique> banisterfiend: thanks for the link
<seanstickle> denysonique: just learn SmallTalk
<seanstickle> denysonique: same thing as Ruby 2
<seanstickle> :D
<denysonique> also, what advanced Ruby programming books would you recommend?
<shadoi> banisterfiend: that makes me a sad panda.
<banisterfiend> denysonique: refactoring: ruby edition, ruby design patterns
<denysonique> for stuff like lazy_enumaration, DSL building
<seanstickle> Metaprogramming
<seanstickle> Metaprogramming Ruby, I mean
<seanstickle> Refactoring in Ruby also
<seanstickle> Machine Learning in Ruby
<denysonique> hmm
<seanstickle> Game Theory with Ruby
JC_SoCal has joined #ruby
<seanstickle> Ruby Debugging
<seanstickle> Etc
<denysonique> thans
<denysonique> thanks*
apok_ has joined #ruby
<banisterfiend> denysonique: read my blog posts
<banisterfiend> :P
shtirlic_ has joined #ruby
<banisterfiend> denysonique: if you're man enough: http://banisterfiend.wordpress.com/2008/10/25/the-secret-life-of-singletons/
<denysonique> nice title
<denysonique> thanks
<denysonique> I will read the posts
sbanwart has joined #ruby
<banisterfiend> denysonique: i also recommend this: http://banisterfiend.wordpress.com/2010/11/23/what-is-the-ruby-top-level/
<banisterfiend> as a lot of people are really confused about the top level
<denysonique> this is a very interesting article
maletor has joined #ruby
d2dchat has joined #ruby
<denysonique> Is there any programming language comparably awesome as Ruby?
<banisterfiend> denysonique: lots
<seanstickle> Yes. Many.
<denysonique> what are they?
<banisterfiend> smalltalk, lisp, maybe scala
<denysonique> hmm
<seanstickle> Lisp. SmallTalk. APL. Forth.
<banisterfiend> self
<denysonique> yep, heard of scala and lisp
<banisterfiend> IO
<monokrome> Haskell :D
<seanstickle> Haskell, yes.
<seanstickle> SML.
<denysonique> hmm
<seanstickle> Fortress.
<Sou|cutter> erlang
<denysonique> Why is Ruby the mot popular/used of them?
<seanstickle> More languages than you can shake a stick at.
<seanstickle> Who says it is?
<denysonique> ok
<denysonique> But they are not as awesome, right?
<seanstickle> What is this, troll hour?
<denysonique> ;>
<denysonique> no, I am serious
<Sou|cutter> people in a ruby channel are probably going to enjoy ruby.
Guest71832 has joined #ruby
<seanstickle> I enjoy Ruby plenty well. But I love APL.
<banisterfiend> denysonique: i guess ruby is more popular than some of those because rubys syntax is more approachable, but also because it has a decent web framework (rails), so it attracts the enormous retarded clusterfuck of ex-PHP programmers. That isn't a good thing, btw, and is probably the reason so many rails programmers are retards
<denysonique> banisterfiend: The entry of level is now getting higher and higher
<denysonique> entry level of Rails*
<denysonique> hmm
<banisterfiend> denysonique: popularity != quality btw, remember the spicegirls were once popular :)
<denysonique> I think that Ruby has the greatest community of most langs. great support + awesome gems
<banisterfiend> denysonique: so it doesn't make ruby better than lisp/smalltalk just because more people use it
<denysonique> I can say that Ruby is definitely way better than Python in most cases
<denysonique> I had programmed in Python before
<banisterfiend> denysonique: you talk like a noob :)
<seanstickle> banfoy
wilmoore has joined #ruby
<denysonique> banisterfiend: well, Python does not have awesome gems/libs. I have used both languages for a while and noticed that Ruby libs are simple and straightforward to use, whereas Python libs are not 'cool'/developer friendly.
<banisterfiend> denysonique: python has much better libs in some areas
<banisterfiend> denysonique: pygments, scipy, numpy, dreampie, etc
<denysonique> banisterfiend: maybe in some, but Python doesn't have a decent ORM
<banisterfiend> denysonique: Python imaging library (PIL)
<denysonique> for example
<banisterfiend> denysonique: i think non-web python libraries are for the most part considered more mature/better than the ruby counterparts
<banisterfiend> denysonique: usually in the case of web stuff ruby excels though
<denysonique> banisterfiend: but their APIs are not so nice, are not artistic
<denysonique> in most cases
<denysonique> e.g. I was looking at IRC clients
<banisterfiend> denysonique: i really dont think you can make blanket statements like that
luckyruby has joined #ruby
<denysonique> when Rubyists release any libs, they usually make them as simple to use as possible
<banisterfiend> denysonique: im sure if i was a python programmer i'd find python libs easier to use than ruby libs :)
<denysonique> also, in Python you need to do one hundred imports for each module
<banisterfiend> denysonique: modules are actually a good idea, and is one thing that ruby lacks
<denysonique> banisterfiend: modules are not good for programmer happiness which is the goal of Ruby I guess
<denysonique> (;
sbanwart has joined #ruby
sacarlson has joined #ruby
<denysonique> btw
<denysonique> you mentioned pygments and other libraries
<denysonique> I would say that python probably has more libraries than Ruby. but what I wanted to state was that using them is not nice as in ruby
<denysonique> anyway
<denysonique> I think I am to tired to explain my point ;]
<shadoi> banisterfiend: isn't Pryable#pry_open the default behavior now?
tomzx has joined #ruby
<banisterfiend> shadoi: wtf is Pryable
<denysonique> haha
<denysonique> lol
<shadoi> hehe
<shadoi> I don't understand why he wrote it…
<banisterfiend> shadoi: i didnt write it and it looks retarded
<shadoi> okey then :)
<banisterfiend> shadoi: it looks like one of those sites that mirror stack overflow, but pretend like they're their own site providing a unique service
<banisterfiend> blergh
<shadoi> yeah, strange
<banisterfiend> shadoi: how did u find it
<shadoi> gem q -rn pry
<shadoi> :)
<banisterfiend> shadoi: check out pry-git btw
<shadoi> will do
<banisterfiend> i just fixed it up for recent releases
<banisterfiend> shadoi: u can do shit like: git blame Class#method
<banisterfiend> watch
<shadoi> nice
<shadoi> funny, I just started using grit also
<banisterfiend> shadoi: https://gist.github.com/2297188
<shadoi> very cool!
<banisterfiend> you can also do: git diff Class#method
<banisterfiend> and even, git add Class#method
<Quadlex> Wow
<Quadlex> This web service is fucking stupid
<shadoi> nice, that's a great way to do isolated commits
sbanwart has joined #ruby
darmousseh has joined #ruby
<Quadlex> The Booking object contains a Location object which contains an Address object which contains several properties each of which are objects, each of which only have an ID and a Value property
<darmousseh> i have an arel question
<shadoi> banisterfiend: I'm considering putting pry into all my apps by default and just have it enabled with $DEBUG
<darmousseh> how do i do a where or clause
<darmousseh> using arel
<banisterfiend> shadoi: cool, which plugins do you use?
brngardn_ has joined #ruby
<shadoi> banisterfiend: none, but I'll use the remote explorer when I do that I think
sm4sh has joined #ruby
<banisterfiend> shadoi: pry-remote-em ?
<banisterfiend> that thing is cool
<shadoi> And I'll be making use of Celluloid and DCell soon so I can toggle debugging in live processes
<shadoi> banisterfiend: yeah
Synthead has joined #ruby
adamkittelson has joined #ruby
<shadoi> It'll make tracking issues in production so much nicer.
<banisterfiend> shadoi: yeah im thinking of rewriting pry-remote-em in celluloid, what are the immediate advantages in celluloid over EM anyway?
<shadoi> banisterfiend: it just doesn't look like Node.js :)
<banisterfiend> shadoi: is it all fiber based?
<shadoi> yeah
<banisterfiend> shadoi: well that means it cant run on jruby or rbx
<shadoi> threads with fibers for concurrency
<shadoi> it can actually
<banisterfiend> not sure that's good for people who are aiming for broad compatibility in their libraries
<shadoi> he's done a LOT of work to make it work nicely on both
<banisterfiend> oh
<shadoi> pry-remote-em integrated in DCell would be fucking hot shit
<banisterfiend> shadoi: what is DCELL ?
<banisterfiend> shadoi: btw 'em' means eventmachine, so maybe they wouldnt be compatible?
<shadoi> it's the distributed (over zeromq) Celluloid actors
<shadoi> right, you'd have to rewrite it to use Celluloid::IO
<banisterfiend> shadoi: it wont be hard to rewrite it for celluloid though
blueadept has joined #ruby
<banisterfiend> yeah
<shadoi> definitely not
<shadoi> it'd probably clean up the code even
<shadoi> lol
<banisterfiend> yeah
davidcelis has joined #ruby
<shadoi> I'm super excited about DCell
<shadoi> Going to try to work on Paxos leader election and a DNS service registry for it soon.
PragCypher has joined #ruby
Brainix has joined #ruby
<banisterfiend> shadoi: can u show me some simple celluloid code for a multiplexing echo server/echo client system
<shadoi> banisterfiend: each connection is a Celluloid::Actor
<banisterfiend> shadoi: and i assume that handles as many concurrent connections?
<shadoi> so it gets it's own thread
artOfWar_ has joined #ruby
<shadoi> banisterfiend: yup
<shadoi> banisterfiend: https://github.com/celluloid/celluloid-io/blob/master/README.md explains it pretty well
<banisterfiend> shadoi: are people starting to use it yet? also how does performance compare to EM?
<banisterfiend> not that i imagine there'd be much difference
<shadoi> Not a huge difference, it's fractionally slower
<shadoi> But you get a lot more out of it.
<shadoi> with less effort
<shadoi> I think quite a few people are getting into it
<banisterfiend> nice
<banisterfiend> shadoi: so cool.io is dead now?
<shadoi> yeah this definitely supersedes it
<banisterfiend> he should probably announce that on the readme ;) since i didnt know that celluloid::io replaced it
<banisterfiend> and was considering using it
kvirani has joined #ruby
<shadoi> he produced it all so quickly… I don't think it's made it out there.
<shadoi> In fact he published all this stuff while I was rewriting some shit to use cool.io, I was pissed!
<shadoi> lol
<shadoi> But it's MUCH more of what I wanted anyway.
<banisterfiend> shadoi: yeah he seems super productive
__main__ has joined #ruby
Hunner has quit [" "]
stefanp_ has joined #ruby
thiagopnts has joined #ruby
Karmaon has joined #ruby
looopy has joined #ruby
strife25 has joined #ruby
nikhgupta has joined #ruby
LBRapid has joined #ruby
Banistergalaxy has joined #ruby
Brandon1 has joined #ruby
<Brandon1> test
jergason has joined #ruby
dumptruckass has joined #ruby
dumptruckass has quit ["Leaving"]
PsiliPharm has joined #ruby
thiagopnts has joined #ruby
looopy has joined #ruby
blueadept has joined #ruby
Axsuul has joined #ruby
Paradox2000 has joined #ruby
aj910martin has joined #ruby
stephenjudkins has joined #ruby
sdeobald has joined #ruby
Ontolog has joined #ruby
nlc has joined #ruby
libertyprime has joined #ruby
tbenst has joined #ruby
mikeric has joined #ruby
Brandon1 has quit [#ruby]
knightMBP has joined #ruby
rohit has joined #ruby
thinkswan has joined #ruby
thinkswan has quit [#ruby]
iamjarvo1 has joined #ruby
<iamjarvo1> has anyone used mailchimp? they have a way that if you add a class to an element it automatically does inline styles on the html element. Does anyone have any clever ways of reproducing this?
brngardner has joined #ruby
aj910martin has quit [#ruby]
wefawa has joined #ruby
dql has joined #ruby
havenn has joined #ruby
PragCypher has joined #ruby
rushed has joined #ruby
mxweas_ has joined #ruby
cantbecool has joined #ruby
neurotech has joined #ruby
_Mon_Ouie_ has joined #ruby
<neurotech> yo
keymone has joined #ruby
<neurotech> Anyone around?
<banisterfiend> sup
ajayror has joined #ruby
<neurotech> Hi banisterfiend
maletor has joined #ruby
<neurotech> I'm literally just starting Ruby fresh using this as a reference: http://pine.fm/LearnToProgram/?Chapter=01
ajayror has joined #ruby
<banisterfiend> sure
<banisterfiend> what's your Q :)
<neurotech> One question right off the bat. Is there a better alternative to PowerShell on windows?
Mon_Ouie has joined #ruby
<neurotech> This thing is so uglyyy
<Quadlex> You could install Cygwin
<Quadlex> But it's kinda aesthetically unpleasing also
<Quadlex> I do Ruby dev on a MacBook dualbooting
<Quadlex> And I'm considering just switching to OSX wholesale
<ajayror> on
<neurotech> I don't have a mac unfortunately
<neurotech> I have Lion running in a VM though, on a SSD
<neurotech> But it's not perfect
<neurotech> it'd just be nice to have some more colour/font choice
<ajayror> need help on ruby on rails engine application
rippa has joined #ruby
<TTilus> mac and linux go way better with ruby than win
<neurotech> Yeah. :{}
<ajayror> ror help ?
<Quadlex> I got a pull request accepted a few week
<Quadlex> s ago
<Quadlex> Based on switching an install script from bash to pure Ruby so it'd work on Windwos
stevegozie has joined #ruby
adeponte has joined #ruby
ringotwo has joined #ruby
blueadept has joined #ruby
<banisterfiend> neurotech: you'll save yourself trouble if you switch to linux/osx for ruby dev now
<banisterfiend> neurotech: ruby on windows is kind of weird
<neurotech> banisterfiend: Don't tell me this
<neurotech> :(
<neurotech> My PC at work is Windows
<neurotech> so is my home machine
<neurotech> Maybe a VM is the answer?
<banisterfiend> neurotech: you can use ruby on windows, it's just not a nice experience
<banisterfiend> Yeah use a linux VM
<neurotech> What distro would you recommend?
senthil has joined #ruby
<neurotech> ubuntu 11.10?
<banisterfiend> neurotech: i just use linux mint
<banisterfiend> which is pretty much ubuntu i think
<neurotech> I'll check it out
advorak has joined #ruby
<neurotech> banisterfiend: Is there something like GitHub for mac, for Linux?
<banisterfiend> neurotech: i think there's a few git guis
<banisterfiend> but i just use the command line
<banisterfiend> command line is fine
<neurotech> mm
<neurotech> mint looks great
<neurotech> nice and neat
<neurotech> ok back to a ruby question
<neurotech> Is this the best formula to work out "How many seconds in a decade?" puts 60 * 60 * 24 * 365 * 10
<banisterfiend> neurotech: that's a math question :) not a ruby question
<neurotech> That's a great point
<wefawa> neurotech: do you take into account leap years? and a lot of other minors adjustments?
<neurotech> I have no idea how I would do that
banjara has joined #ruby
<neurotech> I'm going through the "Other Things to Try" section on here wefawa :http://pine.fm/LearnToProgram/?Chapter=01
<Quadlex> Woudln't it be better to do something like "Some Date" - "Some Date - 10 years".to_seconds?
sacarlson has joined #ruby
<neurotech> probably
<neurotech> I want to get the basics down first
mikeric has joined #ruby
<neurotech> never coded before, outside of html/css/js
kah_ has joined #ruby
thiagopnts has joined #ruby
thiagopnts has joined #ruby
vermutt has joined #ruby
<denysonique> hmm
<denysonique> ActiveSupport should have someting like 10.years.in_seconds
<wefawa> enysonique: I really dislike that "convention", but yes...
<Gekz> wefawa: putting methods on integer literals?
<Gekz> it has always erked me a little
<Gekz> it feels a bit satanic.
<wefawa> Gekz: it's not satanic... It's just an awfull design practise...
<Gekz> of course it's satanic, it reads well, but you know you shouldn't do it
moshee has joined #ruby
moshee has joined #ruby
kah_ has joined #ruby
ninor has joined #ruby
sacarlson has joined #ruby
jergason has joined #ruby
banjara has quit [#ruby]
jrhorn424 has joined #ruby
vermutt has quit [#ruby]
<jrhorn424> any reason irb should choke on reading a 90meg json file? ruby had virtual mem up to 10G and real memory up to 6G before I quit. `f = File.read('foo.json')`
savr has joined #ruby
<savr> hi
<savr> bundle install is asking me for my password
<savr> which password is this?
<savr> because my user password is saying try again
<savr> :O
Morkel has joined #ruby
<savr> hmm
kah_ has joined #ruby
<savr> it is meant to be my password as I can see from the sudo attempt
Banistergalaxy has joined #ruby
nat2610 has joined #ruby
<savr> okay
yxhuvud has joined #ruby
savage- has joined #ruby
<savr> problem with the sudoers file
<savr> sorry!
savr has quit [#ruby]
banjara has joined #ruby
sonkei has joined #ruby
banjara has quit [#ruby]
arturaz has joined #ruby
fayimora has joined #ruby
gen0cide_ has joined #ruby
nikhgupta has joined #ruby
hooper has joined #ruby
JohnBat26 has joined #ruby
seivan has joined #ruby
raincole__ has joined #ruby
alvesjnr has joined #ruby
a_a_g has joined #ruby
dzhulk has joined #ruby
blast_hardcheese has joined #ruby
Banistergalaxy has joined #ruby
nerdy_ has joined #ruby
GoBin has joined #ruby
Synthead has joined #ruby
ringotwo has joined #ruby
Boohbah has joined #ruby
savr has joined #ruby
<savr> You cannot specify the same gem twice with different version requirements. You specified: mysql2 (~> 0.3.6) and mysql2 (>= 0)
<savr> I have mysql and sql in the gemfile
<savr> never mind
<savr> grep knows better than my eyes!
arturaz has joined #ruby
gurugeek_ has joined #ruby
<neurotech> How can I make line 3 of this add an integer to the input received in line 2? http://pastie.org/3725133
sacarlson has joined #ruby
zommi has joined #ruby
voodoofish has joined #ruby
savr has quit [#ruby]
x0F_ has joined #ruby
heftig has joined #ruby
wefawa has quit [#ruby]
djdb has joined #ruby
artm has joined #ruby
arturaz_ has joined #ruby
CheeToS has joined #ruby
Hsparks has joined #ruby
wolgo has joined #ruby
<wolgo> is there a ruby synonym for Perl's print blah if =~ /something/
ozymandius has joined #ruby
a_meba has joined #ruby
<a_a_g> wolgo: print blah if str =~ /something/ should work
<Mon_Ouie> print blah if /something/, though that's not really recommended outside of an one-liner
Tearan has joined #ruby
<wolgo> ahh
<wolgo> there is no $_
<Mon_Ouie> There is
<a_a_g> there is actually
<Boohbah> there is $_
<a_a_g> but it is not as universal as perl
<a_a_g> only a few function from the Kernel module use and set $_
<Boohbah> $_ is fun for perl-style oneliners
<Boohbah> ruby -pe '$_ = " #{$_}" unless $_=~/^#/'
pen has joined #ruby
<wolgo> ahh I see
<banisterfiend> wolgo: also too convenient for regex captures
daniel_hinojosa has joined #ruby
<banisterfiend> $1 $2 $3 etc
<banisterfiend> they're just too tempting, whether they're perlish or not ;)
<banisterfiend> i think everyone uses them
<Boohbah> awk-ish
mxweas_ has joined #ruby
provideal has joined #ruby
<provideal> hey Folks, is there a reasonably recent gem to handle tar archives? We tried tarruby, but that segfaults all the time.
gokul has joined #ruby
<wolgo> thanks guys
<wolgo> I figured it out
<wolgo> I have to be a little less Perly
<wolgo> but
<wolgo> ruby kicks ass
<wolgo> (like every other programming language I just start using)
<wolgo> lol
<banisterfiend> wolgo: what other langs ?
shruggar has joined #ruby
workmad3 has joined #ruby
Eartz has joined #ruby
sspiff has joined #ruby
sspiff has joined #ruby
Houdini has joined #ruby
Divinite has joined #ruby
djabbour has joined #ruby
<djabbour> If i have a method name I want to call in a symbol, how can I evoke it? I know send allows me to send to an object, but what about just calling a method?
<djabbour> (without knowing the specific object I want to send to)
<arturaz> obj.send :method_name
<arturaz> or do you mean a global method, like puts?
<arturaz> jruby-1.6.6 :001 > send :puts, 3
<arturaz> 3
<arturaz> => nil
schovi has joined #ruby
<arturaz> global methods are defined on Kernel, which in turn is included in Object
<arturaz> so they are available on every object
<djabbour> arturaz, ah, what if I don't know the context of the method though- like it can be on any object, but I know it's in scope
<arturaz> so how are you planning to call it on? :)
nim_ has joined #ruby
<arturaz> i mean you actually still are going to call that method on some object
<arturaz> right?
<djabbour> arturaz, argah, damn rails magic going on. Not sure if it's a class or instance method
<arturaz> doesn't matter :)
<djabbour> arturaz, maybe I should bug the rails guys- but I am in a helper trying to metaprogram calling other helper methods
<djabbour> but they can be on any helper
<arturaz> helpers are modules, IIRC
<arturaz> and they're mixed into view class
<arturaz> so send(:your_method) should work just fine
<djabbour> ah I tried that but it gave me an undefined method (hence asking the question) on my object
<djabbour> I've actually got a helper initializing an object
<djabbour> inside that object I'm making this send
<djabbour> i'm confident the call works without using send/metaprogramming
<djabbour> hence scratching my head
<djabbour> i mean I suppose I could eval it but that'd be a lot slower
<djabbour> arturaz, am I explaining my situation well enough? like my_helper() do Foo.new end and inside Foo#initialize I've got this send going on
<arturaz> that send is being called on Foo, not your view class
<arturaz> pass self to Foo.new
<arturaz> and do send on it
xastion has joined #ruby
<djabbour> but then how does making the call without using send work?
<arturaz> from inside Foo?
<djabbour> Yup
robbyoconnor has joined #ruby
<arturaz> try Kernel.send(:yourm)
<arturaz> but that shouldn't work too
<arturaz> :]
LMolr has joined #ruby
<djabbour> yeah it gives me undefined method `link_to' for Kernel:Module
aj910martin has joined #ruby
<djabbour> (i'm trying to call link_to in this case)
<shevy> now we know that Kernel does not have a method called link_to
<djabbour> lol indeed
<arturaz> it shouldn't really work inside Foo too
<arturaz> are you sure it works?
<djabbour> arturaz, yeah lol
<djabbour> arturaz, I can access all the rails helpers in there- content_tag, etc, use them all over my class
<arturaz> I have no idea how that might be happening :)
<arturaz> try __send__
<shevy> rails loves to remain mysterious
<djabbour> arturaz, alright thanks for the help anyhow. I'll do some playing
<arturaz> perhaps send is overriden
<djabbour> shevy, that it does
<arturaz> thats why I started disliking rails :)
<arturaz> it was quite simple in the begining
<djabbour> I can understand that argument
a_a_g has joined #ruby
<arturaz> now its full of magic
<shevy> my theory is that good projects are able to remain sufficiently small BUT also easy all the time, even on internals
<arturaz> I even have a file named ar_monkey_squad that monkeypatches activerecord to do my bidding :D
<arturaz> djabbour, just pass self :)
<arturaz> this magic is not good for your code readability anyway
<djabbour> arturaz, if I can avoid passing self I'll try- if not I will resort to that heh
<arturaz> its good design to pass that explicitly
<arturaz> imagine if other coder comes
<arturaz> and wonders - how these methods are called
<arturaz> where are they defined?
<arturaz> with dynamic typing you have no way of finding that out
<shevy> other coders are already screwed
<shevy> the best is to document your own things properly
<shevy> also don't shy away from cursing at rails in the comments
<shevy> :>
gregorg has joined #ruby
gregorg has joined #ruby
<arturaz> hehe
<arturaz> its ironic: rails brought my to ruby, now I sort of loathe it
<arturaz> its load time is abysimal
<arturaz> no tdd without spork for you!
<arturaz> oh, wait, no spork on jruby? well, screw you.
<arturaz> bah.
<shevy> hmm
akemrir has joined #ruby
<djabbour> oh weird, it works with send() with content_tag but not link_to
<djabbour> wtf, they're both ActionView::Helpers
InBar has joined #ruby
<shevy> you are slowly digging deeper into the real magic at hand
<arturaz> djabbour, let me explain this
<arturaz> the only ways for method to appear in object are
<shevy> magic
<arturaz> 1) you define it, either via def/define_method
<arturaz> 2) you include a module into it
<shevy> hmm
<arturaz> 3) you define your methods in Kernel (or main scope, which is Kernel). Because every Object includes Kernel, see point 2)
<arturaz> 4) method_missing
<arturaz> thats it
<shevy> could you do a proc, that acts like a module, and send that proc to your object, and eval it?
<arturaz> shevy, you probably could :)
<arturaz> at least with define_method and instance_eval
<shevy> subclassing via procs, multiple inheritance via procs! perhaps even using the -> operator
<arturaz> why use modules when you can reinvent them!
<shevy> not "reinvent", that is a positive word
<shevy> I want to BYPASS them :)
<shevy> I'd also never want to use that, if it works... via procs
<shevy> somehow I dont like magic
<djabbour> Ahha! I got it. And it's because i'm slightly retarded.
<djabbour> I forgot I wrote a base class that included TagHelper
<shevy> you finally entered the required state of mind to understand magic
<arturaz> heh
etehtsea has joined #ruby
<shevy> but I am also losing track sometimes
<shevy> I think my largest project has around 50 classes and 120 .rb files... and about 20 yaml files ... and some more docu files
<shevy> I am not even sure anymore that classes are the way to go :(
mdw has joined #ruby
<shevy> I'd like to let methods evolve alone...
<arturaz> lol
<arturaz> Language files blank comment code
<arturaz> -------------------------------------------------------------------------------
<arturaz> Ruby 498 3557 4636 16856
<shevy> how do you do this statistics?
<arturaz> cloc
w400z has joined #ruby
<shevy> ls -1 -R . | wc -l # 3738
<shevy> seems I have 3738 .rb files
<davidcelis> shevy: speak english
<shevy> davidcelis ja mein Herr
<davidcelis> ¿qué?
<w400z> rubyists, whenever you are scraping for images, make sure you use "wb" for binary mode. That is all….
dalkor has quit [#ruby]
Banistergalaxy has joined #ruby
KL-7 has joined #ruby
<arturaz> helpful tip is being helpful
PragCypher has joined #ruby
jenglish has joined #ruby
_null has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
ukwiz has joined #ruby
shruggar has joined #ruby
eka has joined #ruby
ephemerian has joined #ruby
rcs has joined #ruby
BiHi has joined #ruby
aj910martin has quit [#ruby]
tvw has joined #ruby
akemrir has joined #ruby
<shevy> lol
<shevy> crappy tip is being crappy
<shevy> I dont think I ever had to scrape for images in my 7 years of ruby. unlikely I will ever have to do that either
akemrir has joined #ruby
moshef has joined #ruby
jlebrech has joined #ruby
akemrir has joined #ruby
emmanuelux has joined #ruby
gyre007 has joined #ruby
blacktulip has joined #ruby
davidpk has joined #ruby
zunnyohn1 has joined #ruby
simao has joined #ruby
alem0lars has joined #ruby
tatsuya_o has joined #ruby
robbyoconnor has joined #ruby
trivol has joined #ruby
mdw has joined #ruby
<JohnBat26> hello all
<JohnBat26> How can I see memory leak in ruby C gem ?
<JohnBat26> I have six resque jobs and see memory leaks in system memory
<JohnBat26> If I kill resque jobs memory leak keep
<alem0lars> I'm using sinatra and dm-redis-adapter. When I try to connect to a remote redis instance, I get a Timeout::Error, but connecting via redis-cli works. What could be the issue?
<alem0lars> these are the paste of the source code: http://pastebin.com/VKhGYBU0 http://pastebin.com/F3J9tsWm
workmad3 has joined #ruby
apeiros_ has joined #ruby
bier has joined #ruby
stefanp has joined #ruby
stefanp has joined #ruby
bluOxigen has joined #ruby
mikeric has joined #ruby
francisfish has joined #ruby
medik has joined #ruby
rohit has joined #ruby
berserkr has joined #ruby
schovi has joined #ruby
vectorshelve has joined #ruby
bob_f has joined #ruby
robotmay has joined #ruby
nw has joined #ruby
dql has joined #ruby
shaman42 has joined #ruby
visof has joined #ruby
visof has joined #ruby
<shevy> JohnBat26 not sure there is a way. you could perhaps try to benchmark and profile, but that kinda sucks
<JohnBat26> shevy: please, advice me tool for it
irrationalfab has joined #ruby
<shevy> JohnBat26 I dont think there is any
fr0gprince_mac has joined #ruby
kedare has joined #ruby
<jlebrech> i'm trying to use blocks like callbacks to login and retry https://gist.github.com/2299836 I think i've missed something out
<shevy> ewwww rails
<rohit> jlebrech: #rubyonrails
<jlebrech> eh no
<shevy> you know that yield taps into the block given to a method?
<banisterfiend> shevy: hey chevrolet
<rohit> jlebrech: ignore me :(
<banisterfiend> shevy: i dreamed about your, it was just the other night, most of you was naked but some of you was light
greenarrow has joined #ruby
<banisterfiend> you*
<jlebrech> shevy yeah, i'm trying to figure that out
<shevy> jlebrech well you pass the block here:
<shevy> login(@game) { get_profiles(search) }
<shevy> so the part between the {} would get called by yield
<jlebrech> yeah, they should.
<shevy> Not sure why you use &block
<jlebrech> ok i should take that out
<shevy> I have no idea. I dont know why you use that, perhaps you have a reason.
<shevy> It's your code after all :)
clockwize has joined #ruby
eldariof has joined #ruby
<jlebrech> shevy, that was from me looking at some example
mdw has joined #ruby
<shevy> be careful, there is wild ruby code out there with terrible things
diegok has joined #ruby
<jlebrech> ;)
<banisterfiend> shevy: chevrolet
<jlebrech> i'll just check to see if my code reaches the yield
<shevy> banisterfiend always at night you become so love-seeking :(
<banisterfiend> shevy: it's your strong germanic chin
<shevy> you need a massive jaw in order to take a beating and just shrug it off
<shevy> just look at the Neanderthaler
a_a_g1 has joined #ruby
<shevy> ah well actually
<shevy> that's not that massive...
<vectorshelve> Hai All... Hope you guys have been having a great day so far.. Wish you the same ahead :)
<shevy> some body builders who roid have a more massive jaw
<shevy> especially when you compare this to how he looked 5 years ago!
<vectorshelve> shevy: awww that scared me off
alem0lars_ has joined #ruby
nyuszika7h has joined #ruby
<shevy> or in athletics, when you see women with dental braces suddenly... it is because the roids cause the jaw to become more massive. like Marion Jones did during her time
<shevy> doping killed sports a long time ago :(
<shevy> vectorshelve when will you start to learn ruby?
<vectorshelve> shevy: the day you start teaching me dear ;)
<shevy> nah it won't work like that, because you would lack INNER motivation for the task
<shevy> it's like why I can't learn C ...
<shevy> I blame ruby
<shevy> vectorshelve, good that you don't learn ruby, it would just spoil you
<vectorshelve> shevy: then I should blame my girlfriend for my over obsession with her
<shevy> yes
<shevy> there goes your time
<shevy> :D
<vectorshelve> I just dont feel like doing anything else than being with her.. she is to me more than what ruby is to you :)
<shevy> hey banisterfiend ... would you like me more if my jaw would be twice as massive as it is right now?
<shevy> vectorshelve yeah, the thing is, I am a doer. Things must be done. Just as Alan Kay said ... "The best way to predict the future is to invent it."
<shevy> I am just picky at what has to be invented
<shevy> a new programming language would be neat
<jlebrech> yield if block_given?
<vectorshelve> shevy: I always wanna develop something be part of something construtice.. I hate testing job and I want hard cash :) love my girl and be happy
<shevy> jlebrech that will trigger optionally (and only) if a block is given
<shevy> jlebrech I usually use the "yield if block_given?" rather than just "yield" alone
<jlebrech> shevy that what i want :)
<shevy> vectorshelve I think you are a happy person :)
<shevy> I am not. I am not content with how things are anywhere. Progress depends on the unreasonable man.
<shevy> 90% of everything sucks. 9% is ok. The remaining 1% is however really awesome.
<shevy> 90% of my code sucks too :(
<shevy> I am unconvinced that I reach the 1% of total awesomeness in my code so far
<vectorshelve> shevy: but u got to understand that things arent always in your control and a single soul cannot change the fortunes of a million ones until they feel that themseleves
<vectorshelve> shevy: read through my blog -> http://mithunsasidharan.blogspot.in/ :)
<shevy> yeah that is true
<shevy> that's why I like github
<shevy> even something as simple as reporting issues is nice and easy, compared to i.e. sourceforge
<Divinite> Well, in most cases, 99% of stuff sucks, and 0.9% of stuff is alright. Only 0.1% of stuff is good.
<shevy> I think I reported... about 12 times at sourceforge. I could not tell you how much of that was ignored... perhaps 80%. On github... I reported about ~15 things so far. In 90% I got feedback
<shevy> yeah Divinite
<shevy> I just squeeze in some things I think are cool. like Biology!
<shevy> vectorshelve I cant read that
<vectorshelve> shevy: why ?
<shevy> vectorshelve I am too surprised why people in Pakistan even accept their "government"
<shevy> well
<shevy> you could replace the names of any individual and things would be pretty much the same
<vectorshelve> shevy: I am not from pakistan
<vectorshelve> shevy: they dont accept they atre too fragile for a revolution
<shevy> hmm
twinturbo has joined #ruby
<shevy> perhaps they are too reasonable, I'd be angry all the time
<vectorshelve> shevy: they are oppressed suppresed and depressed
<shevy> I wake up, I read news, and I get angry.
<vectorshelve> shevy: the afghanistan condition is terrible.. even somalia.. two most volatile nations of the world today
<shevy> yeah the afghans have it bad too
<shevy> they go from wartime to wartime to wartime
Houdini1 has joined #ruby
jenglish_ has joined #ruby
sacarlson has joined #ruby
johndbritton has joined #ruby
heftig has joined #ruby
waxjar has joined #ruby
jenglish has joined #ruby
<vectorshelve> shevy: afghan girls are beautiful... infact arab girls ;)
kp666 has joined #ruby
<shevy> hard to see under all that veil
<shevy> hmm I have to leave here... should be back in an hour
rohit has joined #ruby
Banistergalaxy has joined #ruby
buschhardt has joined #ruby
gokul has joined #ruby
gomix has joined #ruby
Whoop has joined #ruby
mcero has joined #ruby
beilabs has joined #ruby
artm has joined #ruby
r0bby has joined #ruby
norm_ has joined #ruby
ddoucette has joined #ruby
axl__ has joined #ruby
irration_ has joined #ruby
bluenemo has joined #ruby
y3llow_ has joined #ruby
jenglish_ has joined #ruby
sectionme has joined #ruby
Sigma00_ has joined #ruby
elliot_ has joined #ruby
Danielpk|rdlBNC has joined #ruby
ewag_ has joined #ruby
mtkd_ has joined #ruby
Nanuq_ has joined #ruby
kp666_ has joined #ruby
alienven1m has joined #ruby
banisterfiend has joined #ruby
alvesjnr_ has joined #ruby
Corey_ has joined #ruby
Freijo has joined #ruby
wolgo_ has joined #ruby
csamuelson has joined #ruby
akhkharu_ has joined #ruby
mlue_ has joined #ruby
beha has joined #ruby
methodfree has joined #ruby
falena has joined #ruby
djdb_ has joined #ruby
fjfish has joined #ruby
Yappo____ has joined #ruby
tomku|two has joined #ruby
zigidias_ has joined #ruby
zigidias has joined #ruby
Axsuul has joined #ruby
artm has joined #ruby
kuzushi has joined #ruby
sohocoke has joined #ruby
buschhardt has quit [#ruby]
savr has joined #ruby
<savr> hi
<savr> #capistrano seems dead but maybe someone here can help
<savr> before I added/committed my deploy.rb and Capfile
<savr> cap deploy:check worked perfectly
<savr> after I got this http://pastebin.com/47Y6jH2S
progzer has joined #ruby
<frontendloader> Is there a self-contained alternative to amqp+rabbitmq? I'm only running one process with 10 threads tops and just need to message between those threads.
jenglish has joined #ruby
s1n4 has joined #ruby
<frontendloader> I suppose EventMachine::Queue satisfies what I'm asking for at a basic level
visof_ has joined #ruby
niku4i has joined #ruby
sectionme has joined #ruby
stoor has joined #ruby
mengu has joined #ruby
s1n4 has joined #ruby
<banisterfiend> frontendloader: look at celluloid too
dbgster has joined #ruby
<banisterfiend> frontendloader: it seems pretty featureful
Indian has joined #ruby
stoor has quit [#ruby]
<vectorshelve> savr: ask this question in #rubyonrails room
<savr> ok
<vectorshelve> Indian: are you an indian ?
irrationalfab has joined #ruby
banisterfiend has joined #ruby
heftig has joined #ruby
josephwilk has joined #ruby
alem0lars has joined #ruby
<Spaceghostc2c> Indian: Are you a native of some place that isn't India?
<vectorshelve> Spaceghostc2c: could you help me convert this simple code into ruby pleas -> https://gist.github.com/2300007
<vectorshelve> thanks
<Spaceghostc2c> Uh, no.
snearch has joined #ruby
rohit has joined #ruby
CodeFriar has joined #ruby
kp666_ has quit [#ruby]
Banistergalaxy has joined #ruby
beeneto has joined #ruby
neurotech has joined #ruby
<banisterfiend> apeiros_: ping
cameron_ has joined #ruby
<neurotech> banisterfiend: I'm back
sacarlson has joined #ruby
davidpk has joined #ruby
Nathandim has joined #ruby
<banisterfiend> neurotech: ok...
<neurotech> I had to leave earlier - I posted a question but missed the answer
Sailias has joined #ruby
BiHi has joined #ruby
<neurotech> http://pastie.org/3726332 <-- how can I add 1 to the number received from gets in line 2 and have it display in line 3
gyre007 has joined #ruby
<beeneto> You have to convert fave to an integer, then do the addition before you puts it
<neurotech> I started learning ruby today, beeneto. Would I do that with fave.to_i ?
fayimora has joined #ruby
yalue has joined #ruby
mcwise has joined #ruby
Jake232 has joined #ruby
`brendan has joined #ruby
otters has joined #ruby
sectionme has joined #ruby
Zolrath has joined #ruby
pu22l3r has joined #ruby
<linduxed> what do the & signs in this mean? array_with_hashes_in.map(&:value).reduce(&:+)
workmad3_ has joined #ruby
Progster has joined #ruby
johndbritton has joined #ruby
<philcrissman> linduxed: symbol to proc. See http://pragdave.pragprog.com/pragdave/2005/11/symbolto_proc.html for a short explanation
<linduxed> philcrissman: ok thx
<philcrissman> np!
<linduxed> now i understand what it does, but even with that explanation i have no understanding of how it works
<linduxed> :-)
<linduxed> as in, now i can use it, but the entire proc thing is beyond me
<philcrissman> linduxed: it's converting the symbol to a Proc which it will pass in a block (directly paraphrasing Dave)... so array.map(&:value) is the same as array.map{|a| a.value}
<philcrissman> linduxed: if it helps, nevermind the Proc aspect, for now. :) Think of it as translating to a block, as above. Think of the symbol as becoming a method.
<linduxed> haha, sounds fair
bananastalktome has joined #ruby
iamjarvo has joined #ruby
<philcrissman> linduxed: and the .reduce(&:+) in the example you started with, would be equivalent to reduce{|sum, n| sum + n} (see the inject/reduce docs if that's still unclear. :)...
nari has joined #ruby
jenglish has joined #ruby
<linduxed> i know what inject does (and that reduce is an alias), but i'm a bit confused as to how it manages to skip the start value for inject
ickmund has joined #ruby
<linduxed> i'm just assuming that there's magic going on adding a zero as start value there somewhere
Morkel has joined #ruby
nanderoo has joined #ruby
torpor has joined #ruby
<torpor> hi
chrassidy has joined #ruby
<torpor> how do I do this: somestring = result_of_funct() or ""
<torpor> so that if result_of_func() = nill, an empty string is assigned instead?
<chrassidy> Is ruby a good language for a modular, game server backend?
<chrassidy> I plan on writing an API that will allow a java (android app) client to connect to the server
<torpor> chrassidy: yes
<chrassidy> alright
<beeneto> you ask that in the ruby channel? :p
<rippa> torpor: yes, you do it like that
<chrassidy> what database software do you suggest?
<torpor> rippa: doesn't seem to work, i get a nil object
<rippa> try || then
<torpor> ok
<torpor> nope, still get "can't convert nil into String", damn.
strife25 has joined #ruby
<torpor> oh wait it works.
<torpor> :)
<philcrissman> linduxed: in the inject case, it's implicitly summing from zero.
sohocoke has joined #ruby
<torpor> another dumb question: how do i force something to string?
<torpor> is it just string(something)?
<philcrissman> linduxed: just like if you call it with the block and no start value. If you needed a non-zero start value, afaik you'd need to use the block format: eg, [1,2,3].inject(5){|s,n| s+n} => 11
<philcrissman> torpor: usually whatever.to_s
<torpor> ok thanks
Synthead has joined #ruby
troessner has joined #ruby
<_ack> Can a class method change his implementation once executed?
mstratman has joined #ruby
neohunter has joined #ruby
<rippa> yes
<neohunter> Hi
sohocoke has joined #ruby
torpor has quit [#ruby]
torpor has joined #ruby
<neohunter> HOOB Question: anyone can please help me with this: http://stackoverflow.com/questions/10011365/twitter-gem-and-rails-issue-saving-user
<neohunter> noob*
tommyvyo has joined #ruby
tommyvyo_ has joined #ruby
t0mmyvyo has joined #ruby
v0n has joined #ruby
banisterfiend has joined #ruby
<apeiros_> banisterfiend: pong
<apeiros_> (at work, though, so not very responsive)
<banisterfiend> apeiros_: do u have yard installed?
<banisterfiend> np
<troessner> neohunter, your question wasn't smart, see the SO answer so far
mengu_ has joined #ruby
<apeiros_> sure
theishi has joined #ruby
<troessner> -> blablub # ERROR
<canton7> neurotech, what's the answer to the question which Simon Woker posted?
<troessner> that's not helpfull
linoj has joined #ruby
Nathandim has joined #ruby
<theishi> I have a method that I want to call, that I didn't write, and I want to find out how many arguements it will take, and what the names of these arguments are... how can i do this?
<troessner> theishi, >> def omg(foo, bar); end; m = method :omg; m.arity
<troessner> => 2
jitesh_shetty has joined #ruby
<troessner> theishi, >> p m.class
<troessner> Method
<neohunter> troessner: ok, i replied
<troessner> you can look up the api docs for Method, i am pretty sure there is more usefull stuff in there
<troessner> :-)
<theishi> Yeah i guess. It isn't well documented though
<canton7> neohunter, looks like the t.user.to_hash hash contains an id field, which you're not allowed to assign
<neohunter> canton7: yeah, i know that, but how i can do that? i need to create a hash with each field? {:description => t.user.description, :screen_name => t.user.screen_name ....and so on?
shaggy2dope has joined #ruby
kvirani has joined #ruby
<canton7> neohunter, you can unset the :id key
thiagopnts has joined #ruby
netrealm has joined #ruby
<canton7> neohunter, or, better, you could just select the keys you want
thiagopnts has quit [#ruby]
banisterfiend has joined #ruby
<neohunter> canton7: so manually create the hash. ok i will do that
<neohunter> cause now im receiving this error: ActiveRecord::UnknownAttributeError: unknown attribute: id_str
<neohunter> they are keys that i dont have on model..
<neohunter> i though if key doesnt exist it just got ignored but dont works that way
jitesh_shetty has joined #ruby
<philcrissman> neohunter: where is id_str coming from?
<canton7> neohunter, I was thinking more along the lines of Hash#reject or Hash#select
<banisterfiend> apeiros_: do you have yard installed?
<neohunter> philcrissman: id_str is one key from Twitter::User from twitter gem
<neohunter> canton7 mmmm hash select, interesting, let me read aboutit
t0mmyvyo has joined #ruby
<philcrissman> neohunter: ok. But if it's not an attribute in your model, you can't just pass it to the model... But I guess you've seen that. :)
<canton7> neohunter, t.user.to_hash.select{ |k,v| [:field, :another_field.include?(k) } or so
<apeiros_> banisterfiend: yes, "sure" I said before already ;-)
<canton7> ahem, with an added ] in the right place
<banisterfiend> apeiros_: sorry bad internet
<apeiros_> beat it!
mrwalker has joined #ruby
<apeiros_> canton7: yay! :-S
<apeiros_> canton7: there's no Symbol#include? :-p
nuby has joined #ruby
<banisterfiend> apeiros_: try this in irb: YARD::Parser::Ruby::Legacy.constants(false)
<canton7> t.user.to_hash.select{ |k,v| [:field, :another_field].include?(k) }
<canton7> hehe, sadly not
<banisterfiend> apeiros_: it shows that RipperParser is a constant accessible from Legacy
<banisterfiend> apeiros_: then try to access it YARD::Parser::Ruby::Legacy::RipperParser #=> NameError
tommyvyo_ has joined #ruby
<banisterfiend> apeiros_: any idea wtf is going on?
bglusman has joined #ruby
lorandi has joined #ruby
<apeiros_> banisterfiend: hu? weird…
<neohunter> it wooooorks!!!!
<apeiros_> canton7: still urgs
<apeiros_> canton7: the point of a hash is that you can access by key very fast. with select, you iterate over all key/value pairs… not fast at all.
<neohunter> jump, but it doesnt extract the keys, is just an empty hash xD
<apeiros_> hash.values_at(:field, :other_field)
<apeiros_> ah, no, you want a hash - since this looks like rails:
<apeiros_> hash.slice(:key, :other_key)
trivol has joined #ruby
<canton7> apeiros_, where is Hash#values_at defined? That's exactly what I was after
<canton7> similarly Hash#slice
<apeiros_> that's core
<neurotech> canton7: What?
<apeiros_> Hash#slice is ActiveSupport
<canton7> oops, not sure why ctrl-f-ing the Hash man page wasn't bringing that up :S Thanks!
<apeiros_> require 'active_support/core_ext' outside of rails to get it
dv310p3r has joined #ruby
dfibre has joined #ruby
synk has joined #ruby
gurugeek_ has joined #ruby
banjara has joined #ruby
alx- has joined #ruby
stevegozie has joined #ruby
zii has joined #ruby
zii has quit ["WeeChat 0.3.7-dev"]
banister_ has joined #ruby
looopy has joined #ruby
LMolr has joined #ruby
askTheUser has joined #ruby
<askTheUser> hey
<askTheUser> can someone help with unit testing?
<askTheUser> really really basic unit testing
<askTheUser> when i do 'HELLO WORLD'.downcase it doesn't work?
<fjfish> askTheUser: your example should be upcase I think
<askTheUser> okay
geekbri has joined #ruby
Sailias has joined #ruby
<askTheUser> it didn't work
rbanffy has joined #ruby
<askTheUser> can anyone help me?
johndbritton has joined #ruby
philcrissman has joined #ruby
<any-key> what does it do instead of working?
<any-key> I see absolutely no way 'HELLO WORLD'.downcase could fail
<askTheUser> does it work for you
<matti> any-key: HAHAHA
<askTheUser> SyntaxError: <main>:8: syntax error, unexpected tSTRING_BEG assert_equal 'HELLO WORLD', 'hello world'.'HELLO WORLD'.downcase ^
<any-key> it wants you to wrap it in a function or something
<any-key> I dunno
<any-key> they provide absolutely no clues as to what you're supposed to actually type in
CannedCorn has joined #ruby
<philcrissman> askTheUser: you're just supposed to type in the method from the blank.
<philcrissman> in that one, upcase
<askTheUser> oh
<askTheUser> thanks
<philcrissman> askTheUser: there is a "help" link right up top. ;)
<any-key> that's stupid
<askTheUser> hahah
<askTheUser> :P
asobrasil has joined #ruby
<philcrissman> any-key: it didn't seem intuitive to me either... but it is pretty clear in the "help" page.
jgarvey has joined #ruby
<philcrissman> so, maybe it's good to read the help page. ;)
<any-key> it's against my personal policy to click "help" links
strife25 has joined #ruby
<philcrissman> any-key: yeah, I hate learning things too
<any-key> it's the worst
<philcrissman> :/
nu7hatch has joined #ruby
Aristata has joined #ruby
uris has joined #ruby
yoklov has joined #ruby
phantasm66 has joined #ruby
kevinbond has joined #ruby
brngardner has joined #ruby
nlc has joined #ruby
LBRapid has joined #ruby
blueOxigen has joined #ruby
fearoffish has joined #ruby
bbttxu has joined #ruby
__main__ has joined #ruby
stevegozie has joined #ruby
crankycoder has joined #ruby
td123 has joined #ruby
bluOxigen has joined #ruby
* shevy presses the any-key
EzeQL has joined #ruby
EvanR has joined #ruby
jlogsdon has joined #ruby
IrishGringo has joined #ruby
shift_ has joined #ruby
EvanR has joined #ruby
Aristata has quit [#ruby]
waxjar has joined #ruby
Bofu2U has joined #ruby
gurugeek_ has quit [#ruby]
luxurymode has joined #ruby
kpshek has joined #ruby
<Spaceghostc2c> shevy: where u hied mai eny-kee?
KL-7 has joined #ruby
<shevy> I dunno, I cant find it myself!
Ryougi_Shiki has joined #ruby
tobago has joined #ruby
roolo has joined #ruby
bawer has joined #ruby
fr0gprince_mac has joined #ruby
axl_ has joined #ruby
<robert_> hai shevy :D
lkba has joined #ruby
dfibre has joined #ruby
lorandi has joined #ruby
snip_it has joined #ruby
eka has joined #ruby
cezar_ has joined #ruby
red5 has joined #ruby
<red5> what's the last version of ruby ? 1.9.3-p125 ?
PragCypher has joined #ruby
<banister_> red5: ya
ckrailo has joined #ruby
lateau has joined #ruby
<red5> banister_: awsm !
red5 has quit [#ruby]
cachoimechi has joined #ruby
rndm has joined #ruby
dql has joined #ruby
bbttxu_ has joined #ruby
<rndm> so i put some stuff in app/bin and some other stuff in app/lib. what's the best way for something in app/bin to require a file in app/lib?
yoklov has joined #ruby
liluo has joined #ruby
PaciFisT has joined #ruby
alek_b has joined #ruby
zunnyohn1 has joined #ruby
maximumgeek has joined #ruby
jcromartie has joined #ruby
Gushings1 has joined #ruby
<Gushings1> Hello
fayimora has joined #ruby
<Gushings1> I have a couple questions.
rippa has joined #ruby
Poapfel has joined #ruby
<Gushings1> I commonly see the format .each{|somevalue| somecommand()} used in place of a for loop in ruby
BiHi has joined #ruby
<Gushings1> Is there any sort of general style guideline for when to use for vs each?
<maximumgeek> I don't know.
atnight has joined #ruby
<maximumgeek> I tend to go with 'for' x in 'bleh'
<maximumgeek> but that is just me
<Gushings1> yeah, that's what I felt like doing naturally as well
CheeToS has joined #ruby
<bawer> I think that people new to ruy tend to use the for..in construct
dcolebatch2 has joined #ruby
n1x has joined #ruby
<Gushings1> My other issue, which is more important, is that I have a TCPServer which I am using select() on to get the sockets that are available for reading.
<geekbri> if there is an object, with a member who is a hash. Is there a way to extract just that hash into a new object? myobject.myhash.clone ?
andrewhl has joined #ruby
<Gushings1> However, when I use descriptor.gets(), I can get blocked by sockets that have not terminated their input with a newline.
<Gushings1> I've looked at timeouts but I don't like the solution.
<maximumgeek> Gushings1, what language are you coming from?
<Gushings1> C, Java, Scheme, Python
davidpk has joined #ruby
<Gushings1> I'm wondering if getsc inside a while loop could work.
IrishGringo has joined #ruby
[-mX-] has joined #ruby
<Gushings1> or read_nonblock loops promising.
iocor has joined #ruby
looopy has joined #ruby
<Synthead> if I were to open an ssh forward within a ruby script, is there some weird gem or something I could use, or should that be done as an `external command` ?
DrShoggoth has joined #ruby
elhu has joined #ruby
ales has joined #ruby
<canton7> Synthead, I believe Net::SSH can do that
<fearoffish> was just about to say that
d2dchat has joined #ruby
<Synthead> canton7, fearoffish: Net::SSH::Service::Forward looks great!
<Gushings1> any input on my blocking issue?
lorandi has joined #ruby
davidcelis has joined #ruby
io_syl has joined #ruby
lkba has joined #ruby
<fearoffish> Gushings1: personally I use each all the time, it's more of a ruby-ism than a for loop
<fearoffish> as for read_nonblock, no idea, never used it :)
MasterIdler has joined #ruby
porco has joined #ruby
<canton7> Gushings1, gets can take an argument saying what the delimeter is
<Gushings1> Is it acceptable to have 5-10 lines of code inside an each block?
<canton7> Gushings1, and the advice is never to use for unless you have to. for doesn't have the scoping that #each has, and it wraps #each underneath anyway
<Gushings1> canton7 - my issue is that I am reading from a socket. I don't know when or if it will ever successfully send me the delimeter.
<Gushings1> Right now it's newline.. their socket could have input ready for read but then never send me a newline and I hang waiting for that.
<Gushings1> If it was a space, the same situation could occur.
<Gushings1> Is there some delimeter you have in mind?
<canton7> Gushings1, you can also pass in nil, apparently, which reads everything
<Gushings1> hm
g0bl1n has joined #ruby
g0bl1n has joined #ruby
<Gushings1> I'll give it a shot.
<canton7> Gushings1, or you could use getc to grab the input one character at a time
MasterIdler has joined #ruby
<Gushings1> I don't understand how it would ever know it received everything.
<Gushings1> but perhaps there is magic hidden away.
<canton7> as in, passing nil means that gets will give you everything that's available
<canton7> *that's currently available
mashed has joined #ruby
synk has joined #ruby
<Gushings1> interesting
<Gushings1> Well I hope that works
<Gushings1> I'll give it a shot
<Gushings1> thank you.
n1x has joined #ruby
g0bl1n has joined #ruby
schovi has joined #ruby
brianpWins has joined #ruby
johnmilton has joined #ruby
artm has joined #ruby
apeiros_ has joined #ruby
vipaca has joined #ruby
vipaca has joined #ruby
hooper has joined #ruby
KL-7 has joined #ruby
looopy has joined #ruby
<lectrick> I work at a startup and something on our local network is syn flooding the router. Anyone a network person or know how to track this down? (maybe another channel for sysadmins?)
wizbdoy has joined #ruby
blacktulip has joined #ruby
<Gushings1> There is probably a simpler way
<Gushings1> but I would use wireshark to examine what is traveling to your router and find their internal IP address.
Guest65986 has joined #ruby
<Gushings1> Whoever set up the system may have a wiring diagram that can tell you exactly where he/she is connected.
<Gushings1> Otherwise, if it is wireless , it's a bit harder.
<Gushings1> The source can be spoofed as well.
<lectrick> It's wireless.
<Gushings1> It depends on how technically skilled he is or what software he is using.
<Gushings1> How large is your startup, may I ask?
<Gushings1> By number of people you expect to be using the router.
wmoxam has joined #ruby
<lectrick> like 15 people? There are 50+ clients on the router tho, apparently
<Gushings1> Well, iphones and other devices will connect.
jgrevich has joined #ruby
jgrevich has joined #ruby
d3vic3 has joined #ruby
mdhopkins has joined #ruby
<Gushings1> Someone who is a security expert may be able to help you better.
<Gushings1> I just play around with it.
<uris> your router should be able to list all users connected to it
<uris> most routers can do that once you login
<uris> that will give you an idea of who and what is connected
adambeynon has joined #ruby
<Gushings1> I'm interested in how that would help.
<uris> it can give you an idea if people who are not supposed to be connected are indeed connected
<uris> like was mentioned earlier, people on their phones or tablets
<Gushings1> MAC addresses can be changed, the assigned IP addresses are dynamically allocated, and SYN floods can spoof the IP address anyways.
<uris> sometimes it is simpler than that, maybe someone just connected and is using a large amounts of bandwidth
sectionme has joined #ruby
<Gushings1> True, but he specified that he was being syn flooded.
<Gushings1> I'd just lock up the router for now, is it password protected lectrick
<lectrick> Gushings1: Of course. WPA2.
<uris> then it could be one of your machines that is compromised
blueadept has joined #ruby
<uris> install wireshark and ntop to monitor some traffic
<Gushings1> yep
<uris> there is not easy solution, for cases like this you have to roll up your sleeves and get lots of coffee
<uris> it takes some time
<shevy> coffee
<shevy> I HATE IT
williamcotton has joined #ruby
<Gushings1> Do you have a log of the network connections?
<matti> Noess.
<matti> shevy: How can you have coffee?
<matti> ;/
<Gushings1> Modafinil
<shevy> I am the chocolate type
<matti> shevy: OUT ->
LMolr has joined #ruby
<matti> ;/
<matti> shevy: :)
<shevy> hot chocolate + donut (but not too many donuts)
<matti> Callories...
<shevy> :(
<Gushings1> At least the WPA2 narrows it down.
<Gushings1> It's probably someone that has the key.
<Gushings1> That you or someone else provided to them.
headius has joined #ruby
td123 has joined #ruby
renanoronfle has joined #ruby
riginding has joined #ruby
hobodave has joined #ruby
baroquebobcat has joined #ruby
maletor has joined #ruby
aantix has joined #ruby
<bounce> *looks at backscroll* uhm not really the right place to look
<bounce> s/look/ask/
cloke has joined #ruby
<bounce> but fire up tcpdump, check the macs, that sort of thing. there's things like... from vague memory wifi-spy that work even without the fancy expensive dongle (that gives moar powr) to help pinpoint physical location
davidpk has joined #ruby
cloke_ has joined #ruby
LiquidInsect has joined #ruby
<lectrick> Is there any way to have an instance of a number? Something that is passed by-ref instead of by-val, but otherwise acts like a number?
<bounce> there is a way to make cheap router boxes hand over the wpa key with 11000 tries max unless the box blocks the attack, and without key you can still mount a disassoc attack
cloke has joined #ruby
minver has joined #ruby
<minver> Since matz strongly discourage autoload (http://is.gd/Ik3zfm) should I simply use require then?
<shevy> sure
<bounce> if your switches aren't cheap crap they can point to a port where it's coming from (and possibly turn off the port; a bit of snmp-scripting does the trick)
<TTilus> lectrick: 1 is an instance, what you are talking about?
<apeiros_> minver: yes
<shevy> lectrick how about using a Proc?
<lectrick> TTilus: "TypeError: can't define singleton method "something" for Fixnum" :)
strife25 has joined #ruby
<apeiros_> lectrick: make a proxy object
<bounce> trying to go the route of "ever change the value of 4?"?
knopkodav has joined #ruby
<lectrick> shevy: maybe. Is there a method called on an instance to return itself?
<TTilus> lectrick: a couple of steps back now, what are you trying to accomplish?
<shevy> well ... if you need it to be a singleton method on any fixnum object then i am not sure this will work
<lectrick> I want to return a single value from a method, but I also want "extra information" returned along with it in the event it is requested
<shevy> you must have done something like ... x = 5; def x.something right?
aeu has joined #ruby
<shevy> otherwise extending class Fixnum would work
<TTilus> lectrick: without knowing what you are actually trying to put together, id say you might want to use proxy or delegator
<lectrick> shevy: yeah
* apeiros_ repeats: lectrick, make a proxy object.
<apeiros_> Numeric classes in ruby are all immutable. so no chance of doing that with a core numeric.
<TTilus> lectrick: ...but i emphasize the "without knowing" part
<lectrick> apeiros_: yeah that's what I thought
eywu has joined #ruby
<TTilus> lectrick: how about elaborating on what you are doing
<apeiros_> by the use of coerce you can have it easily work like a normal number
<apeiros_> also define to_int to return the value.
<lectrick> TTilus: Nothing specific. I was just thinking of a way to somehow add extra information to return values.
<TTilus> lectrick: you _were_ thinking that for a reason =D
<TTilus> lectrick: and thats something id like to know
SegFaultAX|work has joined #ruby
<shevy> I am only curious why it had to be a singleton method
<lectrick> TTilus: I often want to return extra information from a method, but not have the users of that method notice a difference or have to change the API.
<TTilus> shevy: thats pretty much why im asking whats the dude doing =D
<TTilus> lectrick: such as
<lectrick> So my idea was a variable that looks and acts like a number (or perhaps a string) but has extra attributes or methods on it
<TTilus> lectrick: come on! you _do_ have a case or few in your mind
<shevy> hmm
<TTilus> lectrick: "i often want" is not a reason ;)
<shevy> x = 5
<lectrick> TTilus: Seriously, I am just idly speculating after someone mentioned this tweet about returning multiple values in JS: https://twitter.com/#!/duomark/status/187568501429510144
<shevy> x.class # UnicornInteger
<lectrick> shevy: yeah, how did you do that?
<lectrick> if you did :)
<shevy> lol
<shevy> I am not sure this is possible
<shevy> it would change how the ruby parser assigns variables like that, no?
<TTilus> shevy: yes it would, and you cant override assignment
<shevy> :(
<TTilus> sorry
<lectrick> I guess I could define an object that can be added/multiplied/==/-/"def coerce"/etc. but which is actually an object
mxweas_ has joined #ruby
<lectrick> in every other respect it acts like a simple value
savage- has joined #ruby
<TTilus> lectrick: you'd do something like class RainbowUnicornFixnum < Delegator; ...; end
strife25 has joined #ruby
<TTilus> lectrick: and then ru_two = RainbowUnicornFixnum.new(2)
<shevy> waaaah that is verbose
<shevy> reading that article on fixnums, sounds almost exactly like Symbol ...
<TTilus> shevy: would 2.unicornify float your boat better? =D
Guest__ has joined #ruby
<shevy> "There may exist only one Fixnum instance for a given integer value."
<shevy> TTilus, hmm... perhaps!
<LiquidInsect> shevy: difference being that you can create a Symbol but not a Fixnum
<shevy> but a symbol is always the same too or?
<shevy> Look:
shellox has joined #ruby
artOfWar has joined #ruby
<shevy> x = :hi # => :hi; def x.ok; puts "ok"; end; # TypeError: can't define singleton method "ok" for Symbol
wilmoore has joined #ruby
<lectrick> It looks like Bignums are actually stored by reference but I can't do Bignum.new lol
<shevy> almost the same error message too :)
<LiquidInsect> yeah, a symbol, once created will always be a reference to the Symbol matching its.. name, I guess you'd say?
<lectrick> TTilus: I think it would be an educational/fun exercise to play with delegators.
<LiquidInsect> so if you do foo = :hi; bar = :hi; foo and bar should have the same object_id
ozymandius has joined #ruby
<shevy> so we cant have... singleton methods on Fixnum and Symbols. Anything else where singleton methods can't exist?
<TTilus> shevy: im actually working with a platform of sorts where 2.kg - 1500.g # => Decimal(0.5).kg =D
<shevy> hmm does that work?
<shevy> the 2.kg - 1500.g
<wmoxam> quit
<shevy> though the "2.kg" reads a bit weird
<shevy> or perhaps not
<TTilus> shevy: on that (for the time being) proprietary platform, yes
<shevy> I dont know :\
<shevy> cool
adeponte has joined #ruby
paulmooring has joined #ruby
paulmooring has quit [#ruby]
cbuxton has joined #ruby
yoklov has joined #ruby
g0bl1n has joined #ruby
Houdini has joined #ruby
johndbritton has joined #ruby
<shevy> whoa
<shevy> Dir.entries can not list subdirectories?
<shevy> Dir['*'] seems much more flexible
williamcotton_ has joined #ruby
<gogiel> shevy: ** is recursive
artOfWar has joined #ruby
Araxia has joined #ruby
catphish has joined #ruby
kenperkins has joined #ruby
banisterfiend has joined #ruby
<apeiros_> lectrick: well, you don't even need to know how it works, since you can just delegate it to your value
apok has joined #ruby
cwang has joined #ruby
nlc has joined #ruby
cap10morgan has joined #ruby
<cap10morgan> How do folks feel about this ruby-debug fork: https://github.com/cldwalker/debugger ?
<cap10morgan> it does seem like ruby-debug19 has stagnated...
ringotwo has joined #ruby
<td123> cap10morgan: I just read about it today: checkout the comments on http://news.ycombinator.com/item?id=3797487
<td123> cap10morgan: some ppl seemed to have switched to pry + pry-nav and other solutions which might be good
joaoh82 has joined #ruby
tewecske has joined #ruby
thecreators has joined #ruby
jarred has joined #ruby
<cap10morgan> td123: yeah, looks interesting. though I'm a bit worried about answering a newcomer to Ruby's question: How do I get a debugger? (Well, first you install pry and these other gems, then you use that instead of irb everywhere...)
<joaoh82> hey guys
<joaoh82> I am new to ruby
<joaoh82> so I have kind of a newbie quesiton
zakwilson has joined #ruby
zakwilson has joined #ruby
h4mz1d has joined #ruby
jankly has joined #ruby
<any-key> we don't allow those
<any-key> :P
<apeiros_> joaoh82: skip the boilerplate. ask.
<apeiros_> there's only a few genuinely stupid questions (e.g. "may I ask a question?" :-p)
buschhardt has joined #ruby
buschhardt has quit [#ruby]
workmad3 has joined #ruby
moted has joined #ruby
<any-key> too late
kenichi has joined #ruby
arturaz has joined #ruby
t0mmyvy0 has joined #ruby
ed_hz_ has joined #ruby
pythogorian has joined #ruby
nfluxx has joined #ruby
<pythogorian> hello ruby guys
<pythogorian> :)
brngardner has joined #ruby
<any-key> we prefer to be called "ruby persons"
<pythogorian> sorry :)
adamkittelson has joined #ruby
<pythogorian> i need help
<any-key> just ask
<pythogorian> today i started writing some ruby code
<pythogorian> came from python land
<any-key> off to a good start
<bawer> ruby is pretty
<pythogorian> i like it
<any-key> I much prefer the block syntax over the way python does lambdas
<any-key> but anyways, what's your issue?
<pythogorian> how can i create hash inside hash by referencing
<pythogorian> example:
banisterfiend has joined #ruby
ales has joined #ruby
<pythogorian> n = {1 => 'one, 2 => 'two'}
<pythogorian> great
<any-key> yo dawg, I heard you like hashes
<pythogorian> now
<pythogorian> m = {1=>n}
<pythogorian> says
<pythogorian> m = {1=>nil}
<pythogorian> why nil?
<Mon_Ouie> Because n is nil
<apeiros_> you must have reassigned nil to n in between
moos3 has joined #ruby
<apeiros_> you have a typo in your first hash btw.
nfluxx has joined #ruby
<any-key> yeah I just tried it and it worked
<apeiros_> ruby-1.9.2:007:0>> n = {1 => 'one', 2 => 'two'} # => {1=>"one", 2=>"two"}
<apeiros_> ruby-1.9.2:008:0>> m = {1=>n} # => {1=>{1=>"one", 2=>"two"}}
ales has joined #ruby
r0bby has joined #ruby
<apeiros_> straight from irb (you were missing a ' after 'one')
<any-key> heh beat me to it
<apeiros_> my prompt is better than your prompt!!!
<pythogorian> weird, it didn't work for me
<pythogorian> :/
<any-key> apeiros_: mine says "ruby-1.9.3-preview1 :001 >" but I edited that out :P
QKO has joined #ruby
<any-key> I should update
* any-key runs rvm
<Mon_Ouie> pry(main):12>
n3m has joined #ruby
<any-key> heh I need to force myself to actually *learn* pry
<apeiros_> remins me… I should `alias irb=pry`
<bawer> pythogorian: does that work for you?
<Mon_Ouie> banisterfiend: You've reached the point where Pry is too complicated and that refrains people from using it
<Mon_Ouie> banisterfiend: Congratulations! :p
<pythogorian> bawer, now it works
<pythogorian> thanks
<pythogorian> i didn't see that typo
<pythogorian> :(
<any-key> it happens
<any-key> not closing strings can lead to odd behavior
<any-key> press ^d a few times to be sure :P
<any-key> or when you see the asterisk in the irb prompt when you weren't expecting it :P
<pythogorian> is there any more comfy irb shell app?
<pythogorian> syntax color
<pythogorian> multiline
<pythogorian> etc.
<pythogorian> a bit more*
<any-key> pry
<any-key> it does a whole lot
<gogiel> pythogorian: pry, but it's better to write your code in file
<apeiros_> pythogorian: if you use irb or pry, set up a proper prompt, then you see the typo
<gogiel> pythogorian: rubymine is superb ide
<apeiros_> ruby-1.9.2:009:0>> n = {1 => 'one, 2 => 'two'}
<apeiros_> ruby-1.9.2:010:1'>
<any-key> eh suggesting an IDE is a bit overkill if you ask me
<apeiros_> you see, a) no return value, b) the prompt shows, that you're in an open single quoted string
<any-key> especially a non-free one
<apeiros_> (the '> part)
<gogiel> any-key: it has 30-days free trial and it's not that expensive
<any-key> apeiros_: what settings did you tell irb to use for that to happen?
nev3rkill has joined #ruby
<any-key> gogiel: the one true editor is ED and he should be using that! You all should be using ED!
<any-key> apeiros_: pastebin yo irb config
wilmoore has joined #ruby
<apeiros_> any-key: http://pastie.org/3728128
ringotwo has joined #ruby
<any-key> apeiros_: :D
<any-key> thank youuuu
<apeiros_> yw
ringotwo has joined #ruby
<apeiros_> my irbrc is on github. should probably update it
pizzaBOY has joined #ruby
<pythogorian> btw. first impressions on ruby are great
headius has joined #ruby
<any-key> pythogorian: glad to hear it
<pythogorian> i'll try rails soon
<any-key> Python and ruby both have their advantages, I think it's a great idea to learn both
<shevy> hehe
<shevy> pythogorian... funny name :)
<gogiel> python's main advantage is its library
<shevy> how about ... rubyeder
<pythogorian> shevy, :)
bbttxu_ has joined #ruby
<pythogorian> shevy, thanks
<shevy> python has awesome documentation compared to ruby
<pythogorian> xP
<any-key> apeiros_: what's the IRB.conf[:PROMPT_MODE] = :APERROS about?
<any-key> shevy: dunno about that, I much prefer the ruby docs
<any-key> the python docs are just prose most of the time
<pythogorian> i wanted something new
<pythogorian> exotic
<shevy> but http://docs.python.org/tutorial/ feels coherent, like a book
<pythogorian> i'm writing django to pay my bills
linoj_ has joined #ruby
<apeiros_> any-key: you can switch your prompt
<shevy> it does not matter to me in as much because I keep my own docu in ruby locally
<shevy> but it was a lot of effort
<any-key> apeiros_: I just read up a few lines, that was a dumb question :P
andy_ has joined #ruby
<apeiros_> you can set it e.g. to IRB.conf[:PROMPT_MODE] = :SIMPLE
<apeiros_> :)
<shevy> pythogorian well I think ruby and python are kinda quite similar, insofar that they have a very large overlapping need / use case
<any-key> I just did a :%s/APEIROS/AWESOME/g
<apeiros_> :-p
<apeiros_> I should really rework that .irb_inspect. it was nice, but slightly broken
<shevy> and rails is just magic ** magic ** magic ** END_OF_WORLD
<apeiros_> it avoided superlong return-value outputs
Guest_ has joined #ruby
cousine has joined #ruby
<apeiros_> any-key: https://gist.github.com/923616 full irbrc
<pizzaBOY> /ignore -channels #mwsf *
stringoO has joined #ruby
<any-key> apeiros_: so you don't like the autoindent?
<apeiros_> caution is advised. I occasionally have experimental stuff in it.
<pythogorian> shevy, they are similar, in fact i was able to pick up basic ruby logic in a few hours
<apeiros_> any-key: in irb? yes, somehow it always threw me off
<shevy> cool pythogorian
<pythogorian> i'm writing new lib, just to get feeling
<any-key> hmmm I think I'll try it without and see how I like it
<shevy> I got lazy, I wanted to learn python, but this transition towards python 3.x just annoys me
artm has joined #ruby
<any-key> hmmmmm rvm install 1.9.3 installs 1.9.3 preview 1
nu7hatch has joined #ruby
<any-key> is the the most recent version?
<apeiros_> any-key: rvm get head
<apeiros_> your rvm is outdated
<any-key> apeiros_: thanks
<Gushings1> Anyone knowledgable with ruby reading ruby sockets
<Gushings1> ?
<any-key> the immature part of me just laughed at that command
<any-key> Gushings1: I know a little bit, just wrote something that uses them with select
<Gushings1> Nice, I'm doing something similar
<Gushings1> I used select to get the sockets ready for read
<Gushings1> now I'm trying to use gets to read the line from the socket...
csprite has joined #ruby
<Gushings1> It worked, but I ran into an issue where the line isn't terminated properly (no newline or other ending character) and it tries to read forever.
<Gushings1> as gets is never sure that the socket is finished sending.
<apeiros_> Gushings1: you'll have to do your own buffering in that case
PragCypher has joined #ruby
<apeiros_> sounds like the other side neither sends an EOF
<any-key> are you the one writing to the other socket?
<apeiros_> Gushings1: so how will you recognize that the message is complete?
krz has joined #ruby
<apeiros_> I mean… no EOF, no line terminator…
<Gushings1> No, people can connect with any client they want.
<apeiros_> sounds like a fucked up client…
<any-key> aah
<Gushings1> I'm trying to make the server software robust.
<any-key> I don't know what the Proper Way™ is, but I'd surround the read with a timeout
<Gushings1> I can't be certain the client will do anything properly.
<apeiros_> Gushings1: I'd time-out the connection and disconnect the client
<Gushings1> I looked into timeouts.. potential for lots of lag?
<Gushings1> or should it not be an issue.
<apeiros_> why should it lag?
<any-key> you'll lag, since it blocks
<apeiros_> but you should use non-blocking read on a server
<any-key> yes
<apeiros_> otherwise with a single-threaded select based server, a single client can DOS you
<Gushings1> right, I agree
<Gushings1> I want to keep it single threaded for now
<Gushings1> I found read_nonblock
<Gushings1> I have never used it before.
<Gushings1> any insight?
pokui has joined #ruby
pokui has joined #ruby
kvirani has joined #ruby
stkowski has joined #ruby
shruggar has joined #ruby
<any-key> can't say I've used it
<Gushings1> hm
<Gushings1> It's my intuition that getc() to read chars until there were none left would still block?
daniel_hinojosa has joined #ruby
<any-key> it looks like read_nonblock is what you want though
shift_ has joined #ruby
<any-key> it's like a timeout for the maximum number of characters if I'm understanding it correctly
arturaz has joined #ruby
cousine has joined #ruby
<Gushings1> I think it's just read up to N bytes.
<any-key> yep
arturaz has joined #ruby
<any-key> it should help, although it won't completely fix the problem
mxweas_ has joined #ruby
<any-key> assuming you can set a sane limit for this specific application without screwing other clients over
arturaz has joined #ruby
<Gushings1> I'll just make it very large.
<Gushings1> to test it.
<Gushings1> I can adjust it later.
<any-key> play with it and get a number that doesn't cause too much lag
<apeiros_> any-key: read_nonblock simply returns everything that is in the buffer
<any-key> apeiros_: up to the maxlength
arturaz has joined #ruby
<apeiros_> yes, you can additionally limit it
askTheUser_ has joined #ruby
<Gushings1> Have you used it apeiros
<apeiros_> beware, some versions of 1.9.2 had a bug with the implementation using a buf arg
<apeiros_> Gushings1: sure
arturaz has joined #ruby
gift has joined #ruby
ben225 has joined #ruby
<Gushings1> All I have to do is read some number of bytes that should cover any message received, and catch the EOF, then process the bytes however I want?
<apeiros_> no
<apeiros_> you have to buffer
berserkr has joined #ruby
<apeiros_> until your message is complete
<apeiros_> it reads *up to* maxlength bytes
<apeiros_> which means it can be less, it can be an incomplete message
<Gushings1> I see, I see.
rdegraci has joined #ruby
<apeiros_> and you have to handle the timeout
<Gushings1> So add the bytes to the buffer for the connection, then check if a full message exists yet.
<apeiros_> correct
ballpointcarrot has joined #ruby
<apeiros_> don't forget to rescue the exceptions
<Gushings1> Yeah, I still have to figure out what some of them mean.
nev3rkill has joined #ruby
<any-key> also, do "if select(.....)" so that if select times out and returns nil you don't have an exception
<any-key> that bit me in the ass the other day
<apeiros_> ^^
<Gushings1> I'm doing something equivalent already, but thank you.
<any-key> we got your back :P
<Gushings1> :)
<Gushings1> so, about the timeout
banisterfiend has joined #ruby
<Gushings1> it's not included by the read_nonblock function.
<apeiros_> correct
<apeiros_> there's different ways to implement it
<apeiros_> you could run a prune-loop before the select
c0rn has joined #ruby
<any-key> where can I find a complete list of irbrc options?
<any-key> aka the prompt options and whatnot
<apeiros_> i.e. store the sockets in a double-linked list, along with a "last-read" time
<any-key> not finding anything useful on google :(
<apeiros_> the chop off from the end
<shevy> irb is notoriously underdocumented
<any-key> I'm trying to figure out what %i is
<any-key> aaah I think it's the level of indentation
<any-key> yep, that's it
<Gushings1> hm
<Gushings1> So the thread being readable does not mean it won't timeout.
<Gushings1> not thread, socket.
<any-key> if you read and it never terminates you'll block indefinitely
<any-key> I had that happen yesterday, actually, when talking with a roomba :P
<Gushings1> hahaha what
<Gushings1> niiice
<Gushings1> Did you make that?
<any-key> I haven't updated it...the sensor support is currently being developed as my senior design project progresses :P
<any-key> yep
<Gushings1> That's pretty cool
shruggar has joined #ruby
<any-key> Ruby is good for everything ever
<Gushings1> We have an anybot at my school that roams the halls.
<Gushings1> The software for it is a bit lacking.
<Gushings1> Maybe someday I'll try to follow in your footsteps.
<apeiros_> Gushings1: hu? no, socket being ready for read means something is ready to be read. if you use read_nonblock on it, it will return "immediatly" (it won't block)
<apeiros_> but you have to handle when you want to time out your clients
<any-key> right now I have a "roomba server" set up in my project (not in the library) that listens for clients...there's a separate ClientRoomba class that inherits from the main Roomba class and tells it to write to a socket instead of the serial port
<apeiros_> unless you want to keep bad clients connected indefinitely
<any-key> so I can have multiple processes all talking to the same roomba :D
<shevy> style question http://pastie.org/3728324 what do you prefer? the terse variant without the newlines or the more verbose one with the newlines
<any-key> shevy: the second one, I don't like the whitespace on line two
<any-key> if you got rid of that I'd prefer the first one
delinquentme has joined #ruby
<apeiros_> shevy: terse. I'd write it even terser: some_variable << 'bla' if look_for_more_things
<delinquentme> ok sooo im having some ruby brain melt....
<any-key> uh oh
<Gushings1> I am taking care of checking the clients and removing their connections somewhere else.
mxweas_ has joined #ruby
<shevy> cool thanks
<delinquentme> can I get like a 1 liner on what "base" does?
<Gushings1> Related to the read_nonblock though, I do not need to check for timeouts - Is this correct?
<shevy> base?
<apeiros_> Gushings1: no. only for error conditions.
<any-key> delinquentme: we need some more context as to what "base" is
<shevy> All Your Base Are Belong To Us!!!
<apeiros_> any-key: you still can't read minds? shame on you! OUT!!!
<Gushings1> delinquentme it raises the pH of the program you are writing
<delinquentme> any-key, Gushings1 http://pastie.org/3728337
synk has joined #ruby
<Gushings1> Thank you, apeiros_
<delinquentme> Gushings1, i nedz this.
<apeiros_> delinquentme: it's a local variable
nikhgupta has joined #ruby
<apeiros_> an argument passed to self.included
<apeiros_> and if it is invoked by include, it is the module that received the include method
<apeiros_> i.e., Foo.include Bar will invoke Bar.included(Foo)
<apeiros_> (yes, include is private and you can't just call it as Foo.include)
* delinquentme turns off his screamy music for a sec
<delinquentme> ok so base here.. is just an argument
<apeiros_> delinquentme: yes, clearly visible on line 8 of your paste
<any-key> agh, I just did "rvm get head; rvm reload; rvm install 1.9.3; rvm use 1.9.3 --default" on two different machines
<any-key> never mind
<any-key> fixed
havenn has joined #ruby
<any-key> hmmmm I wonder if I can get my irb prompt to just show "1.9.3" instead of "ruby-1.9.3-p125"
mdhopkins has joined #ruby
bbttxu_ has joined #ruby
<apeiros_> sure
<any-key> I guess the config file is just ruby anyways...
<apeiros_> RUBY_VERSION
smoak has joined #ruby
<apeiros_> though, you totally should use RUBY_DESCRIPTION in your prompt :D
<delinquentme> apeiros_, in this instance ... is 'included' some method i've defined?
<delinquentme> or is that some reserved keyword tied with include
<apeiros_> delinquentme: you really really REALLY should get familiar with core ruby methods
Deele has joined #ruby
<apeiros_> see Module#include - it's like one of the most important methods in ruby.
<superjoe> is there a better way to write these 5 lines? http://paste.pocoo.org/show/576135/
<apeiros_> superjoe: yes
llaskin has joined #ruby
<shevy> I dont even know what these lines do
<shevy> you seem to want to fill some array
<superjoe> the one I care about is 3
<llaskin> https://gist.github.com/ec3e43b551a89094b71a why would this fail on line 3? with an error that says "Invalid next"?
voodoofish430 has joined #ruby
<apeiros_> superjoe: played bionic command?
<delinquentme> apeiros_, im already on a bit of a wild goose chase here while yes ideally i should have read everything im trying to sort out whats going on within *this* instance
<superjoe> shevy, increment a possibly nill array or hash value
<delinquentme> as its all chinese to me as it is
<shevy> still not getting it quite :)
<shevy> your code seems to just make this array [1, 1, 1, 1, 1, 1]
<any-key> llaskin: you aren't in a loop
<llaskin> ...i am
<superjoe> shevy, obviously this is a simplified example.
<delinquentme> nm
<superjoe> apeiros_, nope. sorry. the name is just a random made up nonsense from when I was 12 years old.
<delinquentme> "yes" is the answer i was after
<llaskin> it stopped working right wen I upgraded from 1.8.7 to 1.9.3
<shevy> foo = Array.new(5) {1} # => [1, 1, 1, 1, 1]
<superjoe> I was hoping I could do something like this:
nikhgupta has joined #ruby
cousine has joined #ruby
<superjoe> (foo[i] ||= 0) += 1
<shevy> this boggles my mind, I hope apeiros_ can make sense of it
<superjoe> e.g. not access foo[i] twice
eka has joined #ruby
<delinquentme> which is 138 chars shorter than what you needed to type :D
<shevy> hehehe
<rippa> apeiros_: I liked all bionic commando
<Gushings1> How large are chars in ruby?
<rippa> old, new and rearmed
<shevy> about -> ' ' <- this size
<apeiros_> rippa: I only played the first. no save-game was terrible back then, though (parents didn't allow playing for long continued periods)
brngardner has joined #ruby
<rippa> apeiros_: I played spectrum version
<apeiros_> shevy: with immutables, you can even use the 2-arg form: foo = Array.new(5,1)
<shevy> cool
<apeiros_> rippa: oh? NES one for me
<shevy> I like that more
<llaskin> any-key: any thoughts on it breaking due to a shift from 1.8.7 to 1.9.3?
<shevy> see superjoe, if you wanted to mak an array like that, you can use Array.new :D
<shevy> *make
<superjoe> the goal is to not access foo[i] twice
<superjoe> because in real code, i is more complicated
<rippa> cache i
<rippa> i = complicated
<rippa> foo[i] twice
<any-key> llaskin: no clue
shruggar has joined #ruby
<llaskin> when i run the same script with 1.8.7 its ok
<llaskin> 1.9.3 borks
<apeiros_> llaskin: proc/lambda behavior changed from 1.8 to 1.9. your next is obviously in a place where it's no longer valid.
<Gushings1> read_nonblock(somenumberofbytes) is going to give me a string containing the ascii (?) representations for those bytes. If I'm trying to calculate how much I want to read (lets assume 500 characters) then should I just read 500 bytes and assume they are being represented by 8 bits?
<apeiros_> but ruby already tells you that
<superjoe> ok here's the real code: http://paste.pocoo.org/show/576140/
manuel- has joined #ruby
<superjoe> I feel like that's uglier than it has to be
<apeiros_> Gushings1: 1.9?
<Gushings1> yes.
<llaskin> apeiros_: hrm interesting...i might have to rework a large piece of my code for 1.9.3 compatibility
<apeiros_> hm, interesting question, whether read_nonblock reads bytes or chars…
<apeiros_> docs say bytes
<apeiros_> Gushings1: it depends on the encoding you set on the socket
ozymandius has joined #ruby
<Gushings1> standard TCPServer
zodiak has joined #ruby
<bawer> auperjoe: what error do you get?
<Gushings1> setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1)
<apeiros_> Gushings1: then it'd probably use Encoding.default_external
sohocoke has joined #ruby
askTheUser has joined #ruby
<Gushings1> Ah, I see.
<Gushings1> Interesting.
<apeiros_> Gushings1: just to be clear - String can handle any binary data
<Gushings1> Yes, it just won't make sense if the encoding is wrong.
<apeiros_> but a couple of operations require the data to be valid according to the encoding it states to have
<apeiros_> e.g. gsub will raise if your strings says it was utf-8, but the data contains illegal sequences
<superjoe> bawer, no error, I just think it looks ugly
askTheUser has joined #ruby
<superjoe> wondering if there is a better way to write that
llaskin has quit [#ruby]
<Gushings1> Wait what.
<delinquentme> apeiros_, there is no Module#include
<delinquentme> #included?
<delinquentme> nope
Sailias has joined #ruby
<apeiros_> delinquentme: srsly? want me to put you with the nose into it? :-)
<Gushings1> Given any arbitrary binary string divisible by 8, wouldn't it just be interpreted in sets of 8? It would result in garbage, but it would have some representation, no?
<Gushings1> How would you ever know it was not the intended message?
bbttxu_ has joined #ruby
Morkel has joined #ruby
Brainix has joined #ruby
<delinquentme> plz im missing where its at
<Gushings1> Assuming declared utf-8 encoding
<delinquentme> this is my first time working with modules
<apeiros_> though this documentation is *horrible*. my god… such an important method, such sucky documentation :(
cbuxton has joined #ruby
<rippa> Gushings1: because not every byte sequence is valid utf-8
kirun has joined #ruby
<delinquentme> whats messing me up is Klass.send(:include, FooModule) .. this says "include"
<delinquentme> whereas the method being called is .included
<apeiros_> delinquentme: if you'd properly read…
<apeiros_> 19:58 apeiros_: i.e., Foo.include Bar will invoke Bar.included(Foo)
<Gushings1> Ah, okay.
<Gushings1> I never knew that.
<Gushings1> I thought there was some default representation that filled all spare slots.
<Gushings1> :)
sectionme has joined #ruby
<Gushings1> Alright, I have to go to robotics.
<delinquentme> apeiros_, so there is some magic ruby linking going on between include and included
<apeiros_> Gushings1: there's a couple of byte-sequences that are just not allowed in utf-8
<Gushings1> Thanks for the help everyone
<Gushings1> I'll be around.
<delinquentme> Gushings1, what robots are you building
<apeiros_> Gushings1: in a single byte encoding, that'll never be the case, of course
linoj has joined #ruby
<apeiros_> delinquentme: nothing magic. it's just a callback.
<apeiros_> hook.
<Gushings1> We are building robots from scratch with a brainstem microcontroller.
<Gushings1> three 180 degree servos for locomotion
<delinquentme> Gushings1, ima track u down later we need to talk
<delinquentme> << open source robotics
<apeiros_> bah, that's ancient technology… brainstem micros… pfffff
<apeiros_> :)
strife25 has joined #ruby
<Gushings1> Working with robot vision, SLAM, etc.
<Gushings1> :)
<Gushings1> see you all!
<apeiros_> cya
tommyvyo has joined #ruby
carlyle has joined #ruby
phantomfakeBNC has joined #ruby
JohnBat26|2 has joined #ruby
workmad3 has joined #ruby
b26 has joined #ruby
smoak has quit ["WeeChat 0.3.7"]
phantomfakeBNC has joined #ruby
gomix has quit [#ruby]
williamcotton has joined #ruby
alaska has joined #ruby
<cap10morgan> anyone know how to eval a variable in pry whose name conflicts with a command? so, for example, if I have a local var named "step", how do I ask pry for its value?
eldariof has joined #ruby
<cap10morgan> in ruby-debug, I would use "eval step"
<Gushings1> blah nevermind
<Gushings1> My favorite class was canceled. ;(
askTheUser has joined #ruby
<Gushings1> Is there any issue with using read_nonblock with a byte size of say 500?
<Gushings1> I don't think there should be
tatsuya_o has joined #ruby
artm has joined #ruby
nikhgupta has quit [#ruby]
jcromartie has joined #ruby
<rippa> cap10morgan: put a space before it
Liothen_ has joined #ruby
looopy has joined #ruby
<cap10morgan> rippa: *forehead slap* thanks for suggesting the simple and obvious thing I didn't try. :)
codezombie has joined #ruby
xybre has joined #ruby
ben_m has joined #ruby
s has joined #ruby
williamcotton_ has joined #ruby
<shevy> cap10morgan banisterfiend should know
<cap10morgan> shevy: rippa was all over it. putting a space before it work beautifully.
wallerdev has joined #ruby
cousine has joined #ruby
bawer has quit ["Leaving"]
bawer has joined #ruby
<shevy> I see
KL-7 has joined #ruby
<ben_m> Hey everyone. I just installed Ruby 1.9.3 via the windows installer, then installed ruby-processing via gem, but I get "file not found" errors when trying to run the samples.
schovi has joined #ruby
williamcotton_ has joined #ruby
bbttxu_ has joined #ruby
strife25 has joined #ruby
hzlocky has joined #ruby
<hzlocky> Guys, is there anyway to define method with name [][](first_arg, second_arg) in my class?
axeman- has joined #ruby
<Gushings> def [][](first_arg, second_arg)
<Gushings> #code
<Gushings> end
<Gushings> ?
<Gushings> Does that not work?
askTheUser has joined #ruby
yoklov has joined #ruby
<hzlocky> obviously nope
buschhardt_ has joined #ruby
buschhardt_ has quit [#ruby]
<Gushings> What is the error?
jbw has joined #ruby
<hzlocky> syntax error, unexpected '[', expecting '\n' or ';'
axeman- has quit ["Leaving"]
nlc has joined #ruby
<jlogsdon> hzlocky: exactly what it says. look at the line it references, make sure aren't missing something (maybe a closing paren or bracket)
<jlogsdon> oph wait
<jlogsdon> sorry, i didn't see your message at 15:19.
davidpk has joined #ruby
<hzlocky> yep
neersighted has joined #ruby
shadoi has joined #ruby
williamcotton_ has joined #ruby
<Gushings> hzlocky , check out this stackoverflow page
matthewvermaak has joined #ruby
<hzlocky> That ruines logic of method
pokui has quit [#ruby]
zunnyohn1 has joined #ruby
becom33 has joined #ruby
scientes has joined #ruby
Drewch has joined #ruby
<becom33> Im getting a error http://pastie.org/3728815 test.rb:1: syntax error, unexpected keyword_def, expecting '<' or ';' or '\n'
<becom33> res = fi...d)
williamcotton_ has joined #ruby
<shevy> what you show there works for me becom33
Guest19404 has joined #ruby
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
Gm4n has joined #ruby
mrsolo has joined #ruby
<becom33> shevy sor somereason
<becom33> for 8
<becom33> btw Im on windows now :/
ales has joined #ruby
<Gushings> This is really bothering me.
justinmcp has joined #ruby
hooper has joined #ruby
<becom33> anybody has any idea why am I getting that error ?
mxweas_ has joined #ruby
<shevy> becom33 again there is no error
masolino has joined #ruby
hydrozen has joined #ruby
<becom33> maby somthing is wrong with windows ?
<n1x> hi, i'm getting encoded data if I use this -> html = open('http://data.iplt20.com/core/cricket/2012/ipl2012/ipl2012-01/scoring.js', 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.2; rv:9.0.1) Gecko/20100101 Firefox/9.0.1').read
<n1x> but going to that page from web browser gives me json outpu
<canton7> becom33, how are you calling that script?
dch4pm4n has joined #ruby
<n1x> how can I retrieve that data as json?
<dch4pm4n> Anyone know why it takes linecache19 with native extensions so long to install?
<becom33> I have ruby console on windows
<canton7> becom33, define "ruby console". irb?
<shevy> becom33 please. you linked this: http://pastie.org/3728815
<shevy> I saved this. I ran it. There was no error in ruby.
<shevy> It does not matter whether you are on windows or not. That code in that pastie is valid ruby code.
<becom33> in my menu I have "start command prompt with ruby"
<shevy> then this is the reason for the error
<becom33> umm ?
<becom33> just typing ruby doesnt work on prompt
<canton7> n1x, looks like a character encoding issue?
<canton7> becom33, once you click on "start command prompt with ruby", what do you do next?
<n1x> canton7, what can I do?
h4mz1d has joined #ruby
<shevy> becom33 works for me here
<n1x> canton7, i meant any pointers where should I proceed.. i have no clue what to do next
<shevy> becom33 you could also try the poor man approach. copy the .rb file to /
<shevy> then start cmd.exe
<shevy> and do "ruby -w *rb"
<shevy> and you will see that no error occurs
entrenador has joined #ruby
<canton7> n1x, ooh, it's gzip-encoded
<Gushings> hzlocky
<becom33> shevy did u mean C:/ by / ?
<Gushings> defining [](some index) should allow you to double index.
<shevy> becom33 yeah
<shevy> simply go to /
dbgster has joined #ruby
askTheUser has joined #ruby
tatsuya_o has joined #ruby
thys has joined #ruby
alx- has joined #ruby
<becom33> shevy
<becom33> c:\>ruby test.rb
<becom33> test.rb:1: syntax error, unexpected keyword_def, expecting '<' or ';' or '\n'
<becom33> res = fi...d)
<becom33> ^
<n1x> canton7, and how can I decode that? (possibly reference links?)
<becom33> sorry for the flood ://
manizzle has joined #ruby
askTheUser has joined #ruby
askTheUser has joined #ruby
askTheUser_ has joined #ruby
<shevy> becom33 look at your pastie
klip has joined #ruby
chimkan_ has joined #ruby
<shevy> your pastie does not have this line:
<shevy> res = fi...d)
<shevy> so what file are you running at all?
Russell^^ has joined #ruby
<shevy> it definitely is not the one you showed in the pastie :(
<Gushings> lol
<Gushings> maybe wrong directory?
thys has quit ["Leaving"]
<shevy> I think becom33 is drunk
<shevy> this is the pastie http://pastie.org/3728815
idiocrash has joined #ruby
<canton7> n1x, Zlib::GzipReader.new(open(<url>)).read worked for me. Not sure if there's a nicer way
<idiocrash> hi guys, how can I convert a timestamp from javascript like "Tue, 03 Apr 2012 18:52:32 GMT" into "YYYY-MM-DD HH:MM:SS"?
artOfWar has joined #ruby
<n1x> canton7, thanks a lot! I just want it to work! that's it! :)
<canton7> n1x, that's failing randomly for me
<shevy> idiocrash, try:
<shevy> your_date = Date.parse "Tue, 03 Apr 2012 18:52:32 GMT" # => #<Date: 4912041/2,0,2299161>
<shevy> your_date.year # => 2012
<n1x> canton7, yeah it happened with me, when i was trying that url with wget
<canton7> n1x, also, that looks like jsonp, not json, so you'll have to do a bit of parsing before you can json-decode it
wilmoore has joined #ruby
shadoi has joined #ruby
<n1x> canton7, oh. okay i'll look into that.. thanks for your valuable suggestions
kpshek has joined #ruby
<becom33> shevy Im sure thats only file I have in my compuer
<becom33> computer*
headius has joined #ruby
savage-_ has joined #ruby
<becom33> I was scripiting on linux before, wanted to check on windows
<shevy> that is cool becom33 but
<shevy> the pastie you showed contains no "res = fi...d)"
netrealm has joined #ruby
<lectrick> apeiros_: I took a stab at doing this myself without a Delegate and got it to work. https://gist.github.com/2305169 Do you know how I could use Delegate to do that better? (feel free to edit gist)
Teddy2steper has joined #ruby
punkrawkR has joined #ruby
<n1x> canton7, it doesn't fail, if you add User-Agent. :)
sarpanch1 has joined #ruby
<canton7> n1x, hrm, I did have a user-agent in there
Eldariof-ru has joined #ruby
greenarrow has joined #ruby
apeiros_ has joined #ruby
<apeiros_> lectrick: you're doing way too much IMO
johndbritton has joined #ruby
<Gushings> I am not well versed in catching ruby exceptions
<apeiros_> *rescuing
<apeiros_> catch has a different meaning
<Gushings> *rescuing.
<Gushings> Let's suppose I had a group of exceptions that all had the same parent class.
<Gushings> Could I rescue the parent to cover all of them?
<lectrick> apeiros_: I know :( I want to do it better
<apeiros_> Gushings: yes
<Gushings> EX: Errno::EWOULDBLOCK, Errno::EINTR
<apeiros_> rescues work hierarchically
<Gushings> can I rescue Errno
<Gushings> okay, great.
<apeiros_> you can also use rescue a,b,c => exc
<apeiros_> i.e., rescue many in a single rescue clause
<apeiros_> lectrick: minute
<Gushings> Yeah, I figured that one out :)
wilmoore has joined #ruby
nerdy_ has joined #ruby
ringotwo_ has joined #ruby
<rking> Is there a doc that helps you transition from PCRE to "R"CRE? Somebody has probably made a doc that highlights 100% of the differences.
mxweas_ has joined #ruby
<apeiros_> lectrick: http://pastie.org/3729135 passes your tests
<apeiros_> rking: you mean RRE? :)
<rking> apeiros_: Yeah, I think so.
<becom33> in this script http://pastie.org/3729147 , im getting this error c:\>ruby test.rb
<becom33> test.rb:1: syntax error, unexpected keyword_def, expecting '<' or ';' or '\n'
<becom33> ... end print "hello"
c0rn has joined #ruby
<rking> lectrick: Hrm, that has some stuff, yep. Maybe the document I'm looking for doesn't exist (in which case I'll write it if I end up finding it something that is needed).
<becom33> sorrry wrong error
<becom33> c:\>ruby test.rb
<becom33> test.rb:1: syntax error, unexpected keyword_def, expecting '<' or ';' or '\n'
<becom33> e... end puts "hello"
<becom33> ^
<becom33> thats the right one
<becom33> sorry if im flooding :/
<rking> becom33: You could've put it in the pastie, sure.
Teddy2steper has joined #ruby
<apeiros_> becom33: I think the code you pasted and the syntax error don't belong together
<apeiros_> you sure you edit the right file?
<becom33> apeiros_ yes Im sure
<rking> I agree. That code works fine.
<rking> I wonder if there is an \r\n issue somehow? Does Ruby handle mixed \n and \r\n's?
netrealm has joined #ruby
<becom33> rking Im sure it will work fine in linux , Im on windows , maby I have to setup the path for ruby execute ? in the 1st line
<apeiros_> becom33: I'd double check. that code is fine.
<becom33> coz it gives a 1st line error right ?
<apeiros_> becom33: no, your error is coming from the ruby interpreter
<apeiros_> so windows finds your executable
<becom33> :/
<apeiros_> remove everything from the file and run it again
<apeiros_> if the syntax error still persists, you're definitively editing the wrong file.
<lectrick> apeiros_: I will study it. Is there any way (or even any advantage) to have it use BasicObject instead of Object?
<becom33> apeiros_ no Im editing the right file , i changed puts in prints . still Im getting a error
<apeiros_> there is a way. just replace Object with BasicObject
<becom33> print *
<rking> becom33: That's not doing what he said.
<apeiros_> lectrick: I don't like BasicObject as it kills off all introspection
<apeiros_> becom33: that's pointless.
<apeiros_> anyway, bottom line is: that code is syntactically correct, for both, 1.8 and 1.9. \n vs. \r\n should not be an issue.
<becom33> apeiros_ bur that mean Im editing right file
<apeiros_> your problem lies elsewhere.
<rking> becom33: How in the world does it demonstrate that? If anything, it's evidence to the contrary.
<becom33> apeiros_ thats the problem . I tried same thing on Interarctive ruby prompt , it works fine in it
<becom33> but on the script I dnno :/
greenarrow has joined #ruby
* apeiros_ will wait how long it takes becom33 to figure out how he got the wrong file
<becom33> rking Im sorry I dnt undertand your question
badabim has joined #ruby
<rking> Is there a paste server that lets you upload text files directly?
<becom33> apeiros_ help me find the right file
<apeiros_> anyway, if you don't want to follow suggestions, I don't see a reason to waste my time.
<apeiros_> what for? you ignore what I say.
<becom33> no I didnt . explain me
* apeiros_ goes back reading his book
<rking> becom33: He said to blank out the file then re-run.
<becom33> aghh
<becom33> wait wait
<shevy> we always wait
<becom33> so I ran a blank file it doesnt give me anything
simao has joined #ruby
<shevy> write:
<rking> becom33: OK, so you have the right file. =)
<shevy> puts 'hello world'
<shevy> and rerun
<shevy> hurry!
<becom33> shevy without any classes ?
<shevy> YES
<shevy> dont ask back
<shevy> DO IT!
<shevy> error or no error now?
<becom33> test.rb:1: syntax error, unexpected keyword_return, expecting $end
<becom33> return
<rking> What in the world??
<shevy> and the content is
<shevy> puts 'hello world'
<shevy> ?
<shevy> only one line?
sectionme has joined #ruby
<shevy> and it gives this error?
<becom33> and return ?
<shevy> where does "return" come from
<shevy> Where is return
<rking> Hehe
<shevy> who told you to write return
<rking> He said "and rerun"
<becom33> awww lol
<shevy> MAN
<shevy> :(
<shevy> becom33, you wear glasses right?
<shevy> your eyesight must be horrible :(
<becom33> shevy I misundertud what U said :P
<shevy> no no
<shevy> it is not the first time
<shevy> you do not look at things
<becom33> when u said return that why I asked without classes ?
<becom33> :P
<canton7> return has nothing to do with classes....
<shevy> well, you added return
<becom33> ok anyway it prints hellworld
<shevy> ok GOOD
<shevy> next step
<shevy> add
<shevy> class Test
<shevy> end
<shevy> Test.new
<shevy> and you put the hello world inside the class
<shevy> run!
<rking> becom33: I'm starting to wonder if you hadn't saved the text you pastie'd.
<shevy> faster faster
<shevy> yeah rking
<becom33> c:\>ruby test.rb
<becom33> test.rb:1: syntax error, unexpected keyword_end, expecting '<' or ';' or '\n'
<becom33> endss Test
<rking> shevy: You can't rush art.
<shevy> becom33, what is your code
<shevy> can you put on pastie
<becom33> I ensure you there is no endss
<shevy> the code in test.rb
ringotwo has joined #ruby
gen0cide_ has joined #ruby
<shevy> the code in test.rb
<becom33> class Test
<shevy> upload to pastie.org !!!
<shevy> no no no pastie.org
<becom33> :/
* canton7 waits in suspense
<shevy> pastie.org
<shevy> pastie.org
<shevy> pastie.org
<shevy> !!!
<bawer> haha
<rking> I, too, find this task urgent and exciting.
<shevy> waaaaait
<shevy> you forgot
Yu\2 has joined #ruby
<rking> That should compile fine, though.
<shevy> yes
<shevy> that too
<becom33> but gives a error
<shevy> you do not use the ruby parser becom33
<shevy> no
<shevy> you use something else
<shevy> you use bogus parser
<shevy> even on windows
<becom33> link ?
<shevy> I can assure you
wefawa has joined #ruby
<shevy> when I am on windows, and invoke this code
<shevy> I get not the error you showed!
ringotwo has joined #ruby
<shevy> I get no result on windows
simao_ has joined #ruby
<rking> shevy: A bogus parser? There are such things?
<shevy> becom33, the code would have been this http://pastie.org/3729226 btw
<becom33> but on that empty class I get a error . btw whats a bogus parser ?
<shevy> and it prints out hello world
<shevy> rking, the parser he invokes is not running that file
<shevy> some magic is happening
<shevy> <becom33> endss Test <--- what is this by the way
<shevy> endss Test?
<shevy> is that your typo? :)
<becom33> shevy thats error I got on the empty class
<shevy> that is odd
<becom33> no pasted you the exact thing what I had in my script
<becom33> btw shevy your script gives me a error too
<lectrick> apeiros_: good points on introspection. this is a lot cleaner but i'm not 100% sure why it needed 2 levels of class hierarchy to implement this way...
<shevy> yeah, something is going on somewhere
<canton7> becom33, what's the output of ruby --version ?
<shevy> becom33 what error?
<rking> My suspense/excitement is dropping as I start to expect there is no solution in sight.
<shevy> rking hehehe I feel we are GETTING CLOSER
<becom33> ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
<shevy> aha
<rking> Aha?
<shevy> :(
<shevy> rking, I tried to keep you on board :(
<becom33> ummm am I missing somthing ?
<shevy> yeah
<rking> Oh, not "Aha" as in "Eureka", but "aha" as in "Oh, I see."
<shevy> why does "endss Test" occur?
<shevy> syntax error, unexpected keyword_end, expecting '<' or ';' or '\n'
<shevy> how can this happen
<shevy> that makes no sense
<becom33> shevy yea thats why Im saying
<rking> shevy: There hasn't been /a ton/ of sense-making going on in the last 10 minutes.
<canton7> I tested 1.9.3p125 with unix line endings, and it was fine. I'm suspecting p0 isn't
rdegraci has quit [#ruby]
waxjar has joined #ruby
<becom33> but there is this command called 'more' in windows . its somthing like cat in linux
<shevy> and how would 'more' help you ...
<canton7> becom33, what are you using to write/edit your file?
<shevy> the ruby parser you use is doing something funky OR
<shevy> you invoke it incorrectly
<becom33> canton7 notepad++
<shevy> how or where do you invoke it?
<canton7> error reproduced if I don't put a linebreak after "class Test"
<shevy> aha
<canton7> becom33, go to edit -> EOL conversion. Which option is greyed out?
<shevy> so it all is one line at becom33
<shevy> becom33, the ruby parser thinks it is one huge line
mattyoho has joined #ruby
<shevy> Test.newhello world'
<shevy> yeah
<shevy> it eats things
<shevy> where is puts?!?!?!
simao has joined #ruby
<shevy> it ate bytes
<shevy> it is like pacman
<becom33> canton7 I didnt undertand . you want me to type EOL in the editor ?
<becom33> shevy but the script has puts
<Boohbah> using ruby on windows is an exercise in futility
<canton7> becom33, in notepad++, click on "Edit", up on the menu bar, next to "File"
<shevy> becom33 yeah somehow it eats characters
<canton7> now, one of the options in that list is "EOL Conversion". Hover over it
vootey has joined #ruby
<shevy> bad bad editor to do this!
<canton7> Boohbah, works pretty good for me
<shevy> and I used to think notepad++ is good
<Boohbah> canton7: you are braver than me :)
<canton7> to be fair, it does print the line endings in the bottom right
<canton7> Boohbah, Bundler is the only thing which has caught me out with windows dev
<shevy> bah
<becom33> ok I did windows format . I guess thats what you wanted me to do ?
<shevy> you are an expert canton7
<shevy> becom33, you could try another editor :)
<canton7> that, or too novice to have run into some of the worse errors :P
<becom33> holy freaking gave . now it works :o
<shevy> an editor that does not steal your characters
<canton7> becom33, that's cool. Now, try running the script again
<shevy> so it was your editor!!!
<canton7> becom33, cool. Line endings problem. Either make sure you're using windows line endings, or upgrate to p125
<becom33> lol I guess so
<becom33> :/
<shevy> http://www.geany.org/Download/Releases even has windows binaries
<shevy> though
<canton7> sublime text 2 :D
<shevy> notepad++ has more features on windows than geany
<canton7> rking, tense enough ending for you? :)
waxjar has joined #ruby
<shevy> he fell asleep :(
<becom33> man I love you guys . shevy canton7 :*
<shevy> I think he wanted some murder and bloodscene
<shevy> but we are all alive
strife25 has joined #ruby
<canton7> a la http://bash.org/?4281 ?
<shevy> yeah
<shevy> he'd be a rich man by now :)
<canton7> man it's been years since I was on bash.org
<rking> canton7: I don't fully understand it. What was the exact byte string coming out, before?
<canton7> rking, the lines were ending with \n instead of \r\n. That particular windoes ruby version wasn't liking this, and was ignoring the line endings, and tripping up as a result
<canton7> on my box, p125 handles \r line endings on a windows machine just fine, so it must be one of the things they patched up pretty quickly
<becom33> in windows ir is deffernt that linux the way its requires ? when I require a file it gives me
<becom33> canton7 what is that gits ruby paste link ? it give a optons to add two separate pastes ?
<shevy> no it is not different
<shevy> it works on linux, it works on windows
<canton7> becom33, what?
<rking> By the way, for the record: [14:27] <rking> I wonder if there is an \r\n issue somehow? Does Ruby handle mixed \n and \r\n's?
<shevy> hahaha :)
<canton7> rking, well spotted!
<rking> There is a record, right? And so far my score is 1 for 1, right?
williamcotton_ has joined #ruby
<shevy> you got lost in the amount of line noise rking
<canton7> rking, can we buy you a megaphone and shouting rights?
<rking> canton7: Oh, I need neither to be a loud person.
<canton7> rking, for becom33's sake, please be as noisy as you can in similar situations in the future haha :P
<becom33> canton7 now I checked on that windows things . its selected on the script
Indian has joined #ruby
<canton7> becom33, by default, LOAD_PATH doesn't include the current directory. You've got the option of using require_relative or adding the current dir to $LOAD_PATH
<becom33> aww how can I do that
williamcotton_ has joined #ruby
<canton7> becom33, option 1 is to use require_relative 'core' instead of require 'core'
<becom33> aghh ok
<becom33> hay that works
<becom33> btw canton7 even in liunux does require_relative works ?
<becom33> insted of require ?
<canton7> becom33, yup. It's a 1.9-thing only, though, I believe
<becom33> canton7 i see . it someone is using older version than 1.9 ?
nu7hatch has quit [#ruby]
<canton7> classic haha ^^
<becom33> shevy ha ha lol
<becom33> so u do python as well ? good :)
<bawer> hahaha! lol
<canton7> http://bash.org/?514353 is one of my favourites
schovi has joined #ruby
<shevy> hehe
<shevy> googling for the splat operator in ruby is hard too when you dont know it is called splat
simao has joined #ruby
<lectrick> apeiros_: Also for the record, I love having an inline test for a class file I'm working on
vootey has quit ["Konversation terminated!"]
td123 has joined #ruby
clockwize has joined #ruby
becom33 has joined #ruby
rexbutler has joined #ruby
<rexbutler> Does anyone here know why RedCloth automatically surrounds everything with <p> tags?
thone_ has joined #ruby
<canton7> rexbutler, define 'everything'
askTheUser has joined #ruby
senthil has joined #ruby
becom33 has joined #ruby
<senthil> How do I make this code work? https://gist.github.com/2305735
<shadoi> rexbutler: it's just normal textile output
<rexbutler> canton7, shadoi: Can I use redcloth inline?
deobald has joined #ruby
<shadoi> senthil: explain what you're trying to do
<senthil> Is there a send equivalent for Constants?
<shadoi> senthil: because that makes no sense at all
<rexbutler> one second, let me check something, make sure there is no CR in the text I'm sending it
<banisterfiend> senthil: const_get
<senthil> shadoi: oops, see https://gist.github.com/2305735
mxweas_ has joined #ruby
<shadoi> "dynamically dispatch"? you want to define constants at runtime? Module.const_set
<canton7> rexbutler, again, define 'inline'
<senthil> banisterfiend: that works, thx!
askTheUser_ has joined #ruby
<senthil> shadoi: not define, get them
OomElvis has joined #ruby
<rexbutler> canton7: I mean, inside a div or paragraph without making a span
<rexbutler> canton7: For example, to italicize something inside a paragraph
De`off has joined #ruby
<shadoi> senthil: I guess I assumed you'd use Forwardable and delegation for this sort of thing. Seems like reimplementing it.
<canton7> rexbutler, I'm afraid that isn't clear. Are you just asking for redcloth output which isn't wrapped in <p> tags?
<rexbutler> canton7: Yes... that's it
<rexbutler> Thanks for the help, btw
<rexbutler> :)
atmosx has joined #ruby
<senthil> shadoi: except i don't know which constants are available till runtime
Foxandxss has joined #ruby
<shadoi> senthil: just curious.. what's the scenario that requires this?
OomElvis has quit ["Leaving"]
williamcotton_ has joined #ruby
<shadoi> I used to do something similar but it turned into a big mess.
<senthil> shadoi: dsl for creating google api wrappers
<canton7> rexbutler, http://www.ruby-forum.com/topic/175551 maybe?
<rexbutler> canton7: I just found this thing that says if it starts with a space...
<Gushings> Are regex expressions greedy in ruby?
<burgestrand> Gushings: yes
<shadoi> senthil: right, I did the same thing for the vcloud API, I found that using a DTD or schema document to generate classes was FAR more sane.
<senthil> shadoi: https://gist.github.com/2305813; my readme file
<rexbutler> canton7: I'll have to look at that also
<senthil> shadoi: how so?
<burgestrand> Actually, I don’t know if there’s a way to make them ungreedy. The PCRE method of ?’ing or +’ing the quantifiers certainly don’t make an effect for me.
<shadoi> senthil: so you know ahead of time what classes you're going to create and you can define an API for them before runtime.
shruggar has joined #ruby
<burgestrand> … never mind, I’m full of it. They work well.
<burgestrand> Or rather, ?’ing the quantifiers work well.
jitesh_shetty has joined #ruby
<senthil> shadoi: if i stick to just google api wrappers, then yea. i was hoping it could be useful for any RESTful api
shruggar has quit [#ruby]
macroevolve has joined #ruby
<lectrick> Can someone explain the reasoning behind methods that end in ! returning nil or false (instead of the receiver) if the receiver is unchanged by the call? (not criticizing just wondering)
maletor has joined #ruby
<senthil> lectrick: maybe so you can do "if changed!"
<shadoi> senthil: that's defnitely a hard problem to solve cleanly. I gave up and put HATEOAS indexes on all my REST APIs.
<wefawa> lectrick: ! methods intend to modify the receiver... not to query it...
<shadoi> senthil: makes generating a client API very simple.
<canton7> or if (new_object = changed!)
<canton7> (for those that happen to like that sort of thing)
<lectrick> senthil: wefawa: all decent points
askTheUser has joined #ruby
atmosx has joined #ruby
<senthil> shadoi: doesn't HATEOAS just define where/how to get resource/action?
<rexbutler> BTW, is there a minification library for Ruby, or even better also a source formatting library? My sinatra apps 'view source' is so full of whitespace it's a disaster
<shadoi> senthil: so there's using it in each resource, and then there's having an INDEX resource that lists ALL available resources and actions.
<shadoi> theoretically if you design it properly you can discover the whole API by walking resource links.
<shadoi> I prefer an index
<senthil> shadoi: and it has all the info? request verbs, params? etcs.
<shadoi> yeah
Squarepy has joined #ruby
<shadoi> I basically used something similar to the "rake routes" tool in Rails to generate mine.
<shadoi> for Sinatra
Squarepy has joined #ruby
<senthil> shadoi: interesting...you could essentially have the api create a wrapper for itself
<shadoi> yup
<senthil> thats freaking awesome!
<shadoi> senthil: I went down the path you were taking and realized it was HAIRY :)
<senthil> shadoi: i bet!
<senthil> shadoi: i've never seen a "big" api use it? do you know of any that does?
<senthil> by big i mean fb, twitter, google, 4square etc.
<shadoi> senthil: none of the big ones sadly
<shadoi> senthil: well, actually I haven't checked in a while
artm has joined #ruby
askTheUser has joined #ruby
supergiantrobot has joined #ruby
carloshpf has joined #ruby
<senthil> shadoi: bummer; thx for the info!
<senthil> back to work
supergiantrobot_ has joined #ruby
<rking> Wow. I looked at every one of http://en.wikipedia.org/wiki/Comparison_of_pastebins ... and there really is a need for a file-upload version of a paste site. One because it's inconvenient sometimes to do the open/copy/paste step, and two so we could solve problems like the \r one before.
<rking> And also someone needs to spend 30mins and scrub that list for dead links. I might do it at some point.
<shadoi> rking: there are TONS of tools to automate posting to various paste sites
<shadoi> pry being my favorite.
<rking> shadoi: Is there a web page that I can say, "Go here, then click the file picker widget, then click Upload"?
<rking> shadoi: Pry's gist feature is hot, yes.
brngardner has joined #ruby
<shadoi> I think a file browser upload feature is overkill, but … *shrug* I'm sure some would prefer it.
mxweas_ has joined #ruby
TNTechnoHermet has joined #ruby
<shadoi> it'd probably result in people uploading a shitload of stuff they didn't mean to though
<shevy> p0rn
TNTechnoHermet has joined #ruby
ghvandoorn has joined #ruby
Guedes has joined #ruby
Deele has joined #ruby
artm has joined #ruby
<rking> shadoi: I don't think so. People on #blender use http://pasteall.org/blend all the time. Like every 5 mins.
mengu_ has joined #ruby
mengu_ has joined #ruby
<shadoi> rking: so.. why not just use that?
<rking> shadoi: Because it only allows .blend and .py at that URL, then only .png and .jpg at the image URL.
<shadoi> oh.. weird
TNTechnoHermet has quit [#ruby]
<rking> shadoi: I guess I could tell the user to rename their .rb to .blend and use that. =D
<rking> Actually, that's the best solution I have at the moment.
<shadoi> you'd think it'd allow any file type they support
saster has joined #ruby
savage- has joined #ruby
apok has joined #ruby
Jake232 has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
niku4i has joined #ruby
_adeponte has joined #ruby
askTheUser has joined #ruby
askTheUser has joined #ruby
askTheUser has joined #ruby
leynos has joined #ruby
alex__c2022 has joined #ruby
askTheUser has joined #ruby
entrenador has joined #ruby
apok has joined #ruby
apok has joined #ruby
mxweas_ has joined #ruby
<shevy> dumdedum
leprosys has joined #ruby
<shevy> hmm
<shevy> an INI file is basically a file with:
<shevy> [foo]
<shevy> blabl
<shevy> ble
<shevy> [bar]
<shevy> ble
<shevy> blue
<shevy> ?
<shevy> because that would be very trivial to parse
raz has quit ["Leaving..."]
dbgster has joined #ruby
ttm has joined #ruby
<bounce> there's also =, spaces in tags (for some parsers), and values trickery
mattyoho has joined #ruby
keymone_ has joined #ruby
<shadoi> shevy: there are plenty of example INI parsers out there.
<shadoi> there's a few others
nlc has joined #ruby
willb has joined #ruby
<shevy> nice
lkba has joined #ruby
ttm has quit ["Leaving..."]
GoogleGuy has joined #ruby
ben225 has joined #ruby
LBRapid has joined #ruby
EzeQL has joined #ruby
yoklov_ has joined #ruby
<ReinH> oh god ini
<ReinH> the stupidest file format of all time
davidcelis has joined #ruby
<ReinH> puppet makes me so sad for having to maintain an ini parser >:(
tatsuya_o has joined #ruby
d2dchat has joined #ruby
<apeiros_> ReinH: hu? an ini parser should be like… 20 lines in ruby?
<frontendloader> anyone use celluloid? How do you gracefully terminate a supervised actor?
<ReinH> apeiros_: you would think
<apeiros_> I wrote one, so yes, that's what I think :)
<apeiros_> (and that's even like 6y ago…)
<monokrome> What does the [] operator do in an example such as: "some string here"[/^A([a-z])+/, 1]
<monokrome> specifically the 1 part
<shevy> monokrome not sure it looks like a regex
<shevy> perhaps it captures the first match
<shevy> in between the ()
<monokrome> oooh
<monokrome> I understand the regex, but I think you are correct on the 1 part
<monokrome> Thanks
andrewhl has joined #ruby
<monokrome> Yep! Testing agrees. Thanks, shevy,
wallerdev has joined #ruby
tommyvyo has joined #ruby
<apeiros_> monokrome: you are aware, that there's API documentation for ruby?
phinfonet has joined #ruby
<phinfonet> hi
<apeiros_> e.g. `ri 'String#[]'` in your shell
<monokrome> Yes, of course. However, I am unaware of if that would be a "string" thing or a language feature
<apeiros_> or rdoc.info, or ruby-doc.org
<monokrome> operator overloading ftl
<phinfonet> in here have persons that utilize bowline?
<apeiros_> monokrome: almost everything in ruby is a method
<apeiros_> in that regard
<apeiros_> i.e., +, -, *, ** are all methods
<monokrome> Right
cousine has joined #ruby
<monokrome> Operator overloading just makes things confusing for newcomers :)
<apeiros_> there's only very few true operators/syntax elements (and, or, &&, ||, defined?, ?:)
<monokrome> Thanks for your help
<apeiros_> monokrome: it's not operator overloading.
<monokrome> Oh?
<apeiros_> ruby is not capable of overloading
<monokrome> Oh, you mean that they aren't operators
<monokrome> Interesting.
<phinfonet> i have a problem with bowline-bundler
<phinfonet> yours shoulde help-me?
alup_ has joined #ruby
<apeiros_> no, I mean that the term "overloading" describes a concept where you can have multiple definitions of the same method, only distinguished by the type of arguments they take
<apeiros_> ruby can't do that
<monokrome> apeiros_: That seems confusing. Does that imply that you can use the name of any method in the same way that you use +?
<phinfonet> i'm have a error
<apeiros_> monokrome: no, syntax for "symbol" methods is special
<apeiros_> monokrome: the reverse is true however, you can do 5.+(6)
<apeiros_> or "foo".[](0,2)
<monokrome> hmm
<banisterfiend> apeiros_: afaik the term 'operator overloading' just means 'defining the behavior of an operator', the word 'overloading' doesnt mean the same in that context as it does in the sense of 'overloaded' functions/methods
<phinfonet> in this link its pasted my error
<banisterfiend> at least that was my experience of the way that term is used in C++
<phinfonet> have a brazillian in here?
<banisterfiend> but it looks like i could be wrong http://en.wikipedia.org/wiki/Operator_overloading
<banisterfiend> :)
davidd___ has joined #ruby
<apeiros_> banisterfiend: yes and no. no matter, the term doesn't apply.
<apeiros_> (at least not to my understanding of it)
<phinfonet> apeiros_: you uses bowline?
<apeiros_> phinfonet: no, and I go to sleep now anyway
<phinfonet> ok
<phinfonet> who uses bowline in here?
<phinfonet> apeiros_: what gui you uses in yous applications?
sectionme has joined #ruby
heeton has joined #ruby
cachoimechi has joined #ruby
klip has joined #ruby
liluo has joined #ruby
eywu has joined #ruby
<phinfonet> have a bowline users in here?
CoderCR|work has joined #ruby
vjacob has joined #ruby
<rexbutler> Is there a good place that hosts sinatra apps for free?
iocor has joined #ruby
<phinfonet> rexbutler: you use gui frameworks for ruby?
pdtpatrick has joined #ruby
Boohbah has joined #ruby
sepp2k has joined #ruby
<rexbutler> phinfonet: No
<rexbutler> phinfonet: Sinatra is a lightweight web framework
<phinfonet> who know persons that utilize this?
porco has joined #ruby
<phinfonet> rexbutler: i'm use rails
<phinfonet> rexbutler: has many diferrences?
<rexbutler> phinfonet: Well, which is better is (as usual) based on what you want to do
<rexbutler> phinfonet: I think github uses Sinatra
<phinfonet> hmm
yoklov has joined #ruby
<phinfonet> i'm have a tested padrino
<phinfonet> is a good framework too
<rexbutler> It's a very lightweight framework
<rexbutler> (sinatra is)
<phinfonet> after i'm finalize my rails projs i'm go test it
<shevy> hmm what is a good way to get rid of all \n in a string? perhaps one without .gsub ?
<phinfonet> who uses bowline in here?
<rexbutler> shevy: using gsub would be a good way
<rexbutler> phinfonet: What is bowline?
<bawer> String#chomp
<phinfonet> rexbutler: is a desktop ruby framework
SolarisBoy has joined #ruby
<bawer> shevy: in all of the string or just end of lines?
<shevy> all of it
<bawer> shevy: why not gsub?
<shevy> I think gsub pulls the regex engine in
<bawer> what about String#delete! ?
ende has joined #ruby
<shevy> hmm yeah... time to try some benchmarks :)
<ende> I'm not a ruby guy, just installing it as part of a dependency. gem is giving me the following error: http://pastebin.com/kWX9fWUJ
<ende> does that look familiar to anyone?
<shevy> openssl should be part of ruby itself ende
<shevy> it resides in ext/openssl
<shevy> do you happen to be on debian perhaps? :)
Banistergalaxy has joined #ruby
<ende> hm
<ende> yes I do
<shevy> no idea how to make it work on debian. but here on my system, I compile openssl, then go into ext/openssl and run the extconf.rb (or setup.rb) file there, then openssl works
<shevy> the ruby bindings to openssl are in ext/openssl
elake has joined #ruby
<phinfonet> have a rugui users in here?
<ende> thanks shevy ill try that
aroop has joined #ruby
SolarisBoy has quit [#ruby]
jitesh_shetty has joined #ruby
mxweas_ has joined #ruby
_ack has joined #ruby
mattyoho has joined #ruby
<monokrome> Is there a reason against using spaces for functions? IE, if something.includes? 24
<heftig> huh?
<heftig> you can't omit parentheses if the resulting code would be ambiguous
<monokrome> http://d.pr/fXcf
<heftig> e.g. is "foo bar baz, qux" meaning foo(bar(baz), qux) or foo(bar(baz, qux))
<monokrome> Right, like coffeescript
<monokrome> Is it conventional to just use parenthesis in other cases anyway?
<monokrome> or more a matter of preference?
<heftig> preference, mostly
ende has quit [#ruby]
csprite has joined #ruby
<monokrome> Mostly
<monokrome> ?
<heftig> i think it's customary to omit the parentheses of the outermost call
<monokrome> Well that's good news
<monokrome> More like coffee :D
<phinfonet> monokrome: you uses a gui ruby framework?
<monokrome> phinfonet: What do you mean?
<phinfonet> if you uses a framework ruby for desktop apps
Brainix has joined #ruby
<phinfonet> because i'm have a problem and i would like a know help me
<phinfonet> monokrome
<phinfonet> monokrome:if you uses a framework ruby for desktop apps
<monokrome> phinfonet: No, I have never used a Ruby framework for anything.
<phinfonet> monokrome:because i'm have a problem with bowline app
<phinfonet> hmm
<phinfonet> you know who use?