<TomyWork>
is there something like python's matplotlib, except in ruby?
<TomyWork>
i.e. 2d graph plotting
<al2o3-cr>
TomyWork: not to that extent
codefriar has joined #ruby
<TomyWork>
well i need to plot a bunch of stuff, but first i need to grab some data from a database, then do ungodly things with the data and then plot that. i'd probably hate doing the ungodly things with python
<al2o3-cr>
either gruff or gnuplot
<TomyWork>
maybe i should do the data wrangling with ruby and then save it as a json and invoke python
<al2o3-cr>
TomyWork: it's no way extensive like python's matplotlib.
<TomyWork>
it's a wrapper
<al2o3-cr>
yeah
<al2o3-cr>
not fully
<al2o3-cr>
no where near infact
<al2o3-cr>
use what you want dude
<TomyWork>
maybe I'll just figure out how to do the data wrangling part in python
<TomyWork>
or write really pedestrian code for that
<al2o3-cr>
TomyWork: might be best.
<adam12>
TomyWork: Likely not a comprehensive solution but zenspider's graphics gem can do some visuals. Maybe it's a portion of the solution you're looking for.
<al2o3-cr>
TomyWork: ?
mayurvpatil_ has quit [Quit: Leaving]
<al2o3-cr>
gruff can graph. depends what they want
<al2o3-cr>
or shell out to gnuplot and be done
marc_ has quit [Ping timeout: 268 seconds]
SeepingN has joined #ruby
marc_ has joined #ruby
<al2o3-cr>
TomyWork: YOU CODE RUBY?
conta has joined #ruby
<al2o3-cr>
oops caps on
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4350 has joined #ruby
r29v has joined #ruby
<al2o3-cr>
TomyWork: show me?
queip has quit [Ping timeout: 258 seconds]
<TomyWork>
i havent written anything yet
<TomyWork>
will do that tomorrow
r29v has quit [Ping timeout: 245 seconds]
<TomyWork>
still some technology decisions to be made
<TomyWork>
like, whether to use ruby/python at all
<TomyWork>
and not just dump the whole thing in excel and use HLOOKUP :D
<TomyWork>
hmm, that could actually be an option
<al2o3-cr>
TomyWork: ask python their input?
r29v has joined #ruby
queip has joined #ruby
r29v has quit [Quit: r29v]
r29v has joined #ruby
sagax has quit [Ping timeout: 245 seconds]
ellcs has quit [Remote host closed the connection]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikecmpbll has quit [Quit: inabit. zz.]
cisco has joined #ruby
cisco is now known as Guest96502
NL3limin4t0r is now known as NL3limin4t0r_afk
fphilipe_ has joined #ruby
orbyt_ has joined #ruby
<adam12>
wrkrcoop: No idea but my first guess would be permissions on the rvm install.
<wrkrcoop>
adam12: i figured it out
<wrkrcoop>
hey im trying to create a new model in rails. if a user has an id, and i want to create a posts model, should the posts have an id and then also a field called user_id? or should user id come first?
orbyt_ has quit [Client Quit]
fphilipe_ has quit [Ping timeout: 250 seconds]
fphilipe_ has joined #ruby
Guest96502 has quit [Ping timeout: 245 seconds]
cisco has joined #ruby
deepreds1 has quit [Ping timeout: 268 seconds]
cisco is now known as Guest40466
SeepingN has joined #ruby
code_zombie has joined #ruby
rhythmx has joined #ruby
conta has quit [Quit: conta]
<Net>
A common pattern I encounter is writing a class with only one public method so that instance variables can be shared amongst its private methods. Is there a superior way of handling such cases?
mahlon_ is now known as mahlon
fphilipe_ has quit [Ping timeout: 252 seconds]
<wrkrcoop>
how do i open up postgres to view my rails database?
<wrkrcoop>
psql doesnt seem to work
<Net>
psql -d <your_db_name>
deepreds1 has joined #ruby
<Net>
wrkrcoop: I would do id, user_id, but it doesn't really matter
<wrkrcoop>
i need post /api/renderers/:uuid/snapshots to work
<wrkrcoop>
does that look right?
<wrkrcoop>
oops wrong channel
rubydoc_ has quit [Remote host closed the connection]
rubydoc has joined #ruby
<Net>
wrkrcoop: #RubyOnRails :)
<Net>
oh, you found it
<wrkrcoop>
how do i convert a string to a uuid?
mynameisdebian has joined #ruby
<Net>
not sure what you mean by that
<wrkrcoop>
like im trying to insert into active record its expecting a uuid but im passing in a string as a param so i need to convert it to a uuid i believe
lucasb has quit [Quit: Connection closed for inactivity]
jinie_ is now known as jinie
vjacob has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 252 seconds]
reber has quit [Remote host closed the connection]
fphilipe has joined #ruby
ramfjord has joined #ruby
maryo has joined #ruby
queip has quit [Ping timeout: 248 seconds]
bjpenn_ has joined #ruby
queip has joined #ruby
<bjpenn_>
i have some ruby code here: https://pastebin.com/xtJ8q4FZ can anyone tell me if line 4 is bad style? how im calling a variable within a class, from outside of the class?
<ruby[bot]>
bjpenn_: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<bjpenn_>
ah ok ill use gist
<bjpenn_>
ohh gist cant be used anonymously anymore?
<adam12>
bjpenn_: Not necessarily bad style. Why would you think so? There's some indirection, but that's just how Ruby works.
<bjpenn_>
whats the point of attr_methods then?
<bjpenn_>
if you can just call that var directly
<adam12>
bjpenn_: Not sure I follow.
<adam12>
The attr_ method you call sets up the getter.
<adam12>
Without attr_reader, authentication.profile would raise NoMethodError.
<bjpenn_>
ahh ok
<bjpenn_>
so its assumed theres already an attr_reader if my code works
<bjpenn_>
i didnt know that...
<adam12>
bjpenn_: attr_reader is basically def authentication; @authentication; end. Not sure if that helps explain things?
<bjpenn_>
let me fix my code paste, and add more info
<leftylink>
I didn't follow. who is doing the assuming? "it's assumed there's already"
<bjpenn_>
sorry, i meant to say it is "implied"
Swyper has joined #ruby
<bjpenn_>
heres a new paste https://dpaste.de/KF1o , line 18, if that didn't exist, I would get NoMethodError?
<adam12>
bjpenn_: Right.
fphilipe has quit [Ping timeout: 252 seconds]
<bjpenn_>
just to clarify, i was saying that since my code from line 1 to 15 works, that it was implied Auth was implemented with attr_reader on :profile
<bjpenn_>
i was asking the question without knowing how class Auth was implemented, i was under the thinking attr_reader :profile wasn't there
<bjpenn_>
and that it still worked
<adam12>
bjpenn_: I'm not following 100%, but if I was looking at a class that inherited from another class, and had no include/extend calls, the method you're calling would live on the base class or another ancestor.
<phaul>
There is some misunderstanting with the definition of Auth as well. The attr_reader :profile has 0 relation with the class instance variable @profile. It was probablymeant to be in an instance method
<leftylink>
I'd include the word afterward, but this is not really an example of wat
<bjpenn_>
interesting.. @pha
<bjpenn_>
interesting.. phaul
ramfjord has quit [Ping timeout: 248 seconds]
<bjpenn_>
i didn't realize attr_reader :foo is only supposed to be for a method "foo", not @foo
<bjpenn_>
i see it littered all over the code base, that something like attr_reader :foo references @foo
<phaul>
you can put @vars at class level, but they don't mean instance vars for the instances of the class
<leftylink>
it defines a `foo` that just returns `@foo`, that's it
<bjpenn_>
ohh ok
AJA4350 has quit [Ping timeout: 246 seconds]
<bjpenn_>
its not instance vars then, its at the class level
ramfjord has joined #ruby
jcalla has quit [Quit: Leaving]
<bjpenn_>
was a little confused by this: There is some misunderstanting with the definition of Auth as well. The attr_reader :profile has 0 relation with the class instance
<bjpenn_>
variable @profile. It was probablymeant to be in an instance method
<bjpenn_>
why does attr_reader :profile have 0 relation with the class instance variable @profile?
<leftylink>
well you saw the code right? `class X; @x = 13; attr_reader :x; end; X.new.x`
<leftylink>
that was nil, not 13.
<leftylink>
because @x in class has nothing to do with @x in an instance
<bjpenn_>
but doesnt that conflict with what you said "it defines a `foo` that just returns `@foo`, that's it"
<leftylink>
it doesn't conflict with what I said because @x in class has nothing to do with @x in an instance
<bjpenn_>
oh, if you did X.x it would work right?
<phaul>
you are on the right track but no. .x is a method call and variables can't be accessed via method call
<phaul>
it would be with X.instance_veriable_get(:@x)
<bjpenn_>
ah ok i see what youre saying
RyanMcCoskrie has quit [Ping timeout: 272 seconds]
sameerynho has joined #ruby
<bjpenn_>
heres the url for reference again: https://dpaste.de/KF1o so in line 18, if i do not have that, would line 4 still work?
<bjpenn_>
simply because line 20 makes it a class var?
buckworst has joined #ruby
houhoulis has joined #ruby
<leftylink>
&>> class X; class << self; attr_reader :x end; attr_reader :x; @x=:completely_unrelated; def initialize; @x=:to_one_another end end; [X.x, X.new.x]
<phaul>
without line 18 it would give NoMethodError. With line 18 the NoMethodError disappears, but you get nil as nobody defined profile in any instances of Auth.
<leftylink>
I admit I'm also aware that I'm being unnecessarily rude and unhelpful in my answers. I'll recuse myself.
<bjpenn_>
does this change anything at all? it seems like it would be the same as my previous
<phaul>
no as leftylink and myself demonstrated with the bot the two codes are different
<bjpenn_>
because @profile is class wide? so why does it matter whether its within `initialize` or not
<bjpenn_>
let me re-read, maybe theres somethign i missed most liekly
<bjpenn_>
(from the explanations above)
<phaul>
now it's not class wide. now it's instance wide
wrkrcoop has joined #ruby
ur5us has joined #ruby
<bjpenn_>
is there something special to the `initialize` method that makes @vars non-class?
rick_ has joined #ruby
<phaul>
what you have to know is what self is in each context. That drives most of ruby semantics. Let me recommend you a ~1.5 hr video about the ruby object model : https://www.youtube.com/watch?v=X2sgQ38UDVY
fphilipe has joined #ruby
<bjpenn_>
phaul: thanks!
vjacob has joined #ruby
<bjpenn_>
ill come back in 1.5 hours if i do not understand :) maybe less because ill probably watch it in 1.5x
<phaul>
it's not the initialize. it's the fact that inside def; end you swith self to the instance
<phaul>
from the class
<bjpenn_>
:lightbulb moment:
<bjpenn_>
thanks for spelling it out so clearly
<bjpenn_>
these little intracacies, that i probably didnt develop from READING a lot of code, and making small changes, rather than actually WRITING a lot of code
griffindy has joined #ruby
mynameisdebian has quit [Ping timeout: 244 seconds]
wrkrcoop has quit [Quit: wrkrcoop]
ur5us has quit [Remote host closed the connection]
go|dfish has quit [Ping timeout: 245 seconds]
cisco has joined #ruby
cisco is now known as Guest93791
themsay has quit [Read error: Connection reset by peer]
griffindy has quit [Ping timeout: 268 seconds]
codefriar has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]