Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
tommyvyo_ has joined #ruby
badabim__ has joined #ruby
ipsifendus has joined #ruby
sacarlson has joined #ruby
sbanwart has joined #ruby
johndbritton has joined #ruby
_obiJuan has joined #ruby
fr0gprince_mac has joined #ruby
jackhammer2022 has joined #ruby
<jackhammer2022>
hi everyone
dnyy has joined #ruby
<jackhammer2022>
i have to generate a graph from a ranking data of ipod songs
<jackhammer2022>
any suggestions for a ruby graphing library ?
ascarter has joined #ruby
looopy has joined #ruby
ryannielson has joined #ruby
Knodi has joined #ruby
MasterIdler__ has joined #ruby
MasterBob has joined #ruby
cableray has joined #ruby
banisterfiend has joined #ruby
<MasterBob>
Hello. Do I always have to make a new class object by using CLASS_NAME.new(params)?
pac1 has joined #ruby
<banisterfiend>
MasterBob: no, u can use: class Hello; end
CannedCorn has joined #ruby
<heftig>
MasterBob: do you want to create a factory?
<MasterBob>
I am not familiar with what a factory is.
<MasterBob>
So, I think no.
sbanwart has joined #ruby
<Nowaker>
I have a related question. I cannot do: Integer.new 1. I know why. I can do Integer(1). However, I will want to do this dynamically, that is, Integer class will be passed via parameter.
<heftig>
if you just write "dup" it's basically the same as "self.dup", and you're looking for a duplicate of the current object in that methods array
<MasterBob>
Okay, so then why are they both True when 4.dup results in a TypeError?
<heftig>
because it does have the method "dup"
<heftig>
it just immediately raises an error
TheNumb has joined #ruby
<MasterBob>
Okay. So then if I need to dup a wide range of things (including FixNum), then I should do so in whatever the Ruby syntax is for an exception block.
looopy has joined #ruby
nobitanobi has joined #ruby
<ReinH>
MasterBob: why do you need to "dup a wide range of things"?
<ReinH>
seems very strange
<banisterfiend>
ReinH: haven't you ever woken up one morning and realized everything in your house had been replaced by an exact copy?
<MasterBob>
to make a deep copy of an object composed of other unspecified objects
<ReinH>
...
<ReinH>
MasterBob: why do you need to do that?
<MasterBob>
that's what happened to be banisterfiend
<sunaku>
and made him into a fiend
<MasterBob>
Because I want to return a new object in this method instead of references to the calling object or paramaters
<banisterfiend>
ReinH: are you a fan of ->{} and .() ?
<ReinH>
banisterfiend: I don't find myself using them very often in Ruby
<ReinH>
obviously in CoffeeScript, Erlang, Haskell, etc I use the former
<ReinH>
I think -> is a pretty reasonable alias for lambda
<ReinH>
.() kind of annoys me though
sbanwart has joined #ruby
<ReinH>
I don't understand the people that say that "->" *looks* like the letter lambda, though. It does not.
fermion has joined #ruby
<banisterfiend>
ReinH: i'd prefer it as a shorthand for proc {} than lambda {} actually, as i tend to use procs and proc-like semantics more often
luckyruby has joined #ruby
badabim_ has joined #ruby
<banisterfiend>
notably i'd like to use ->{} as a nice wa of passing multiple blocks, but when they behave like lambdas you have to be more careful
munx has joined #ruby
emocakes has joined #ruby
td123 has joined #ruby
<MasterBob>
Thank you for your help ReinH , banisterfiend , sunaku , heftig , and ryannielson .
<banisterfiend>
MasterBob: that'll be 50 pounds, thankyou!
<ryannielson>
MasterBob: No worries, good luck
<MasterBob>
banisterfiend: okay. I won't be able to pay you for, say another two months; I hope by then I'll have put on 50 pounds.
MrGando has joined #ruby
yoklov has joined #ruby
eywu has joined #ruby
axl_ has joined #ruby
stephenjudkins has joined #ruby
<MasterBob>
I have one more question, my professor was looking for a new IDE as Netbeans (his old favorite) dropped support for Ruby. Do yall have any recomendations?
ziggles has joined #ruby
<stephenjudkins>
MasterBob: not many people use an IDE with Ruby
<stephenjudkins>
but RubyMine is the best-regarded
<MasterBob>
Yeah, that's what I've been seeing online.
<stephenjudkins>
I believe that RubyMine is essential equivalent to Intellij + Ruby plug-in
<stephenjudkins>
but one or the other gets updates more quickly
<stephenjudkins>
i use IntelliJ for scala development and it's very good at that
choffstein has joined #ruby
<stephenjudkins>
but i have been using sublime text 2 for everything else. it is very good at being a text editor
sbanwart has joined #ruby
<MasterBob>
stephenjudkins: if most people don't use an ide, do they use a debugger?
snip_it has joined #ruby
<stephenjudkins>
MasterBob: even fewer people use a debugger
QaDeS_ has joined #ruby
<stephenjudkins>
i'm personally opposed to use of a debugger
<stephenjudkins>
though they are sometimes useful
<MasterBob>
for philosophical reasons?
<stephenjudkins>
yeah
hadees has joined #ruby
<Boohbah>
can a deck of cards be an Array of Hashes?
<Boohbah>
yes! it can!
<ereslibre>
is there an easy way to obtain an object's list of attributes ? I am defining them with attr_accessor
<epochwolf>
stephenjudkins: debugger is awesome
<epochwolf>
stephenjudkins: I wouldn't be able to do my day job without it
<stephenjudkins>
[citation needed]
<iamjarvo>
i want to to iterate through an array and when i reach a certain value i want to take 10 values back is tehre a simple way of doing that
<epochwolf>
stephenjudkins: enterprise rails with legacy code™
<stephenjudkins>
epochwolf: i'm sorry. you should look for a new job! i am not joking,.
<epochwolf>
you try figuring out why there is a bug in 3000 lines of code without a debugger.
<epochwolf>
stephenjudkins: I've considered it.
<stephenjudkins>
i worked for far too long at a place that kind of sucked
<stephenjudkins>
because of laziness or some misguided sense of duty
<deryl>
you use a debugger to help you? *gasp* get a new job, you're not qualified for this one" (rubbish)
<stephenjudkins>
but if you're a good, or even decent, developer, there are places there for you
<stephenjudkins>
deryl: epochwolf said himself he needs it because it's "legacy code"
<stephenjudkins>
i know exactly what that means
undersc0re has joined #ruby
undersc0re has joined #ruby
<stephenjudkins>
there is plenty of code that requires a smart competent programmer to use a debugger to understand it
<Sailias|work>
iamjarvo, a = (1..20).to_a; a[a.index(13) - 10, a.index(13)] if a.index(13)
<epochwolf>
stephenjudkins: my code rarely needs debugging.
<deryl>
ok, then you're obvisouly in possession of information I am not, so i'll retract the barb.
<Sailias|work>
iamjarvo, that could be cleaned up a lil prob, but i 1 lined it for you
drbawb has joined #ruby
<epochwolf>
maybe twice in 7 months?
<deryl>
s/iso/ios/
<deryl>
even then i'm wrong and still end up with a typo. awesome!
<epochwolf>
stephenjudkins: I'm slowly removing bad code and replacing it with my code.
porco has joined #ruby
<stephenjudkins>
"p [__FILE__, __LINE__]; STDIN.readline" has been a sufficient debugger for me
<Sailias|work>
iamjarvo, or in case i misunderstand and you want the single element 10 values back: a = (1..20).to_a; a[a.index(13) - 10] if a.index(13)
<stephenjudkins>
but i have used a debugger on some crazy java codebases where it's been very helpful
<banisterfiend>
stephenjudkins: i can solve problems without a debugger, but im usually faster with a debugger
<iamjarvo>
Sailias|work: i think i will do .each_with_index and just minus 10
<stephenjudkins>
do you use unit tests?
mxweas_ has joined #ruby
<banisterfiend>
stephenjudkins: of course, but sometimes there's an edge case now caught by your tests
<sunaku>
Sailias|work: a = (1..20).to_a; a.index(13).tap {|i| a[i-10, i] if i }
<deryl>
banisterfiend: i think there is something specific to legacy stuff thats not apparent in fresh code. that i'd understand so is why i stepped back from my barb
<banisterfiend>
stephenjudkins: and then you can have some subtle issues that are hard to untangle without a debugger
<banisterfiend>
stephenjudkins: not caught*
<stephenjudkins>
banisterfiend: hmm, i've found that most "subtle issues" that can only be found with a debugger
<stephenjudkins>
frequently means over-use of stateful code
<banisterfiend>
stephenjudkins: or, is actually a bug in a library you're depending on
<stephenjudkins>
but i'm running my mouth over stuff that's honestly mostly opinion
<banisterfiend>
stephenjudkins: or is a bug in ruby itself
<banisterfiend>
stephenjudkins: or is an edge case of a ruby method that you didnt know about
<banisterfiend>
i encounter that stuff a lot
_|christian|_ has joined #ruby
<sunaku>
Sailias|work: never mind. #tap doesn't #map
<stephenjudkins>
why not try to write a unit test to reproduce the issue first?
<banisterfiend>
stephenjudkins: i do?
<banisterfiend>
stephenjudkins: but getting in there and *understanding it* in an interactive manner is extremely helpful
<epochwolf>
stephenjudkins: I do when possible.
mkscrg has joined #ruby
Targen has joined #ruby
<stephenjudkins>
hmm, obviously we have different takes on this issue
<ereslibre>
nvm... instance_variables, the variable wasn't defined yet so the list was empty
<epochwolf>
One of the things that makes enterprise stuff really painful is having to make stuff like "We need to allow the user to select which things they want to copy from Test Environment A to Production B" when things is one of 5 top level objects which have foreign key relationships to 50 differnet
<epochwolf>
50 different objects.
lorandi has joined #ruby
<epochwolf>
Working out the basic logic for that on paper takes over an hour for each instance IF I have all the records printed out.
<banisterfiend>
stephenjudkins: obviously following TDD can significantly limit the number of times you need to use a debugger, but to say that it does away with the debugger altogether is kinda silly IMO. Though, you can, of course, eventually figure things out without debuggers, but once you become good with a debugger you can locate and fix the issue much more quickly.
<epochwolf>
banisterfiend: exactly
<deryl>
hehe i write tests daily, and it definitely hasn't eliminated the need for the debugger.
<deryl>
cut down, yes. eliminate, not so much
<epochwolf>
When a process takes 15 minutes to run each time, a debugger is much, much faster.
Willejs has joined #ruby
<epochwolf>
especially when it produces 30+mb of log data.
tamarass has joined #ruby
<tamarass>
ciao
<epochwolf>
that should give you an idea of how many select *'s it's doing. >.<
<deryl>
hehe i was blinking at that
pdtpatrick has joined #ruby
<epochwolf>
deryl: it needs to compare the differences between two databases.
Willejs_ has joined #ruby
<banisterfiend>
stephenjudkins: I also have a debugger than can open up on test failure at the point of a failing test, that's very handy too
<epochwolf>
and then once that's done, it needs to calculate the dependencies between changes D:
albemuth has joined #ruby
<epochwolf>
I wrote the second part.
<epochwolf>
7 fucking weeks and it still corrupts data :'(
<epochwolf>
so maybe 9~11 weeks total dev time since last october.
kpshek has joined #ruby
<epochwolf>
combined with the amount of corrupt data we've had to repair, it's not saving any time for anyone.
triptec has quit [#ruby]
<epochwolf>
I hope I fixed the last bug yesterday. It's nearly impossible to get a decent test of this monster.
<epochwolf>
I should write a blog on this.
<epochwolf>
It'll be fun to point to on my resume.
nari has joined #ruby
mikepack has joined #ruby
v0yager has joined #ruby
<epochwolf>
oh this isn't working very well. :(
thecreators has joined #ruby
<Boohbah>
p CARD_HASH = Hash[*CARDS.zip(ENCODED).flatten] # splat!
shtirlic has joined #ruby
frishi has joined #ruby
<sunaku>
p CARD_HASH = Hash[CARDS.zip(ENCODED)] # should work too
CannedCorn has joined #ruby
<Boohbah>
sunaku: it does. i think i'll do that, thanks!
drbawb has joined #ruby
drbawb has joined #ruby
sdwrage has joined #ruby
sacarlson has joined #ruby
choffstein has joined #ruby
Willejs has joined #ruby
Indian has joined #ruby
dv310p3r has joined #ruby
sawjig has joined #ruby
nat2610 has joined #ruby
carlyle has joined #ruby
<nat2610>
is there something similar to .methods but that will actually give you the paramters that the method expect ?
<deryl>
respond_to?()
<deryl>
oh params
<deryl>
nevermind. wow that was stupid response.
wallerdev has joined #ruby
rickmasta has joined #ruby
<Nowaker>
how do I override a method defined in Module class?
<Nowaker>
let's say I want to override attr_accessor
<Nowaker>
and I want to override it for current class only, not the module itself
CheeToS has joined #ruby
albemuth has joined #ruby
mdaisuke has joined #ruby
jesly has joined #ruby
<MasterBob>
In ruby are there method comments like java's javadoc stuff?
<Nowaker>
# description
<Nowaker>
def my_method
wallerdev has joined #ruby
<Nowaker>
when I press ctrl+q on usage of my_method in rubymine, I get the description
<MasterBob>
Nowaker, is that then automatically "associated" with my_method?
<Nowaker>
in my ide - rubymine - yes
<MasterBob>
Okay. thanks.
<banisterfiend>
MasterBob: check out YARD
<Nowaker>
bit if you need 'persisent' "javadocs" in ruby, you would need to take a look at rdoc or yard
baroquebobcat has joined #ruby
<MasterBob>
okay thanks Nowaker and banisterfiend
rickmasta has joined #ruby
mxweas_ has joined #ruby
wmoxam has joined #ruby
Mac_ has joined #ruby
ipsifendus has joined #ruby
kah has joined #ruby
<Nowaker>
how to programatically call attr_accessor or any other method from Module class?
pp01bit has joined #ruby
<Nowaker>
self.class.send :attr_accessor, name - it does not raise any exception
<Nowaker>
banisterfiend: but i'd be interested, just to know how ;-)
<Nowaker>
if you have any link to such a thing, please provide, i will read
<twelvechairs>
kah: code_words will be an array in the form of [real, code]
<Nowaker>
banisterfiend: also, could you look at this? https://gist.github.com/1946964 - this was my first attempt with "custom" attr_accessors. This has "self.class" too - so it's the worst implementation that could be made, huh? ;-)
ascarter has joined #ruby
<kah>
twelvechairs, it's in a hash.. does that matter?
<twelvechairs>
kah: oh. yeah. then will be a hash in form of {real=>code...}
kawa_xxx has joined #ruby
mutandi has joined #ruby
namidark_work has joined #ruby
<kah>
twelvechairs, yeah! and real => code was defined in went it was introduced in |real,code| ??
<banisterfiend>
Nowaker: one second
chaitanya has joined #ruby
ap0gee has joined #ruby
<mutandi>
can someone help me think through a homework problem? I'm tasked with writing a replacement to attr_accessor that records the history of each variable assignment.
<twelvechairs>
kah: not sure what you are saying. The actual hash would be defined before the code in your pastie. 'real' and 'code' are assigned as variables for the keys and values of the hash as part of .each do
<kah>
twelvechairs, ok, so by having a defined hash set up, real and code are already defined for the key and value? ... I guess my question is are they universal or just variables... does real and code always relate to a hash key and variable
<Gosh>
What would be the cleanest way to check if an array has more than one "child"?
<banisterfiend>
Gosh: if it contains another array u mean?
PragCypher has joined #ruby
ed_hz_ has joined #ruby
<Nowaker>
banisterfiend: clever
<Nowaker>
banisterfiend: the define_method defines a static or instance method?
<banisterfiend>
Nowaker: instance
<banisterfiend>
Nowaker: and dont think of class methods as 'static methods' you'll only confuse yourself later on ;)
shadoi has joined #ruby
<Nowaker>
banisterfiend: ok, thank you very much :-)
Gosh has joined #ruby
<Nowaker>
banisterfiend: so how would you call class methods if not static?
nobitanobi1 has joined #ruby
<Nowaker>
you see, i'm programming in ruby for on year, but I still didn't get all those quirks
<banisterfiend>
Nowaker: we typically call them 'class methods' :)
<Nowaker>
ah, ok, so just a naming
<Gosh>
Sorry for the late response, like if the array more than one element..sorry forget the terminology. eg. foo[0] would be valid, but foo[1] wouldn't? I could do it with an each but that's extremely messy and am looking for a cleaner way.
jergason has joined #ruby
<Nowaker>
i thought that ruby class methods are something different than java static methods
<banisterfiend>
Nowaker: they are very different
<Nowaker>
and that's why you telling me not to call them static ;)
<banisterfiend>
yeah
<banisterfiend>
that's why i am, but 'class methods' doesnt have the same burden as 'static methods'
<Nowaker>
ok, so what is the logical difference between those languages?
<Nowaker>
between the ruby class methods and java static methods
<Nowaker>
cause, for now, i considered them equal
<banisterfiend>
Nowaker: in ruby classes are objects too, so a 'class method' in ruby, is an instance method on a class's class
<Nowaker>
gotcha!
<Nowaker>
banisterfiend: and that's excellent from the design view
<banisterfiend>
Nowaker: yeah it's pretty clever
<banisterfiend>
it brings a consistency and homogeneity to everything
<Nowaker>
banisterfiend: i think I will save lots of time with knowing it
mike has joined #ruby
<Nowaker>
whenever some problems with classes and modules hierarchy appears to me
Guest31738 has quit [#ruby]
<Nowaker>
thank you banisterfiend
<banisterfiend>
Nowaker: np
mxweas_ has joined #ruby
coreydaley has joined #ruby
Gosh has joined #ruby
<Nowaker>
banisterfiend: one more question :) https://gist.github.com/1947108 - if two modules both contain a() method, is it possible to call the "first" defined?
technel has joined #ruby
<Nowaker>
looking for something like "please call a() from the A module, not B"
<banisterfiend>
Nowaker: b = Blah.new; A.instance_method(:a).bind(b).call
<banisterfiend>
Nowaker: btw, you should use pry instead of irb ;) http://pry.github.com
<Nowaker>
banisterfiend: nice. everything's accessible, it didn't get "hidden".
kah has joined #ruby
<banisterfiend>
Nowaker: also use pry to get balls-deep in your code and figure out what's going on
<Nowaker>
so under the hood ruby just does this binding to module any time the module method is to be called?
<Nowaker>
ok, i will try it
<deryl>
pry pry-doc pry-exception_explorer pry-stack_explorer, and pry-nav :)
<banisterfiend>
deryl: hehe "le pack"
<deryl>
:)
AndChat- has joined #ruby
<CannedCorn>
you guys have any idea on that threading stuff i posted
<deryl>
the only thing i'm confused on (haven't installed it yet so..) is pry_debug
mikeycgto has joined #ruby
<deryl>
someone pointed me to it but i don't know if it requires ruby-debug19 or replaces it
<deryl>
will probably become clear once i get some time to install and play.
berserkr has joined #ruby
Prometheus has joined #ruby
mmokrysz has joined #ruby
sdwrage has joined #ruby
<AndChat->
Deryl it's pure ruby, but pry-nav is more convenient I think
<Nowaker>
banisterfiend: wow, it's quite awesome, it tells me the owner
<deryl>
cool. then i'll stick with what i got
<Nowaker>
it may sometimes help
<deryl>
AndChat-: thanks
radic_ has joined #ruby
<Nowaker>
deryl: are you debugging from the console?
<Nowaker>
rubymine has awesome debugging features thanks to ruby-debug-ide
<AndChat->
Nowaker: what tells you the owner and how
<deryl>
Nowaker: yes. i don't use IDEs
Choobie has joined #ruby
<deryl>
I use either vim+snipmate or TextMate for my editor, and console
<Nowaker>
deryl: are there refactoring features? I mean, rename the method and replace all the usages
<deryl>
TM does it throughout the project, vim i haven't found that
td123 has joined #ruby
<deryl>
bbiam cig break
<pdtpatr1ck>
Can someone please help me with the following error
<deryl>
someone was giving me serious crapola for using it as a debugger. said it wasn't one so don't use it as such
<Nowaker>
deryl: oh, that would be quite nice-to-have in my IDE
<deryl>
rubymine does it
<Nowaker>
i recall the plugin for that in intellij, the java ide
<AndChat->
Deryl who was
<Nowaker>
deryl: not sure if in rubymine though, can't find it
<deryl>
but their rvm support is a bit lacking. not sure about in 4.x my copy is a 3.2.x (sits collecting digital dust)
<deryl>
AndChat-: i forget who it was someone in here or in #ruby-lang
<deryl>
i quit paying attention
<AndChat->
deryl: cos with nav and stack explorer it is a debugger
<AndChat->
Deryl when was it?
<deryl>
yesterday or the day before
<deryl>
day before i think
<Nowaker>
deryl: don't see the feature in my rubymine
<Nowaker>
oh, there is
<deryl>
was gonna say.
<deryl>
didn't tjhink they'd remove that
<Nowaker>
ok, let's assign a shortcut to 'create gist' :-)
ben_alman has joined #ruby
<deryl>
AndChat-: and i think (if the conversation is coming back to me right) that *because* you have to add nav and stack *that* means that pry isn't a debugger. but i was using pry for one before i even knew about the other two
<deryl>
but they were right that the next and step stuff is not working as expected.
<deryl>
didn't step into and run through several times
<AndChat->
Sounds retarded
<deryl>
ehh twas a semantics argument to me
<AndChat->
Sure yoy can't recall who said this shit?
<deryl>
i quit listening i think about half way through
<AndChat->
Got a log?
<deryl>
yeah cause i don't keep longs on my client
<deryl>
err logs
<deryl>
hah! answers that question :)
jfelchner has joined #ruby
headius has joined #ruby
<deryl>
but if its any consolation it'll bug me that i can;t remember
banisterfiend has joined #ruby
<deryl>
*anyone got logs of here and #ruby-lang that can grep it for me discussing pry over the last two days?
<deryl>
that *is* bugging me now
<ryanf>
it would be cool if someone wrote a pry plugin that hooks into ruby-debug's stepping functionality
<ryanf>
I hate using ruby-debug because it doesn't show context, etc., so I feel like I am looking at the code through a tiny pinhole
<banisterfiend>
ryanf: what's wrong with pry-nav ?
<ryanf>
saw a comment on something implying it'd be a new install target
<ryanf>
"tcs" maybe?
mmokrysz has quit [#ruby]
<rohit>
deryl: Are there any open source libraries for doing *different* stuff: like graphics, artificial intelligence, writing games etc?
<deryl>
yeah we do that. that the one you referencing?
<ryanf>
probably
<rohit>
deryl: I mean there are, I know of a few
<banisterfiend>
deryl: i have the last 2 days of #ruby-lang logs and there's no arguments :/
<deryl>
rohit: tons of them out there. mainly i use just what ruby provides but i also work with fsr (freeswitcher) which is a ruby library for interfacing with freeswitch through its EventSocket
<rohit>
deryl: Umm nm I don't exactly know what I want to ask ...
<deryl>
banisterfiend: damn we had the discussion! i'm crazy not alzeimeric :)
<deryl>
rohit: thats cool. just think on it a bit
<banisterfiend>
deryl: who had the discussion? you and me?
<deryl>
i have head injuries so i forget what i'm asking people sometimes *as* i'm typing it hehe. so a brainfart isn't a big deal
<deryl>
banisterfiend: no, if YOU had told me it wasn't a debugger I wouild have said ok
<deryl>
i know you wrote it. if you say its not then well its not
<banisterfiend>
deryl: hmm, well im curious to see the argument, but it's def not from #ruby-lang the last 2 days
<banisterfiend>
any other ideas?
<deryl>
just here and *possibly* #eventmachine
<deryl>
no, mind keeps saying it was here or r-l
btanaka has joined #ruby
<deryl>
bbiab. doggie wants to play and i've ignored her most of the day
linopolus has joined #ruby
iamjarvo has joined #ruby
rippa has joined #ruby
xnm has joined #ruby
t0mmyvyo has joined #ruby
Murr has joined #ruby
gentz has joined #ruby
blueadept has joined #ruby
kinderman has joined #ruby
adeponte has joined #ruby
<Nowaker>
banisterfiend: just one question :) since i'm thinking of all those class things. because class class is an object, you can do Myclass.class.new. Because lots of class class objects can appear, you can modify these classes for you, and leave unmodified for other clients. do i say correctly? (quite difficult to name these things xD)
ckrailo has joined #ruby
<banisterfiend>
Nowaker: you can speak in polish if you prefer
<dbruns>
I"m having trouble installing 1.9.3 (with rvm) on my new MBP with OS X lion 10.7.3… I've got gcc installed via the osx-gcc-installer and libksba with homebrew I'm getting an error when I do rvm install 1.9.3 when it tries to compile
dlam has joined #ruby
<dlam>
in the console, how do I print out all the methods or attributes of an object?
<dlam>
like in python its dir(something) or something.__dict__
<Mammutpanzer>
I found the solution for my problem. The application is connection via TCP/IP and I had disabled it for the server
<Mammutpanzer>
*connecting
cableray has joined #ruby
pleiades has joined #ruby
snip_it has joined #ruby
<rippa>
dlam: object.methods
<pleiades>
i am sober for once
al3xnull has joined #ruby
stenno50 has joined #ruby
khakimov has joined #ruby
<Rorgo>
anyone know of the best way to pre-compile gems on a server, so I can distribute them to identical servers without having to re-build them?
supergiantrobot_ has joined #ruby
<pleiades>
yoda !!!. <3
snip_it_ has joined #ruby
flyingoctopus has joined #ruby
CodeZombie has joined #ruby
ryanf has joined #ruby
<flyingoctopus>
okay, this an embarrasingly silly question: for arrays and hases of undefined lengths, what would one recommend to use in place of .each
<flyingoctopus>
in the case of an array/hash w/ a single entry
<dlam>
thx thx rippa
<rippa>
flyingoctopus: why not just use .each?
<flyingoctopus>
rippa: in the case of array = ['foo'], .each will return a no method error
<rippa>
no
<rippa>
it will not
<flyingoctopus>
:O
<flyingoctopus>
i just tried that in irb
<flyingoctopus>
\o/
<flyingoctopus>
i wonder if it behaves differently with a hash
<pleiades>
LiquidNitrogen yeah we are social animals anyway... not meant to make it alone
<rippa>
flyingoctopus: no, same with hash
ddv has joined #ruby
<flyingoctopus>
rippa: k now i'm even more embarassed
<flyingoctopus>
totally confused as to why this kept popping up:
<flyingoctopus>
NoMethodError (undefined method `each' for nil:NilClass):
<flyingoctopus>
mayybe i know
<flyingoctopus>
k
<flyingoctopus>
xoxo
* flyingoctopus
figured it out
* flyingoctopus
slinks away behind curtain
<flyingoctopus>
thx rippa
kinderman has joined #ruby
Reckreations has joined #ruby
<Reckreations>
hi all
<Reckreations>
I need a little advice if anyone is free
tessi has joined #ruby
xnm has joined #ruby
igotnolegs has joined #ruby
artOfWar has joined #ruby
twelvechairs has joined #ruby
savage- has joined #ruby
rohit has joined #ruby
AndChat- has joined #ruby
nfluxx has joined #ruby
macmartine_ has joined #ruby
ap0gee has joined #ruby
JohnBat26 has joined #ruby
snip_it has joined #ruby
ed_hz_ has joined #ruby
ilyam has joined #ruby
ChampS666 has joined #ruby
banisterfiend has joined #ruby
c0rn has joined #ruby
Drewch has joined #ruby
x0F_ has joined #ruby
havenn has joined #ruby
Morkel has joined #ruby
CheeToS has joined #ruby
n3m has joined #ruby
CheeToS` has joined #ruby
greenarrow has joined #ruby
enherit has joined #ruby
yxhuvud has joined #ruby
Jonah11_ has joined #ruby
<Jonah11_>
why are parentheses required for the invocation in this statement: "5.method(:+)"
havenn has joined #ruby
<burgestrand>
Jonah11_: they aren’t
rohit has joined #ruby
<Jonah11_>
burgestrand, when i type 5.method :+ into irb, nothing happens. i does a line continutation
<Jonah11_>
it does*
<burgestrand>
Hah, indeed it does, I tried it in pry and there it works, and if you run it from a file it works there as well
<Jonah11_>
burgestrand, what is going on in irb?
<burgestrand>
Not sure what IRB thinks it is
<burgestrand>
I have to CTRL-D twice, but if I do that it’ll eventually work like normal
<cespare>
sabooky: also a bunch of code samples. It's such a trivial format that people tend to parse it manually, looks like
<cespare>
sabooky: sorry *also a bunch of code samples available if you google around
<banisterfiend>
burgestrand: oh a guy used pry-remote to fix a bug in production :D an exception arose, pry emailed him in the middle of the night waking him up, and it opened up a socket which he connected to fix it via pry-remote :))
<banisterfiend>
all worked better than expected
<Mammutpanzer>
Hi I got a weird problem. My Redmine website is printed out as html instead of being shown as html by my browser. (other websites work) Does anyone know why?
<sabooky>
cespare: I'm implementing a simple solution now, one that ignores multiline and spaces
cantbecool has joined #ruby
Gumpshion has joined #ruby
cantbecool has quit [#ruby]
cantbecool has joined #ruby
davidcelis has joined #ruby
Helius has joined #ruby
cantbecool has quit [#ruby]
cantbecool has joined #ruby
v0yager has joined #ruby
moshef has joined #ruby
bluOxigen has joined #ruby
fixl has joined #ruby
jsdrk has joined #ruby
CacheMoney has joined #ruby
mxweas_ has joined #ruby
tonini has joined #ruby
v0yager has joined #ruby
Husio has quit [#ruby]
mafolz has joined #ruby
tatsuya__ has joined #ruby
stoffus has joined #ruby
ccapndave has joined #ruby
Mammutpanzer has joined #ruby
ph^_ has joined #ruby
<Jonah11_>
is "super" a special language construct in ruby or is it a method defined somewhere? i don't see it listed in the docs for Object
oposomme has joined #ruby
sspiff has joined #ruby
<xeno>
Jonah11_: it's a reference to the superclass of an object
senny has joined #ruby
<Jonah11_>
xeno, but it must be more than just that, otherwise how is it used in method_missing to automatically redispatch a method calling, along with arguments, to the superclass, using only the single line "super"?
<xeno>
good question... I guess you should check the source/definition...
<DefV>
it's a language construct
<pleiades>
they are pocket sized..
<DefV>
super points to the same method in the superclass
Sliker has joined #ruby
<banisterfiend>
Jonah11_: it's not a method
<banisterfiend>
Jonah11_: and it invokes the superclass method
<Jonah11_>
banisterfiend, does it have different meaning depending on the context where it's used? or is the only use the one you see in method_missing?
<banisterfiend>
Jonah11_: i dont know what you mean, basically you call it when you want a superclass to deal with it
<Jonah11_>
banisterfiend, i'm asking if that's the only use of it
<banisterfiend>
Jonah11_: yes, what other use could u expect
etehtsea has joined #ruby
zakwilson_ has joined #ruby
<Jonah11_>
banisterfiend, eg, in java it is used differently, so i could imagine other uses
<banisterfiend>
Jonah11_: what's the use in java
<banisterfiend>
Jonah11_: oh i see, if you want to actually refer to the superclass in ruby you use the 'superclass' method
<pleiades>
I;ve tried to kick never to ban.
<Jonah11_>
banisterfiend, yes that's what i'm getting at
<pleiades>
who makes a better monitor? samsung or dell?
<Jonah11_>
thx
Targen has joined #ruby
lurch_1 has joined #ruby
bier has joined #ruby
KL-7 has joined #ruby
zommi has joined #ruby
pi3r has joined #ruby
Helius has joined #ruby
_obiJuan has quit [#ruby]
jsdrk has joined #ruby
jsdrk_ has joined #ruby
LMolr has joined #ruby
jsdrk has joined #ruby
zomgbie has joined #ruby
simao has joined #ruby
timonv has joined #ruby
nemesit has joined #ruby
randym_ has joined #ruby
Sliker has joined #ruby
berserkr has joined #ruby
randym has joined #ruby
Seisatsu has joined #ruby
krz has joined #ruby
QaDeS has joined #ruby
stepnem has joined #ruby
rickmasta has joined #ruby
timonv has joined #ruby
johndbritton has joined #ruby
jmeeuwen has joined #ruby
<ryanf>
pleiades: I think dell is generally better-regarded at least at the high end
briankbuckley has joined #ruby
<pleiades>
so you're high and trying to install gentoo, sensei. great idea
francisfish has joined #ruby
LMolr_ has joined #ruby
mdw has joined #ruby
shruggar has joined #ruby
mengu has joined #ruby
Guest60377 has joined #ruby
mikewintermute has joined #ruby
Blaster has joined #ruby
<Jonah11_>
what is example of a class implenting "each" in ruby (ie, not in C)? i want to see how to create custom each methods
fortysixandtwo has joined #ruby
<Blaster>
hey when something in the Ruby documentation shows method(string) #=> true Is the #=> the return value?
<Blaster>
i mean, would true be the return value.
helllen has joined #ruby
<helllen>
helllo
<helllen>
how could I know if a string is a valid integer?
<Guest60377>
when foo is a method returning 1, why cant i do foo = foo + 1
alem0lars has joined #ruby
<Guest60377>
foo + 1 must be 2
<Guest60377>
so 2 must be assigned to new variable foo
<Guest60377>
?
<ryanf>
Blaster: yes
<ryanf>
that's just a convention in documentation
<ryanf>
to represent the next line in IRB or whatever
<Blaster>
oh ok
<Blaster>
thank you
<Blaster>
good night
<Guest60377>
any one
<pleiades>
of those time life series almost every day it will snow there in many a bong session..
<rippa>
Jonah11_: create a loop and yield members of the collection
<Guest60377>
ryanf: when foo is a method returning 1, why cant i do foo = foo + 1
<Guest60377>
foo + 1 must be 2
<Guest60377>
so 2 must be assigned to new variable foo
<Jonah11_>
rippa, thx. is there a well known library, 3rd part or otherwise, where i could see an example in action?
jlebrech has joined #ruby
moshef has joined #ruby
<rippa>
Jonah11_: try rubinius source code
<moshef>
how do i find a value within a hash (i don't know where it's located) and update it?
BiHi has joined #ruby
<moshef>
is it possible to do it without going over the entire hash?
<Jonah11_>
rippa, thx
<rippa>
moshef: not possible
<moshef>
no some find method ?
<moshef>
there is no*
adambeynon has joined #ruby
al3xnull has joined #ruby
decentrality has quit [#ruby]
helllen has quit ["Saliendo"]
maletor has joined #ruby
<rippa>
moshef: there is
<rippa>
#assoc
<rippa>
but it will go over entire hash
jmeeuwen has joined #ruby
<Guest60377>
rippa: cant we do this
<Guest60377>
yourhash.select {|key,val| val == "your_data"}
<pleiades>
not as bad
Untouchab1e has joined #ruby
trivol has joined #ruby
<rippa>
Guest60377: that's the same as yourhash.assoc "your_data"
<Guest60377>
ok
<Untouchab1e>
not sure if this is the right place to ask, but I am having some problems running the following: RAILS_ENV=production rake db:migrate
<pleiades>
i have always been treated in montreal and sherbrooke horrible and paris people loved me
<Untouchab1e>
keeps telling me I am missing rubytree >= 0
<Untouchab1e>
and that I have to run rake gems:install
<Untouchab1e>
and I do, and it says its succesfully installs rubytree
<Untouchab1e>
but the problem persists
<Untouchab1e>
any ideas on whats wrong?
<pleiades>
queen elizabeth used cocaine in mariana wine
<rippa>
in marijuana wine
the_hack has joined #ruby
speggey has joined #ruby
<moshef>
rippa: is select better than values at?
nari has joined #ruby
<rippa>
it's different
<moshef>
what's better performance wise?
<rippa>
also, select return hash
<rippa>
no idea
<moshef>
l. tnx
<moshef>
ok*
Untouchab1e has quit [#ruby]
KJF has joined #ruby
ephemerian has joined #ruby
tomzx has joined #ruby
senthil has joined #ruby
<senthil>
is there a way to redefine failure messages in rspec?
Gekz has joined #ruby
Gekz has joined #ruby
<Guest60377>
def foo
<Guest60377>
1
<Guest60377>
end
<Guest60377>
why dont foo = foo + 1
<Guest60377>
work
<Guest60377>
?
Ammar01 has joined #ruby
speggey has joined #ruby
simao has joined #ruby
<rippa>
foo = foo() + 1 works though
mrake has joined #ruby
akemrir has joined #ruby
<rippa>
Guest60377: when you do foo = foo + 1 foo assigns to nil
<rippa>
for some reason
<rippa>
and shadows method
<Guest60377>
rippa: so that implies that LHS is executed first
<Guest60377>
not RHS
<Eddiee>
rippa: I am still not sure that LHS will be executed first
<rippa>
when you try to assign anything to a var
<rippa>
it becomes nil
bluenemo has joined #ruby
roolo has joined #ruby
ikaros has joined #ruby
odinswand has joined #ruby
<Stefunel>
guys, is there a way I can make to_s limit to two chars when converting to hex? I need number that are up to 15 to be converted to hex in the 00 to 0f
Indian has joined #ruby
gianlucadv has joined #ruby
gianlucadv_ has joined #ruby
<matti>
ReinH: ?
gianlucadv has joined #ruby
Shrink has joined #ruby
randym has joined #ruby
<ccapndave>
Stefunel How about "0" + num.to_s(16)
<ccapndave>
Stefunel If you are only going up to 15 the first number will always be 0 anyway
<rippa>
"%02x" % num
<rippa>
("%02x" % num)[-2..-1]
<rippa>
"%02x" % (num % 0xff)
<Stefunel>
I have numbers that go to 255
<pleiades>
.. then I will be hard..
stevecaney has joined #ruby
<Stefunel>
so essentially up to ff
<rippa>
*0x100
<rippa>
Stefunel: "%02x" % num
<ccapndave>
Much more elegant
tvo has joined #ruby
<Stefunel>
rippa thanks I will give it a go
tatsuya_o has joined #ruby
glosoli has joined #ruby
tatsuya_o has joined #ruby
sohocoke has joined #ruby
Jonah11_ has joined #ruby
vraa has joined #ruby
iocor has joined #ruby
triptec has joined #ruby
dr_bob has joined #ruby
Progster has joined #ruby
d34th4ck3r has joined #ruby
TheNumb has joined #ruby
sohocoke has joined #ruby
francisfish has joined #ruby
Ferdev has joined #ruby
TheNumb has joined #ruby
kinderman has joined #ruby
tayy has joined #ruby
speggey has joined #ruby
mikewintermute has joined #ruby
Iszak has joined #ruby
<Iszak>
Anyone recommend a gem that'll read a file and determine the mime type for Ruby 1.9.3?
<pangur>
I want to create a person using something like c.each_slice(6) { |surname, name, age, telephone, puppets, science| p surname, name, age, telephone, puppets, science }. However, I am currently baffled by how to access the new arrays generated by each_slice().
<pangur>
I understand that the 'p' in the mapping stands for 'print' but I want to be able to manipulate the generated arrays.
<pangur>
Each set of 6 elements in the array rerpresents data for a person. There are 60 such persons. How do I refer to the data for person 47, for instance, after doing each_slice?
<pangur>
c[47] will give me the 47th element in array c.
<pangur>
or the 48th, I suppose.
<rippa>
which is 47th person
<rippa>
48th
<rippa>
I'd use hash though
<rippa>
c[47][:name]
<pangur>
Does not work though - c[47][:name] gives me in `[]': can't convert Symbol into Integer (TypeError)
<pangur>
c[44][0] gives me an 'E' :)
adman65 has joined #ruby
Karmaon has joined #ruby
<pangur>
c[44] does not give me an array, it gives me an element of my original 360 element array.
<rippa>
pangur: because you're using array and not a hash
<rippa>
and you didn't change your original array
Drakx has joined #ruby
Drakx has joined #ruby
<pangur>
I do not know how to do that ;)
<rippa>
you can create a new one
<rippa>
with Array#map
tayy has joined #ruby
<pangur>
ok, thanks, I shall look that up
davidpk has joined #ruby
Ch4rAss has joined #ruby
<Iszak>
Is there any way to inspect only the top level classes methods?
<rippa>
Iszak: methods(false)
looopy has joined #ruby
<Iszak>
heh.. thanks
<Iszak>
Sorry I should have looked at the parameters for methods()
<pangur>
rippa, I have used c.collect! {|x| ":" + x } to change my array. For print c[42][:name], I still get '[]': can't convert Symbol into Integer (TypeError)
<rippa>
pangur: because it's an array
<rippa>
use numbers
<rippa>
or make it a hash
bluenemo has joined #ruby
bluenemo has joined #ruby
ap0gee has joined #ruby
<pangur>
When I do c.each_slice(6) ... it prints out a series of 6 element arrays. If I wanted to select the 44th array, what would I need to write is really my basic question, I think.
<pangur>
c[43] only gets me the 44th element in the original array.
<rippa>
c.each_slice(6).to_a
<pangur>
I have done c.each_slice(6).to_a { |surname, name, age, telephone, puppets, science| p surname, name, age, telephone, puppets, science } print c[43] gives me the forename of a person.
<rippa>
block is ignored
<pangur>
It seems only to be printing the arrays rather than storing them.
<rippa>
because you don't store new array
<rippa>
a = c.each_slice(6).to_a
<pangur>
ah
<pangur>
That's it, rippa - thanks!
naequs has joined #ruby
<pangur>
I can now do a[43] and it gives me the anticipated six element array :)
* pangur
is very grateful to rippa.
bluenemo has joined #ruby
mdw has joined #ruby
ninor has joined #ruby
fearoffish has joined #ruby
tatsuya__ has joined #ruby
tk__ has joined #ruby
ap0gee has joined #ruby
ecolitan has joined #ruby
glosoli has joined #ruby
tayy_ has joined #ruby
Helius has joined #ruby
glosoli_ has joined #ruby
KJF has joined #ruby
mdw_ has joined #ruby
johndbritton has joined #ruby
Talvino has joined #ruby
a_meba has joined #ruby
sohocoke has joined #ruby
iocor has joined #ruby
iocor has joined #ruby
tilde` has joined #ruby
Nathandim has joined #ruby
glosoli has joined #ruby
lkba has joined #ruby
X66Mammut has joined #ruby
tayy_ has joined #ruby
rohit has joined #ruby
Shrink has joined #ruby
lucaspiller has joined #ruby
kah has joined #ruby
Talvino has joined #ruby
Divinite has joined #ruby
<Divinite>
Hello all!
Sliker has joined #ruby
Spockz has joined #ruby
jonathan___ has joined #ruby
hasrb has joined #ruby
<jonathan___>
Hi all, I've difficulties with rvm
<jonathan___>
I'm trying to set a ruby version for all the users with sudo rvm use xxx -default
<jonathan___>
and I get a "RVM is not a function, selecting rubies with 'rvm use ...' will not work."
tayy has joined #ruby
<jonathan___>
but the sudo rvm install xxxx works perfectly before
mdw has joined #ruby
<jonathan___>
any hints ?
Vert has joined #ruby
<JonnieCache>
i know that the environment is not preserved when you sudo
<jonathan___>
and I can do a "rvm use xxx" for my user
<jds>
jonathan___: The #rvm channel tends to be pretty good, I'd try there
<JonnieCache>
AAARGH how can I make rake show tracebacks every time
<Divinite>
I love it when that happens
<JonnieCache>
i hate it so much when Im trying to test a long running rake task and it just gives me the exception and not the backtrace
<JonnieCache>
and helpfully tells you to run it again with --trace
glosoli has joined #ruby
<JonnieCache>
it may as well show a great big ascii middle finger
<Divinite>
LOL
Richmond has joined #ruby
frishi has joined #ruby
philcrissman has joined #ruby
Ammar01 has joined #ruby
fr0gprince_mac has joined #ruby
visof has joined #ruby
visof has joined #ruby
thone_ has joined #ruby
joppe_ has joined #ruby
randym_ has joined #ruby
jonathan___ has joined #ruby
<shevy>
rake never worked for me
<Tasser>
shevy, yep. $ARGV.shift ftw
<shevy>
hehe
bashdy has joined #ruby
glosoli has joined #ruby
moshef has joined #ruby
pu22l3r has joined #ruby
KL-7 has joined #ruby
briankbuckley has joined #ruby
nanderoo has joined #ruby
baniseterfiend` has joined #ruby
<JonnieCache>
omg omg its an impersonator. dont think we wont notice the extra e...
zaydana has joined #ruby
Divinite has joined #ruby
zomgbie has joined #ruby
LMolr has joined #ruby
BiHi has joined #ruby
alem0lars has joined #ruby
RubyPanther has joined #ruby
jmcphers has joined #ruby
nari has joined #ruby
Helius has joined #ruby
al3xnull has joined #ruby
wyhaines has joined #ruby
waxjar has joined #ruby
Vert has joined #ruby
cachemoney has joined #ruby
`brendan has joined #ruby
<`brendan>
morning
cachemoney has joined #ruby
<JonnieCache>
afternoon
kaneda_ has joined #ruby
kaneda_ has joined #ruby
choffstein has joined #ruby
the_hack has joined #ruby
fearoffish has joined #ruby
arturaz has joined #ruby
peterhellberg has joined #ruby
avalarion has joined #ruby
<JonnieCache>
`@success = if block_given?` wtf state_machine
imsplitbit has joined #ruby
<JonnieCache>
ah ok just odd indentation...
<avalarion>
Aloha, I have never worked with ruby, only with PHP, Java, C#, ... I need to open mygit/config and read url = (MYNEEDS)... Is it easy in Ruby?
speggey has joined #ruby
fermion has joined #ruby
<JonnieCache>
yeah you can use the normal file api and there's a git library that could read that out
<avalarion>
JonnieCache: are you able to tell me the preg_match variant of ruby?^^
<scalebyte>
@user.stat.location_id = loc_id if loc_id not null how can I do this in a line ?
<scalebyte>
Tasser: ^
ascarter has joined #ruby
drbawb has joined #ruby
drbawb has joined #ruby
codebeake has joined #ruby
Ammar_Frameworks has joined #ruby
jesly has joined #ruby
<LMolr>
scalebyte: I guess @user.stat.location_id = loc_id if !loc_id.nil?
drbawb has joined #ruby
drbawb has joined #ruby
zomgbie has joined #ruby
<scalebyte>
LMolr: thanks
shruggar has joined #ruby
<LMolr>
npnp
philcrissman has joined #ruby
d34th4ck3r has joined #ruby
dv310p3r has joined #ruby
simao_ has joined #ruby
havenn has joined #ruby
emmanuelux has joined #ruby
crankycoder has joined #ruby
oposomme has joined #ruby
liluo has joined #ruby
oposomme has joined #ruby
ryannielson has joined #ruby
virunga has joined #ruby
cjs226 has joined #ruby
geekbri has joined #ruby
JonSchuff has joined #ruby
philips has joined #ruby
carlyle has joined #ruby
cantbecool has joined #ruby
csherin has joined #ruby
btanaka has joined #ruby
heftig has joined #ruby
td123 has joined #ruby
speggey has joined #ruby
conntrack has joined #ruby
vraa has joined #ruby
fbernier has joined #ruby
LBRapid has joined #ruby
<philcrissman>
scalebyte: if you're getting a mass assignment error, then you are probably trying to assign to an attribute that is not listed in attr_accessible
<philcrissman>
scalebyte: that is a wild guess. check. :)
<scalebyte>
philcrissman: yes... hw can I handle it
<philcrissman>
scalebyte: do you understand what attr_accessible is?
<scalebyte>
philcrissman: no
<philcrissman>
scalebyte: then why are you using it?
<philcrissman>
scalebyte: oh for crying out loud. It would be in your model.
<scalebyte>
philcrissman: didnt get you
ChampS666 has joined #ruby
<philcrissman>
I saw the code. You don't get a mass assignment error unless you've restricted which attributes can be mass assigned.
<JonnieCache>
lol its definitely time for lunch
<JonnieCache>
good luck boys and girls
<philcrissman>
JonnieCache: :)
<scalebyte>
philcrissman: actually the user attributes are updates via two ways..
<philcrissman>
scalebyte: what does your model look like?
berkes has joined #ruby
theishi has quit [#ruby]
<scalebyte>
model has user preferences which are hash values
<philcrissman>
...
<philcrissman>
scalebyte: okay, man. Good luck.
<scalebyte>
thanks :)
<shevy>
haha
<shevy>
rails. kills. brains.
<scalebyte>
philcrissman: its tought to explain neverthless il try it !! thanks
phantasm66 has joined #ruby
<philcrissman>
scalebyte: look in your model for an attr_accessible line. Or the inverse of it, whatever that is, I forget.
<scalebyte>
philcrissman: sure thanks
quicoju has joined #ruby
workmad3 has joined #ruby
<philcrissman>
attr_protected, that's it.
__sri has joined #ruby
kenyabob has joined #ruby
<shevy>
that exists???
<shevy>
is that another railism madness?
<shevy>
come on say you are kidding
bbttxu_ has joined #ruby
BRMatt has joined #ruby
briankbuckley has joined #ruby
polysics has joined #ruby
<polysics>
hello! got this weird thing
<polysics>
i am using Celluloid as a requirement for another project
<polysics>
when i run tests on a freshly cloned repo on my Mac, i get all sorts of dead actor failures
<polysics>
on Debian, everything works correctly
<polysics>
others in the team do not have the same issues
<Tasser>
so use debian :-)
<polysics>
we have NO idea whatsoever about what is causing that
<polysics>
Tasser: ok, that's a good option, i wanted to delve into the issue a bit though :-D
NotMyself has joined #ruby
<polysics>
i am suspecting the issue could be with "ffi"
<polysics>
Celluloid has gem 'ffi', :platform => :mri in the gemfile
<polysics>
oh, btw, i am running on 1.9.3 installed through RVM
KL-7 has joined #ruby
francisfish has joined #ruby
<ceej>
so I've been running rdoc -a --ri to generate the ri docs, but it's taking a looong time with all the gems now every time I need to update them. Is it possible to just re-generate the docs for a certain file/folder?
tvo has joined #ruby
<fbernier>
polysics: cool to hear people using celluloid :)
<polysics>
it's very good and solves a lot of problems, yet this is pretty odd
<polysics>
again, i think i should actually blam FFI
<fbernier>
polysics: I believe celluloid uses nio4r which uses libev. Maybe it's something about the libev version installed
<polysics>
i have a Snow Leopard machine with LLVM on it because of XCode 4 needs
<polysics>
i strongly suspect there's some mismatch in there, yes
<polysics>
how does one find out which version of libev i have?
<fbernier>
no clue :P
<philcrissman>
shevy: what? attr_accessible and attr_protected? Yes, both rails methods.
<fbernier>
the celluloid author also hangs on #celluloid.
<philcrissman>
shevy: where's the madness? o_O
rippa has joined #ruby
Seisatsu has joined #ruby
axl_ has joined #ruby
<fbernier>
polysics: looks like you can install libev using homebrew: brew install libev
tvw has joined #ruby
Jay_Levitt has joined #ruby
tobym has joined #ruby
speggey has joined #ruby
abstrusenick has joined #ruby
trivol has joined #ruby
polysics has joined #ruby
simao has joined #ruby
mrake has joined #ruby
Morkel has joined #ruby
virunga has joined #ruby
<polysics>
i installed libev through homebrew
<polysics>
is there a flag i can pass to have ffi find it?
<fbernier>
I don't know ... =/
hydrozen has joined #ruby
<fbernier>
maybe clean your gemset and rerun bundle
<polysics>
i have just done that
<fbernier>
k
<fbernier>
dunno then
<fbernier>
im running xubuntu and it works .. :P
<polysics>
recompiling ruby won't do anything i suppose
havenn has joined #ruby
Sailias|work has joined #ruby
segora has joined #ruby
PragCypher has joined #ruby
martman has joined #ruby
<martman>
im using self.send to call a method. i have a variable that when its not nill should be passed
davidpk has joined #ruby
briankbuckley has joined #ruby
<martman>
and im doing this in a bunch of locations
<martman>
is there a clean way of doing this?
snip_it has joined #ruby
<martman>
can i avoid having a if statement before every single send?
andynu has joined #ruby
jpreyer has joined #ruby
<martman>
can i treat everything after the method name as a string, and remove all nils?
<martman>
otherwise its not needed and shouldnt be passed
<JonnieCache>
shevy: yes attr_protected does exist. its a blacklist to attr_accessible's whitelist
<JonnieCache>
i dont think its so bad, but yes its just one more thing
<becom33>
after pra.host , the next word goes bounce to next line http://pastebin.com/2pDTevXw , how can I stop that
<becom33>
fix that *
<darthdeus>
hey guys, is there any simple way to create a paused thread that I can start later? I don't see any method like #pause in the docs
<JonnieCache>
darthdeus: look up Thread#join
davidcelis has joined #ruby
<darthdeus>
JonnieCache: isn't #join for synchronization? I want to be able to create a bunch of threads, and then start them in batches
<becom33>
anyone ?
<polysics>
why create them before?
<JonnieCache>
darthdeus: yes join is for synchronisation, and what you want to do is a special case of synchronisation
<darthdeus>
because their proc is a closure
<JonnieCache>
unless ive misunderstoodf
<polysics>
becom33: file.gets.chomp maybe?
__sri has quit ["Leaving..."]
<any-key>
file.gets.nom
undersc0re has joined #ruby
undersc0re has joined #ruby
<yairgo>
I'm trying to install 1.9.3-p125 from source and ./configure gives me an error, `configure: error: could not make ./config.status` anyone have any ideas?
<darthdeus>
i basically have a list of http requests, and i'm executing each in a separate thread and then join them all at once ... so my idea was to create them paused, and then resume in bulks, such as 20 threads at a time, so they won't just hit the server all at once
<any-key>
yairgo: are there any log files?
cpruitt has joined #ruby
<any-key>
you may not have gcc and the other necessary development tools installed
<becom33>
polysics: now Im getting a error http://pastebin.com/wUF3aZ0a . maby bcoz last loop doesnt have a value . how can I fix dat >
<becom33>
?
<JonnieCache>
i changed some of your variable names too because i didnt like them :)
<any-key>
yairgo: I'm not sure; googling for it doesn't return much either
<JonnieCache>
tbh that code is a nightmare, you should rewrite it in a less clever way
<JonnieCache>
at the very least add some comments
<yairgo>
any-key found conf.log, not seeing anything exciting in it though(but it is 20186 lines...)
<yairgo>
any-key yeah I know, that's why I'm here
<any-key>
wish I could help more :\
<martman>
JonnieCache: how does that help? if arg isnt nill, id like it passed for both setter and getter
<martman>
JonnieCache but if it is nil it shouldnt be
<JonnieCache>
ah right sorry
<JonnieCache>
why not just send it anyway and have the other method ignore the nil?
jesly has joined #ruby
wmoxam has joined #ruby
shellox_ has joined #ruby
<martman>
JonnieCache: more code to change that way. seems better to have the unit testing coding bending over backwards for the code than the other way around too
<martman>
if possible
<JonnieCache>
ah ok its some testing code. that makes more sense
<martman>
yup
<JonnieCache>
didnt catch that if you said so, sorry
kevinbond has joined #ruby
<martman>
nah thats fine
<martman>
just keep thinking theres a clever way todo this
<JonnieCache>
so you want to pass the arg variable in the send calls on lines 5, 7 and 9, but only if its not nil?
<scalebyte>
rippa: each time i update the other attributes the preferences params are getiing {}
speggey has joined #ruby
<andynu>
scalebyte: could be a few things, first I'd add a few parens. precidence on that preferences= line is unclear. Second are you certain that you are ALWAYS passing params[:preferences]?
<tex3l>
i could write this, but i'm surprised it doesn't already exist
<scalebyte>
andynu: preferences are updated via another page using checkboxes and if params[:user][:preferences] is nil, then we pass an empty hash (if user unchecks all checkboxes)
<andynu>
I bet you're getting evaluated like this: @user.preferences = (UserPreference.new params[:user].nil?) ? {} : params[:user].delete(:preferences)
<rippa>
tex3l: i guess, it's not very common usecase
<scalebyte>
andynu: but when i update the other user attributes from other page it again gets params[:user][:preferences] as null since i am not upadting preferences there so it updates the preferences again with empty hash
al3xnull has joined #ruby
<tex3l>
rippa: must be- granted this is the first time I've needed it too
alex__c2022 has joined #ruby
<tex3l>
rippa: each w/ break is a great shorthand for it though- didn't realize that breaking from each returned the block result!
tayy has joined #ruby
<andynu>
I suggest splitting it out into two calls, update_preferences, update_attributes
<scalebyte>
andynu: but eventually for updating the update action will be called ryt ?
nw has joined #ruby
<andynu>
oh, resources mapping in rails? yeah.
eldariof has joined #ruby
<andynu>
scalebyte: try interrogating your @user object a bit, you're blindly resetting preferences there every time without checking what you already have on your found object.
chaitanya has joined #ruby
<scalebyte>
andynu: ok so can I do something like set a hidden field in the form and then if the value is true update preferences ?
<pleiades>
to youtube myself freeclimbing a skyscraper.. pwca is on.. thats why i want see if i want to come.. hes a single core 1.2ghz with 768mb ram..
<pleiades>
but i have multiple HDDs in the national guard was there.. i love those kind..
<andynu>
hashpuppy: i've always done that manually. :(
<pleiades>
is long asyou arenoy locked up try to behave but if yoiu areagain dont in jail or psyche wardsitsbetter if peoplearescared of you
<hashpuppy>
yeah... think i found a SO answer to this
<pleiades>
have to look after my previous record of 0%..
<pleiades>
ill idle for 6 hours straight..
<pleiades>
grub is just a little shell. grub is the default bootloader that ubuntu puts there.. escape on boot gets you into grub.
axl_ has joined #ruby
<pleiades>
do you know someone you could be using a pseudonym of wilfred jenkins the third
adamjleonard has joined #ruby
mikepack has joined #ruby
g0bl1n has joined #ruby
blueadept has joined #ruby
axl__ has joined #ruby
Sailias|work has joined #ruby
Spockz has joined #ruby
<theishi>
what is the best way to extract the portion of a string surrounded by parenthesis? 'blah (info) foo'.... turn that into 'info' for example?
aibo has joined #ruby
andrewhl has joined #ruby
ph^ has joined #ruby
glosoli has joined #ruby
<v0n>
hi guys
<v0n>
can @obj.a.b in a loop be a performance issue (instead of a = @obj.a; a.b)?
<scalebyte>
andynu: i added hidden field in the form like this https://gist.github.com/1951009 and also modified the update action like this https://gist.github.com/1949945 but getting the error : ActiveModel::MassAssignmentSecurity::Error in UsersController#update Can't mass-assign protected attributes: hidden, preferences
<scalebyte>
andynu: where am I going wrong ?
flak has joined #ruby
davidcelis has joined #ruby
lorandi has joined #ruby
<andynu>
do not use f.hidden, f.hidden is differen then hidden_field_tag in that the input that generates is named user[hidden] instead of just hidden
<andynu>
so now your user update part is trying to set a "hidden" attribute of your user object, which is not what you want
kidoz has joined #ruby
<andynu>
just swap out f.hidden to hidden_field_tag instead.
<andynu>
hidden_field_tag :hidden, true
<andynu>
skip the rest of that hash stuff that is only for f.hidden
bagratte has joined #ruby
<scalebyte>
andynu: so u meant o say hidden_field_tag :hidden, true instead of the second line ?
<andynu>
correct.
<andynu>
take a look at the generated html now, and after the change.
<andynu>
instead of user[hidden], so it won't get caught up in your update user attributes stuff.
<scalebyte>
so what can i have in the controller instead of unless params[:hidden] == "true" @user.preferences = UserPreference.new params[:user][:preferences].nil? ? {} : params[:user].delete(:preferences) end
<andynu>
yup
JonnieCache has joined #ruby
<andynu>
a moment ago your field was actually params[:user][:hidden]
j0bk has joined #ruby
<scalebyte>
andynu: yes u r right... now hw to modify the controller for checking it
_obiJuan has joined #ruby
<andynu>
your controller looks good.
<philcrissman>
scalebyte: weren't we talking about this earlier? Did you look in your model for attr_accessible or attr_protected?
<philcrissman>
scalebyte: the error is "can't mass assign protected attributes".
enherit has joined #ruby
<scalebyte>
philcrissman: yes mate but i think a hidden field and check in the controller for its value will solve the problem rest all is done :)
<scalebyte>
andynu: so u mean i dnt have to change the controlle now ?
<andynu>
nope. your controller was referencing the hidden param correctly.
glosoli has joined #ruby
<scalebyte>
andynu: i still get the same error.
<philcrissman>
scalebyte: how will it do that? You'll need to either change your model, or explicitly assign the hidden and preferences column in the action.
<andynu>
`p params` for us.
<philcrissman>
scalebyte: is there a "hidden" column in your model?
<scalebyte>
philcrissman: no
<andynu>
philcrissman: he just wants a variable to switch off of for updating the preferences on one screen and not on others.
<philcrissman>
scalebyte: it's trying to update the model in the first "if" line. You'd want to check for and assign params[:preference] BEFORE you call update_attributes
<scalebyte>
andynu: exactly.. thats why we have hiden fields for... :)
<philcrissman>
scalebyte: otherwise you'll keep getting that error.
<scalebyte>
philcrissman: so please modify the controller ///
<philcrissman>
scalebyte: !
<philcrissman>
wft
<philcrissman>
scalebyte: so please learn rails.
<scalebyte>
andynu: what next we r close to the goal i guess..
<philcrissman>
scalebyte: I just told you (as have others, probably) both earlier and now what the issue is and how to fix it. I'm not writing your code for you.
<andynu>
We need to see what your params are.
<philcrissman>
scalebyte: !try
<andynu>
I think you didn't update the form correctly.
<scalebyte>
andynu: leme try
<scalebyte>
andynu: thanks
<philcrissman>
oops, not in #ror, no helpa. :(
nw has joined #ruby
nixmaniack has joined #ruby
<andynu>
hrmn, good point, this quickly strayed from pure ruby.
<scalebyte>
andynu: same error mate
<andynu>
ah, but now you should have some output on the console that you can show us the params
<philcrissman>
scalebyte: I just told you what to change.
<scalebyte>
philcrissman: please repeat il do that
<philcrissman>
philcrissman: scalebyte: it's trying to update the model in the first "if" line. You'd want to check for and assign params[:preference] BEFORE you call update_attributes
<philcrissman>
and you'll want do delete it from params before calling update_attributes. That or just update your model; is there are reason that attribute is protected>
<philcrissman>
?
<andynu>
philcrissman: yup. if it is expecting a UserPreferences object and it is really plucking some hash out of params in the update_attributes, you're right.
<philcrissman>
andynu: according to the error he posted about, it's trying to mass assign preference, which is protected. That's set in his model. I don't know how it's set, as scalebyte hasn't posted the model.
<philcrissman>
andynu: he asked this way earlier this morning, I tried to tell him the same thing hours ago.
<philcrissman>
scalebyte: that new gist might work, try it.
<philcrissman>
scalebyte: looks like you're on the right track.
<philcrissman>
scalebyte: but again; this is a lot of trouble to go to if there is no reason for that attribute to be protected.
<scalebyte>
philcrissman: the assignment does happen as usual... it was working also bt when the other attributes were updates preferences were also getting over written with it so i thgt of having a hidden field in the submit form
kpshek has joined #ruby
* apeiros_
senses #rubyonrails
<andynu>
https://gist.github.com/1951384 - i think you'd have tinge of trouble if you inadvertantly pass preferences on a page without the hidden form field, you want to be deleting the params[:user][:preferences] either way.
<scalebyte>
philcrissman: the gist i told worked
cbuxton has joined #ruby
<scalebyte>
philcrissman: andynu : let me confirm by updating the other attribyes as well if preferences are also over writter or not
<philcrissman>
scalebyte: but do you know _why_ it worked? You should really read about mass assignment. You wouldn't have had to take this long to figure it out. :)
<andynu>
philcrissman: ++
<scalebyte>
philcrissman: it works perfectly mates.. thanks a ton andynu and philcrissman :)
<philcrissman>
sheesh
<philcrissman>
i give up
<andynu>
lead a horse to water.
<philcrissman>
"It works I don't care why"
<scalebyte>
philcrissman: il really agree with u and will learn abt those concepts its just that i was in a hurry to get this done... and i will seriously consider your points :)
<philcrissman>
scalebyte: ok. That is all we ask. :)
havenn has joined #ruby
banisterfiend has joined #ruby
savage- has joined #ruby
<scalebyte>
philcrissman: I am not somebody as u said who just wanna get things done... I will definety go learn those concepts u mentioned once I am done with this ;)
<scalebyte>
and thanks once again andynu and philcrissman :)
<andynu>
and now back to your regularly schedule ruby. Hash rockets, I don't miss'm.
<philcrissman>
scalebyte: alright, sorry. :) Have fun; glad that it is working. You could have solved it much quicker, though. Just saying.
SegFaultAX|work has joined #ruby
<scalebyte>
philcrissman: i understand will look into actually I am a rails newbie.. hardly few months into bt lots of work at office :) So
s_dana has joined #ruby
banisterfiend has joined #ruby
tkellen has joined #ruby
KL-7 has joined #ruby
davidcelis has joined #ruby
pantsman has joined #ruby
artOfWar has joined #ruby
davidpk has joined #ruby
coucher has joined #ruby
dhruvasagar has joined #ruby
hooper has joined #ruby
<scalebyte>
andynu: philcrissman : mates everythings working fine exept for when i uncheck all the checkboxes and submit .. I get an error : NoMethodError in UsersController#update undefined method `[]' for nil:NilClass
<philcrissman>
scalebyte: you'll have to look for which line it is. and see why.
<philcrissman>
scalebyte: something is nil.
<scalebyte>
philcrissman: but I already have this line @user.preferences = UserPreference.new(params[:user][:preferences].nil? ? {} : params[:user][:preferences])
<apeiros_>
you guys know that there's #rubyonrails ?
<philcrissman>
scalebyte: oh, then clearly the error is wrong. tell it to run your code.
<scalebyte>
philcrissman: in my controller that takes care of the empty hash (all checkboxes unselected)
<scalebyte>
philcrissman: :-/
nachtwandler has joined #ruby
<philcrissman>
apeiros_: you're totally right. I just started to help and kept helping. Or trying.
<philcrissman>
scalebyte: apeiros_ makes a good point. /join #rubyonrails
<JonnieCache>
hes b& from the rubyonrails channel
<JonnieCache>
cant think why
<philcrissman>
JonnieCache: ooh.
<philcrissman>
lol
<apeiros_>
prolly due to webchat
<JonnieCache>
unless im thinking of someone else in which case i apologise unreservedly
jgrevich has joined #ruby
kenperkins has joined #ruby
<scalebyte>
philcrissman: ppl talk less abt rails in that room :)
<philcrissman>
scalebyte: that's not true. But, whatever.
<scalebyte>
philcrissman: just help me fix this bug and i am done :) and then to study all the concepts
<apeiros_>
JonnieCache: it doesn't seem like he's banned - at least I see no matching mask…
<philcrissman>
scalebyte: dude, I am working. I'm not fixing it for you. Learn to use a debugger. ruby-debug.
<JonnieCache>
the thing is, fixing the bug and learning about the concepts are *one and the same*
CannedCorn has joined #ruby
<philcrissman>
put in logger statements. whatever. I have my own work to do. :/
adeponte has joined #ruby
<CannedCorn>
rails log colors, what do they indicate?
<CannedCorn>
active record rather
<philcrissman>
CannedCorn: colors?
<CannedCorn>
nvm, will ask in #ror
artOfWar has joined #ruby
<JonnieCache>
CannedCorn: i think they just alternate so you can pick out one line from another more easily
<JonnieCache>
they dont mean anything afaik. or maybe im wrong
<CannedCorn>
ah
<CannedCorn>
lame, i thought they indicated read/write
<scalebyte>
philcrissman: please help me and go... we did it together.. ur lil help ccould help me fix this faster pls mate !!
tewecske has joined #ruby
<philcrissman>
scalebyte: read the error.
<philcrissman>
scalebyte: or join #rubyonrails
<philcrissman>
scalebyte: or actually figure out how to use ruby-debug. I learned rails in the console and by peppering my code with logger statements. You can figure it out, just try.
<JonnieCache>
CannedCorn: they could well indicate read/write. that would make sense.
<scalebyte>
philcrissman: got it fixed
becom33 has joined #ruby
<philcrissman>
scalebyte: see, I told you you could do it.
<philcrissman>
That took you 2 minutes.
<scalebyte>
philcrissman: yes thanks just had to add an else for loc_id
probst has joined #ruby
<scalebyte>
philcrissman: thanks mate for encouraging me :)
tdelam has joined #ruby
badabim has joined #ruby
the_hack has joined #ruby
<philcrissman>
scalebyte: np. seriously, though. #rubyonrails is the channel for questions having more to do with rails than with ruby.
<scalebyte>
philcrissman: yes I will b there once I get unbanned :)
<philcrissman>
uhm. oh.
<andynu>
good grief.
eywu has joined #ruby
<becom33>
I wanna print a ascii banner in ruby script . its multi line how can i print that ?
<JonnieCache>
use the heredoc syntax
<becom33>
JonnieCache: is that for me ?
<JonnieCache>
yes sorry
<becom33>
JonnieCache: is has some special caractor would that be a problem ?
<apeiros_>
JonnieCache: was that for him too? :)
tdelam has joined #ruby
triptec has joined #ruby
Wizek has joined #ruby
apok has joined #ruby
speggey has joined #ruby
greenarrow has joined #ruby
ascarter has joined #ruby
savage- has joined #ruby
nachtwandler has joined #ruby
ph^ has joined #ruby
maletor has joined #ruby
steakknife has joined #ruby
crankycoder has joined #ruby
sungji has joined #ruby
Ammar01 has joined #ruby
<steakknife>
Looking at arity and parameters methods, is there a way to retrieve a default parameter's expression?
Araxia has joined #ruby
nixmaniack has joined #ruby
kenichi has joined #ruby
<Mon_Ouie>
Nope, parameter name is as far as you can go
nw has joined #ruby
philcrissman has joined #ruby
briankbuckley has joined #ruby
jesly has joined #ruby
tenshihan has joined #ruby
<tenshihan>
ipc?
Wizek has quit ["Leaving"]
vraa has joined #ruby
dnyy has joined #ruby
ddv has joined #ruby
skipper has joined #ruby
<steakknife>
Seems like patching parameters to add a third element would be okay.
ed_hz_ has joined #ruby
oooPaul has joined #ruby
<steakknife>
I'll work on a patch to MRI rb_method_parameters.
ipsifendus has joined #ruby
nfluxx has joined #ruby
iamjarvo has joined #ruby
oposomme has joined #ruby
sacarlson has joined #ruby
pdtpatr1ck has joined #ruby
PragCypher has joined #ruby
shadoi1 has joined #ruby
oposomme has joined #ruby
<Mon_Ouie>
Except that involves keeping the actual expression of the parameter
<Mon_Ouie>
I assume only the bytecode is kept currently
CacheMoney has joined #ruby
Azure has joined #ruby
<apeiros_>
you could use Ripper
<apeiros_>
only works for ruby sources, but still…
wallerdev has joined #ruby
techhelp has joined #ruby
nachtwandler has joined #ruby
CoderCR|work has joined #ruby
Russell^^ has joined #ruby
notjohn has joined #ruby
oposomme has joined #ruby
tayy has joined #ruby
<steakknife>
Might be simpler in some cases to rewrite using send semantics.
amerine has joined #ruby
lkba has joined #ruby
skitrees has joined #ruby
bbttxu_ has joined #ruby
<apeiros_>
oh you don't want it for inspection/debugging?
<apeiros_>
then put your arguments into an array and use splat
<JonnieCache>
*args ftw
tvo has joined #ruby
d34th4ck3r has joined #ruby
tvo has joined #ruby
<CannedCorn>
best way to check if evironment supporst color output to STDOUT?
<steakknife>
Just tried the colorize gem. It handles tty / no tty.
<pangur>
patrons.sort allows me to sort an array of people. I would like sort patrons by the third element in each persons' array. Should I do it that way or should I create persons instead and then sort by an attribute?
<JonnieCache>
you can use sort_by with a block to sort however you want
<apeiros_>
sort itself takes a block too
nachtwandler has joined #ruby
voodoofish430 has joined #ruby
<pangur>
I can sort by surname easily enough because surname is the first element in each array.
<steakknife>
CannedCorn: note : colorize gem seems to be incompatible with awesome_print
<pangur>
It is the default for patrons.sort in my case.
<plato>
is there a way for my script foo/lib/import.rb to open the file foo/test/testdata.txt without using an absolute path?
Helius has joined #ruby
<steakknife>
plato: will the text file be relative to the source file or the project/gem root?
<plato>
oh this might work - cd foo; ruby -I lib:test lib/import.rb
savage- has joined #ruby
<plato>
i hadn't tested it properly, i had placed testdata.txt in the foo (project root) folder, and was trying to access it from lib/import.rb without doing ruby -I lib:test:.
sonkei has joined #ruby
<pangur>
http://fpaste.org/YETn/ shows my program so far. I am wondering how to instantiate Person objects. I take it that I need to have something around line 53 that will do the trick? Line 52 works fine as it stands.
<steakknife>
plato: -I adjusts $LOAD_PATH, it doesn't affect file operations.
<oooPaul>
Person.new(opt, opt, opt, opt...) is the way to instantiate an object in Ruby.
<plato>
steakknife: in import.rb i was loading test/testdata.txt, which seemed to work since i was calling it from the parent "foo" directory
<plato>
it ddin't work if i called it from "lib"
<pangur>
so something like Person.new(surname, fore, age, tel, pup, sci) should work in my case, oooPaul?
<mackid>
if you have that many options, i hope you're using an options hash...
danishkhan has joined #ruby
bbttxu_ has joined #ruby
<steakknife>
plato: calling load for a text file? o.O
<plato>
open*
Indian has quit [#ruby]
<plato>
pangur: is data.rb a csv file with one person's data on each line?
<oooPaul>
pangur: Yes.
Targen has joined #ruby
sacarlson has joined #ruby
<pangur>
No, it is just one line of csv, with 360 elements. There are 60 people.
<pangur>
six elements per person, obviously, I suppose
bbttxu_ has joined #ruby
<pangur>
That's why line 39
startling has joined #ruby
<pangur>
It breaks one long csv into 60 arrays.
<plato>
well, if you have an array of 6 things called asdf, you can do Person.new(*asdf) and it will plug the first element into surname, second into fore...
startling has quit [#ruby]
<pangur>
ah, thanks :)
eka has joined #ruby
<pangur>
That is all I need to know, I think :)
<plato>
it works the other way too
* pangur
needs to go to a meeting but thanks :)
<plato>
if you define initialize(*ghjk) in Person, ghjk will be an array containing the stuff that got passed in
<steakknife>
Given &block, is it possible to define a named method from it (or it's lambda equivalent) at the class level with subclass inheritance?
imami has joined #ruby
<apeiros_>
define_metho
<apeiros_>
+d
denom has joined #ruby
jakky has joined #ruby
danishkh_ has joined #ruby
<steakknife>
apeiros: oops, a gotcha : the resulting function must be allowed to have its own block passed to it.
Sailias|work has joined #ruby
<geekbri>
Is it valid to do something like this in an ERB? <% my_generic_variable = "#{blah['key1']}/#{blah['key2']}" %> ?
<twixmix>
geekbri: It should be as long as blah is set. It'll return the string blah1/blah2
<steakknife>
geekbri: proly not a good idea to put logic in a template. define a method or accessor elsewhere and read it.
<geekbri>
twixmix: thanks!
<twixmix>
And set generic_variable to it.
<geekbri>
twixmix, steakknife: yeah unfortunately I'm actually working around some limitations in chef so I have to access this stuff directly in the template
<steakknife>
There's another reason I don't use chef.
<oooPaul>
geekbri, very legal, but as noted, may not be an optimal design. I do that a lot if something in my view is checking the same value over and over again, as a kind of local cache.
MrGando has joined #ruby
shruggar has joined #ruby
<steakknife>
It's amazing how configuration management frameworks unintentionally forget there's an MVC pattern going on, but that's best trolled in ##infra-talk. : )
bbttxu_ has joined #ruby
<geekbri>
steakknife: Well chef typically lets you pass variables into erb's, my issue has more to do with an issue regarding compile time vs execution time of chef and when ruby_blocks are executed vs built in chef directives :)
pantsman has quit ["Leaving"]
sacarlson has joined #ruby
Kyril has joined #ruby
jergason has joined #ruby
<steakknife>
geekbri: doesn't everything execute in chef on the client as ruby code? is there some sort of production performance impact with that alternative implementation?
<Veejay>
How does one create three variables through three method calls on the same line? Something like a,b,c = * whatever with method call
<Mon_Ouie>
a, b, c = call_one, call_two, call_three
<geekbri>
steakknife: chef-client itself is ruby yes, but in the recipes you can use their directives, but there is also something called ruby_block which basically just lets you write any arbitrary ruby that will be run at execution time, instead of the compile time. The ruby you write in a recipe itself is run at compile time
<Veejay>
Say that method call is call to a FactoryClass that creates objects with random values for the attributes, isn't there anything more concise?
jergason has joined #ruby
<Veejay>
I tried [Factory(whatever)]*3 but that creates the same object three times, as expected :/
<Mon_Ouie>
Use an array
<Mon_Ouie>
Array.new(3) { … }
<Veejay>
Nice
justinmcp has joined #ruby
<Veejay>
I'll try that
<Veejay>
Thanks
<lectrick>
How do I set a shell environment variable from a Ruby script I am running in the shell?
<mackid>
i'm thinking it's ENV["MY_ENV_VAR"] = "new_value" but i'm not sure if you can write it that way
<Mon_Ouie>
Sure
a10n__ has joined #ruby
<sunaku>
mackid: that is correct
<mackid>
lectrick: yeah, what i said
<a10n__>
Hi, can someone help me please. How do I fix this error: "another rubygems is already loaded from /usr/lib/jruby/lib/ruby/site_ruby/1.8/rubygems.rb"
n8ji has joined #ruby
<sunaku>
a10n__: show us the output of: ruby -ve 'p $:'
ilyam has joined #ruby
<steakknife>
lectrick: ENV, sometimes i've used gdb to inject a syscall into another process to change a variable of a non-child process.
<a10n__>
sunaku: Thanks, so what do I have to do? I used RVM to install ruby 1.9
<plato>
ty sunaku
marvin_ has joined #ruby
<sunaku>
a10n__: in this case, you're using jruby with --1.9 flag, so it will do gem_prelude stuff (which conflicts with your jruby 1.8 rubygems)
<steakknife>
plato: special vars and more http://➡.ws/rbquickref
<sunaku>
a10n__: since you're on RVM, make a new gemset for jruby 1.9
professor__ has joined #ruby
<sunaku>
steakknife: what in the? they allow unicode chars in domain names now?
<steakknife>
snaku: yep, and gtlds for a cool million
briankbuckley has joined #ruby
<steakknife>
s/snaku/sunaku/
<sunaku>
wow
rramsden has joined #ruby
tatsuya_o has joined #ruby
<sunaku>
was this a recent thing?
<steakknife>
sunaku: nope
coreydaley has joined #ruby
i8igmac has joined #ruby
<a10n__>
sunaku: can you provide instructions?
trend has joined #ruby
<sunaku>
i remember there was opposition to unicode in domain names because it's so easy for phishers to register URLs that appear similar to the real thing
sacarlson has joined #ruby
Ferdev has joined #ruby
<sunaku>
a10n__: no, try asking in #rvm
savage- has joined #ruby
<plato>
sunaku: yeah i was concerned about that too
<steakknife>
sunaku: http://‽.ws/i18ndns
<sunaku>
steakknife: thanks!
<plato>
time for a browser extension that highlights unicode chars with a colored background in the address bar....
<steakknife>
sunaku: btw, theres going to be a bazillion talks at defcon20 about unicode *ishing
danishkhan has joined #ruby
<a10n__>
sunaku: okay thanks, i'll try to fumble around
ephemerian has joined #ruby
<sunaku>
steakknife: fun stuff for CAPTCHAs and machine learning / computer vision researchers
the_hack has joined #ruby
Foxandxss has joined #ruby
Shtirlic1 has joined #ruby
<steakknife>
apparently, there's even a wikipedia page: http://‽.ws/unicode_dns_phising
shruggar has joined #ruby
dv310p3r has joined #ruby
<steakknife>
btw, check it out . . . a unicode gtld http://рнидс.срб
delinquentme has joined #ruby
<lectrick>
mackid: sunaku: My understanding is that ENV[whatever]=whatever only sets env variables for shells fired off from the current ruby process, not the parent shell
erikstraub has joined #ruby
<delinquentme>
hey all I'm installing jruby on an ec2 instance .. and trying to figure out which file I need to execute on to install JRubah
<Mon_Ouie>
Your C test would be more fair if you only compiled the regexp once
ylluminate has joined #ruby
<Mon_Ouie>
Since that's what Ruby will do
kirun has joined #ruby
the_hack has joined #ruby
<steakknife>
Mon_Ouie: setenv is part of POSIX.1, so if there's a debugger that can attach to running processes and inject system calls, then there's a way.
kevinbond has joined #ruby
jergason has joined #ruby
jroes has quit [#ruby]
libertyp1ime has joined #ruby
speggey has joined #ruby
sacarlson has joined #ruby
PragCypher has joined #ruby
twixmix has quit [#ruby]
fermion_ has joined #ruby
Redjack1964 has joined #ruby
davidcelis has joined #ruby
Indian has joined #ruby
jrist has joined #ruby
<lectrick>
How do I figure out which process is holding a port open?
tkellen has joined #ruby
<cespare>
lectrick: one thing to do is 'lsof -i :4567'
<cespare>
where 4567 is the port you care about, obviously :)
sacarlson has joined #ruby
cjs226 has joined #ruby
banseljaj has joined #ruby
vraa has joined #ruby
havenn has joined #ruby
<sunaku>
lectrick: that is how the underlying setenv() syscall is designed
CoverSlide has joined #ruby
davidpk has joined #ruby
Nisstyre has joined #ruby
tkellen has joined #ruby
sacarlson has joined #ruby
denom has joined #ruby
kevinbond has quit [#ruby]
fermion has joined #ruby
headius has joined #ruby
Squee-D has joined #ruby
Nisstyre has joined #ruby
iocor has joined #ruby
<kapowaz>
is there a standard library mechanism for determining the distance between two dates as an integer (rather than in words), in years?
<banseljaj>
shevy: thanks for the gtk2 suggestion. it is working out quite nicely
<jmrtn>
Mon_Ouie: I didn't know about zip… And there may not always be an equal quantity of labels and groups
norex has joined #ruby
sacarlson has joined #ruby
<dominikh>
zip will fill in nils if the second array is too small
<jmrtn>
dominikh: yeah, I see that.
<jmrtn>
It was one of those problems where I had a strong feeling there was a method that would do what I need but I just couldn't think of it. :-)
<jmrtn>
Anyways, thanks to you both
blischalk has joined #ruby
amerine has joined #ruby
TOMMY-PENGAMEN has joined #ruby
jlogsdon has joined #ruby
tkellen has quit [#ruby]
dekz has joined #ruby
PragCypher has joined #ruby
jlogsdon has joined #ruby
the_hack has joined #ruby
bluedino has joined #ruby
jbw_ has joined #ruby
Vert has joined #ruby
chiel has joined #ruby
artOfWar has joined #ruby
<chiel>
anyone ever experienced CGI::escapeHTML double-escaping a string?
<chiel>
hmm nevermind, i'm being an idiot
j0bk has joined #ruby
alaska has joined #ruby
tayy has joined #ruby
<oooPaul>
chiel: Heehee. :)
<oooPaul>
chiel, Been there, done that, don't feel so bad. ;)
<chiel>
oooPaul: yeah, for a moment i lost my mind. :D
Nisstyre has joined #ruby
akem has joined #ruby
PragCypher has joined #ruby
bgupta has joined #ruby
sacarlson has joined #ruby
jmeeuwen has joined #ruby
<alaska>
playing around with runtime monkey patching of individual objects and have run into an interesting question. As an illustrative example, I'd like a module to define an attr_reader for an instance, not a class, and to set the value for that instance variable: http://pastie.org/3499217 The problem is that neither of the methods I'm attempting work.
<alaska>
So, I need to fix my understanding.
Spockz has joined #ruby
munx has joined #ruby
odinswand has joined #ruby
<CacheMoney>
I'm stuck and unsure how to proceed... I want to create a Game class that takes on Player objects http://pastie.org/3499570 and allows me to allocate stats to the specific player, while keeping a running total for the game instance.
<CacheMoney>
shevy: you were helping me with this yesterday.. any ideas?
chiel has quit [#ruby]
zen_ has joined #ruby
<CacheMoney>
My specific questions would be: How would a Game class create new Player objects? And how would the Game class access Player instance variables?
fayimora has joined #ruby
<shevy>
CacheMoney I would bundle all this initialization into its own method
<shevy>
I usually call it "reset"
internet_user has joined #ruby
<shevy>
you need a second class
<shevy>
Game
<shevy>
let that file then require your player class
<shevy>
then inside of class Game, you can create new player objects
<shevy>
class Game
<shevy>
def add_player(name_of_player = 'Joe')
<shevy>
@player << Player.new(name_of_player)
<shevy>
end
<shevy>
end
<shevy>
there are 10000 more ways
<lectrick>
Objects A and B are interdependent via API. Either object can be promoted to a new version independently (at least for a period of time) which may change the API. Suppose you have to be able to do this without breaking anything. Is this a solved problem?
<CacheMoney>
shevy: ahh okay... You have me going in the right direction. Thanks a bunch for the guidance
<lectrick>
Some sort of API versioning?
glosoli has joined #ruby
undersc0re has joined #ruby
philcrissman has joined #ruby
kpshek has joined #ruby
ChampS666 has joined #ruby
shtirlic has joined #ruby
bwlang has joined #ruby
sacarlson has joined #ruby
hobodave has joined #ruby
jmeeuwen has joined #ruby
<shevy>
CacheMoney also
<shevy>
I would try to write a second player class
<shevy>
and try to use not more than one instance variable in it
<shevy>
the reason is, you use many strange methods, and I think this could all be done better
Morkel has joined #ruby
shruggar has joined #ruby
<shevy>
def threemake
<shevy>
@threeAttempted += 1
<shevy>
they are all counters
fowl has joined #ruby
zomgbie has joined #ruby
<shevy>
hmm
<CacheMoney>
shevy: what do you mean? how should I store the different shot attempts then?
<shevy>
or perhaps don't rewrite. it's easier to keep it that way for now
<shevy>
CacheMoney, in a hash for instance
<shevy>
@hash['threeMade'] = 5
<shevy>
and use a method to count on that
<shevy>
add 1,'threeMade'
<shevy>
add 2,'block'
<shevy>
that hash would keep all the counters
<shevy>
but I think
<shevy>
it is better to not rewrite it soon
<shevy>
stick to your current way :)
<fowl>
good ol shevy and his walls of text
<shevy>
the method could be vice-versa too
<shevy>
add 'block', 2
<shevy>
or in symbol format
<shevy>
add :block, 2
philcrissman has joined #ruby
<shevy>
fowl, you are dead man. skyrim ate you ... :(
<CacheMoney>
shevy: ahh okay... I'll contemplate that and come up with something a little more concise once I get a Game class up and running
<CacheMoney>
I really appreciate your advice
dr_bob has joined #ruby
sacarlson has joined #ruby
<shevy>
well most importantly find your own style to write code in
shtirlic has joined #ruby
snip_it has joined #ruby
tvw has joined #ruby
shadoi has joined #ruby
SullX has joined #ruby
<SullX>
hello
<SullX>
why can't I chat in #mysql
<SullX>
?
<shevy>
SullX what error msg do u get
<SullX>
shevy: Cannot send to channel: #mysql
<fowl>
maybe you have to be registered?
<shevy>
SullX yeah register your nick then authentify, via something like: /msg nickserv identify YOUR_PASSWORD_COMES_HERE
<dominikh>
s/authentify/authenticate
<dominikh>
and to make this easier: /msg nickserv help register
<dominikh>
will outline the whole process
bwlang has joined #ruby
sacarlson has joined #ruby
kpshek has joined #ruby
scroat has joined #ruby
<scroat>
hi
<scroat>
Is there a way to do an http get using only standard libraries ?
timeout has joined #ruby
<scroat>
If not I can't use ruby. (no offense I'm just deciding if ruby is what I need. im a ruby n00by)
<timeout>
I have a hash structure with three layers and i'd like to expand the middle layer sometimes, what's the best way to do that?
notjohn has joined #ruby
<robacarp>
scroat: yes
<robacarp>
Net:HTTP
<timeout>
so, I mean I have something like filename -> path -> version and sometimes I want to add paths to a filename.
<banisterfiend>
robacarp: scroat has a good nickname dont u think
<robacarp>
um
<robacarp>
yes?
<banisterfiend>
robacarp: glad u agree
emocakes has joined #ruby
<timeout>
robacarp: *scratches head* thanks. Don't know what I was thinking.
CodeZombie has joined #ruby
<robacarp>
timeout: np. may I suggest a coffee break? :-)
<shevy>
hehe
<shevy>
are you two making out again
<banisterfiend>
shevy: hey marcus
<shevy>
banisterfiend hey. fowl is here but skyrim has changed him
<timeout>
robacarp: can't stop now!! :D
<banisterfiend>
shevy: yeah, fowl is jewish but he was never a practicing jew, now he goes to the synagogue regularly
<emocakes>
nazis
<emocakes>
whats wrong with being jewish?
<robacarp>
this is going to get awkward isn't it
<banisterfiend>
emocakes: nothing, i never said there was. I'm just talking about how he's changed
sacarlson has joined #ruby
musee has joined #ruby
aroop has joined #ruby
MrGando has joined #ruby
mengu has joined #ruby
pting has joined #ruby
musee has joined #ruby
musee has joined #ruby
musee has joined #ruby
sizz has joined #ruby
<scroat>
If there were no jews and muslims, we'd have lower gas prices.
<pangur_away>
I am struggling with http://fpaste.org/3dyE/ - especially how to generate and then access a Person.
<pangur_away>
Line 55 works for me as long as there is no line after it.
dbe has joined #ruby
dbe has joined #ruby
<pangur_away>
When I try a[i]= Person.new(... in line 56, it still does not seem to work for me.
Squarepy has joined #ruby
Squarepy has joined #ruby
<robacarp>
pangur_away: uhhh
<robacarp>
what error does it give
* pangur
is back.
<pangur>
sorry
<pangur>
I had forgotten
<apeiros_>
pangur: an `else` does NOT have a condition
<apeiros_>
if it has a condition, it's an `elsif`
<pangur>
oh
<robacarp>
hah. apeiros_ nice catch
<pangur>
I have now changed the else to an elsif and added a new else ...end
<apeiros_>
pangur: line 32-36 can be replaced with: contents = File.read('data.rb')
eka has joined #ruby
<apeiros_>
also, you probably shouldn't name it .rb if it isn't ruby code…
Redjack1964 has joined #ruby
<apeiros_>
there's quite a lot of code improvements that could be done with that pastie…
<pangur>
I have now changed lines 32-36
tommyvyo has joined #ruby
banisterfiend has joined #ruby
Sliker has joined #ruby
<CacheMoney>
Are there any websites that provide online irb's or the ability to run Ruby scripts/commands and see the output? Say for example I'm at a buddy's house and his computer doesn't have Ruby installed on it
<apeiros_>
google for tryruby
<apeiros_>
not sure how complete those are
<jordanstephens>
can I include a module into a class through a method at runtime?
<apeiros_>
jordanstephens: of course
<apeiros_>
jordanstephens: include is just a method
<apeiros_>
and there is no other thing *but* runtime in ruby.
<apeiros_>
(except for native extensions of course…)
IAmNotMyself has joined #ruby
<jordanstephens>
that's what I thought... i guess the issue is something else
Sailias|work has joined #ruby
CodeZombie has joined #ruby
the_hack has joined #ruby
<jordanstephens>
i'm trying to require a gem only if a certain method is called
arnihermann has joined #ruby
<pangur>
When I do ruby ./index.rb I get (offline mode: enter name=value pairs on standard input)
<pangur>
This is getting stranger for me
<apeiros_>
pangur: that's because you use cgi
<apeiros_>
it's supposed to be run by a webserver
<apeiros_>
if you've installed the docs properly, read `ri CGI`
<pangur>
Is there a ruby-supporting webserver that I should be running?
<pangur>
I have managed with cgi up until this point.
sungji has joined #ruby
<apeiros_>
hrm, seems ri CGI doesn't actually cover offline mode
sungji has joined #ruby
<pangur>
But then, maybe that is why cgi is no good :)
<apeiros_>
pangur: you only need a *cgi* supporting webserver with cgi.
<pangur>
Is there a server that you would recommend I install to enable me to run ruby without cgi?
<apeiros_>
if you want to go bare metal, I'd use rack
<pangur>
Is thin such a thing?
sizz has joined #ruby
<pangur>
Basically, I just want something that I can set up with the least amount of awkward configuration.
<apeiros_>
you can run rack apps with rackup quite a big range of webservers. the simplest being to just use the rackup executable that ships with rack.
<apeiros_>
well, if you consider cgi to be awkward config, you'll be pretty much lost with *anything* webbased…
<apeiros_>
(no matter the language)
Asebolka has joined #ruby
<burgestrand>
It sounds like he needs a link to Sinatra
<fowl>
banisterfiend is maori, you cant trust anything he says
<pangur>
I have Sinatra on my machine, burgestrand.
<banisterfiend>
burger stand
<banisterfiend>
fowl: what's up fowldogg
<apeiros_>
you may want to take a look at rack-server-pages
<burgestrand>
pangur: what’s wrong with it?
<pangur>
It is simply that I can run cgi in one file - it was just a short prog I had hoped.
emocakes has joined #ruby
<pangur>
There was not much to it apart from shoving the shebang at the start etc. I just wanted to get the hang of getting the program to work before I started worrying about whether the framework might be the cause of my problems.
<pangur>
I know that the real cause of my problems is my ignorance but that is a given :-)
<pangur>
Could it be that I am using eclipse as editor and that I did not start ruby using rvm?
Vert has joined #ruby
Teddy2steper has joined #ruby
Mammutpanzer has joined #ruby
<apeiros_>
pangur: look, you already identified your source of problems - your ignorance
<apeiros_>
how about you just effing google on "ruby cgi offline mode"?
carlyle has joined #ruby
<apeiros_>
it's not rocket-science, yknow?
Indian has joined #ruby
<pangur>
apeiros_: when I changed to contents = File.read("data.csv") and changed the name of data.rb to data.csv, print contents[0] does not give me the first element of array.
<apeiros_>
pangur: of course, because you haven't split it yet…
<pangur>
It gives me 77 rather than a surname
<pangur>
ok
<apeiros_>
I didn't tell you to remove the splitting part…
eka has joined #ruby
<apeiros_>
so with the code you currently have, it'd be c[0]
<apeiros_>
not contents[0]
the_hack has joined #ruby
<pangur>
yeah, that works :)
<apeiros_>
knowing & understanding your own code == big win :-p
briankbuckley has joined #ruby
<pangur>
I a newbie :)
<apeiros_>
all the more should you invest time to actually understand the code you write…
sacarlson has joined #ruby
<pangur>
I guess it is too late in the evening for me.
* pangur
is going to his bed
<pangur>
Sorry for irritating you.
<geekbri>
Is it possible in ruby to tell the backticks to invoke bash instead of sh ?
<apeiros_>
`bash foo` :-p
<apeiros_>
other than that, I think it's not ruby whom you have to tell to use bash instead of sh in subshells. afair that's something configured in your OS
<geekbri>
apeiros_: i suspected as much.. I planned on trying bash -c "", i guess thats what i'll have to do :)
liluo has joined #ruby
Norrin_ has joined #ruby
compcube has joined #ruby
pu22l3r has joined #ruby
josephap has joined #ruby
josephap has quit [#ruby]
banisterfiend has joined #ruby
nari has joined #ruby
sacarlson has joined #ruby
havenn has joined #ruby
cjs226 has joined #ruby
pu22l3r has joined #ruby
Helius has joined #ruby
sacarlson has joined #ruby
<dekz>
rubyists, what's the best way to have a range of methods mapping to commands, where each command may has a fixed number of arguments but a callback is wanted. Would you def ping(host, port, cb, *otherargs) or something else?
<dekz>
may have*
Nathandim has joined #ruby
notjohn has joined #ruby
drbawb has joined #ruby
drbawb has joined #ruby
skrewler has joined #ruby
sdwrage has joined #ruby
sako has joined #ruby
<sako>
hey guys so in python, i can do dir(object) and get all the methods