<Ox0dea>
Have you not completely ruled out the possibility that demons got into your machine and removed the first's log, then?
jedney has joined #ruby
naftilos76 has quit [Ping timeout: 240 seconds]
Azure has quit [Read error: Connection reset by peer]
Azure has joined #ruby
<sevenseacat>
i hate when that happens.
casadei_ has joined #ruby
juanpablo_ has joined #ruby
<postmodern>
also double check that reality is not a simulation, and the laws of the universe are starting to glitch
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
shock_one has joined #ruby
cschneid_ has quit [Remote host closed the connection]
<dfockler>
another gap in my sys admin knowledge is log files
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jedney has quit [Ping timeout: 244 seconds]
<dfockler>
although I'm not a sys admin so...
juanpablo_ has quit [Ping timeout: 246 seconds]
chills42 has joined #ruby
gambl0re has quit []
demiurgen has quit [Quit: Leaving.]
Mives has quit [Ping timeout: 250 seconds]
<dfockler>
and server supervisors
shock_one has quit [Ping timeout: 256 seconds]
<shevy>
just ask systemd
linuxboy_ has quit [Remote host closed the connection]
ranchodev has joined #ruby
mleung has quit [Quit: mleung]
linuxboytoo has joined #ruby
<dfockler>
systemd help
<shevy>
:D
diegoviola has joined #ruby
<dfockler>
When would I use a lambda for something anyways?
finisherr has quit [Quit: finisherr]
<dfockler>
I've only ever needed them for callbacks in JS
ordepdev has quit [Remote host closed the connection]
casadei_ has quit [Remote host closed the connection]
clarkenciel has quit [Quit: Leaving]
* dfockler
runs off to write a monad with a lambda, knowing little about monads or lambdas
jedney has joined #ruby
linuxboytoo has quit [Ping timeout: 240 seconds]
<shevy>
dfockler I always wondered about that as well
Guest89952 has quit [Quit: leaving]
Ariadeno has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
<Ox0dea>
dfockler: You use blocks all the time, no?
<dfockler>
Yep
<Ox0dea>
They're essentially lambdae.
<Ox0dea>
If Ruby didn't give us explicit syntax for them, somebody would've made it a library. :P
RegulationD has quit [Remote host closed the connection]
David27 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
casadei_ has joined #ruby
<Ox0dea>
It's illustrative to think of lambdae as "dynamic blocks"; sometimes you're not sure which block you want to execute.
<dfockler>
Ahhh
<dfockler>
ok
hays_ has joined #ruby
Ketchy has quit [Read error: Connection reset by peer]
devoldmx has joined #ruby
Ariadeno has quit [Client Quit]
hays has quit [Ping timeout: 244 seconds]
rbennacer has quit [Remote host closed the connection]
<Ox0dea>
It's true that they're not strictly necessary, but following that logic all the way down gets us back to the bad old days of `goto` and nothing but.
<arcanez>
Ox0dea: I'm trying to figure out why I'd have .2015-07-31 and .2015-08-02. I want to rule out Lumberjack messing up
morenoh149 has joined #ruby
<bootstrappm>
posted this in #ror but got no response so I'm trying here: how do you stub Devise's authenticate_user! in controller tests?
<Ox0dea>
arcanez: Consider whether you'd be more or less alarmed if the file existed and were empty.
<bougyman>
doesn't Devise have a mock mode for that?
HAL2328 has joined #ruby
<bootstrappm>
no RSpec, just Minitest
<sevenseacat>
i'm sure that would be in the devise wiki
<bootstrappm>
does it? I'll google
<bootstrappm>
I looked in the wiki and it gives two options. One with RSpec, one for Rails 3
<arcanez>
Ox0dea: given that Lumberjack doesn't sit around waiting for the day to change and rotate, but rather checks on flushes.. I think my issue is I didn't log for a while
devoldmx has quit [Ping timeout: 265 seconds]
<bootstrappm>
actually both are w/ RSpec and the one you linked sevenseacat just tells you to simulate signing in
quazimodo has quit [Ping timeout: 244 seconds]
<sevenseacat>
bootstrappm: which is exactly what you want to do isnt it?
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ariadeno has joined #ruby
rafaelcout has joined #ruby
<bootstrappm>
well no, that requires signing in in the setup, I want the method Devise uses internally when checking for a valid auth to just return true
platzhirsch has quit [Quit: Leaving.]
<bootstrappm>
so I can do as many controller tests as I like
karapetyan has joined #ruby
<bootstrappm>
and don't have to signin in the setup of each
<sevenseacat>
you shouldnt share state between tests
<sevenseacat>
you shouldnt be mucking with devise internals either
<sevenseacat>
you should use the tools the gem provides
<bootstrappm>
but I should be logging in in tests that are not trying to test login?
<sevenseacat>
yes, if they require a logged in user to run
<bootstrappm>
the point is to test the logic of the actions
<bootstrappm>
that sounds more like an integration test to me, not really a functional test of the logic of controller action
<bootstrappm>
I'll write that one later
<sevenseacat>
all rails tests are integration tests.
<sevenseacat>
especially controller tests
charliesome has joined #ruby
<bootstrappm>
I disagree
<bootstrappm>
but thanks
<sevenseacat>
you're welcome to disagree, but it doesnt change the facts :P
Kallis has quit [Read error: Connection reset by peer]
karapetyan has quit [Ping timeout: 268 seconds]
FernandoBasso has quit [Quit: WeeChat 1.3]
dopie has quit [Quit: This computer has gone to sleep]
<zenspider>
yay minitest! what'd I miss?
marr has quit [Ping timeout: 244 seconds]
dfockler has quit [Remote host closed the connection]
s00pcan has quit [Ping timeout: 265 seconds]
<bootstrappm>
sevenseacat: you can't just take your opinion and call it a fact :P. I'm basing my opinion on the fact that the Rails documentation has separate sections for function controller tests and integration tests (http://guides.rubyonrails.org/testing.html#integration-testing) which describe their purpose very differently. Also on the fact that the wiki for integration testing describes it as tests that are " constructed to test whether all the components within
<bootstrappm>
assemblages interact correctly" ... that's not what I'm trying to test at all. The innards of Rails after the request leaves the controller action have been tested, as are the availability of request params in the action. I'm literally just testing the logic on one function where all the other stuff has been tested. Doesn't sound like an integration test to me
shmilan has quit [Ping timeout: 244 seconds]
<bootstrappm>
Even aside from that a model test where you stub out the db isn't an integration test either
<bootstrappm>
you're just unit testing a class at that point
s00pcan has joined #ruby
<bootstrappm>
a method of a class*
<bootstrappm>
so saying all rails tests are integration tests is well .... wrong
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<sevenseacat>
bootstrappm: are you stubbing out the request, response, the model layer, the view layer, and every other type of object that your controller touches?
bricker has quit [Ping timeout: 250 seconds]
<sevenseacat>
if not, then it's an integration test.
<sevenseacat>
because it tests how your controller integrates with all of those things.
Yzguy has joined #ruby
northfurr has quit [Quit: northfurr]
rbennacer has joined #ruby
quazimodo has joined #ruby
<sevenseacat>
an error in any one of those things will cause your controller test to fail.
<bootstrappm>
cool, I buy that a controller test can be considered an integration test
<bootstrappm>
but a model test w/ the db stubbed out?
<sevenseacat>
which is exactly what I said
<sevenseacat>
thanks.
<bootstrappm>
pretty sure you said "all rails tests are integrations tests." ....?
<bootstrappm>
like, verbatim
rbennacer has quit [Remote host closed the connection]
<sevenseacat>
they are. you're not stubbing out all of activerecord internals when you write unit tests
<sevenseacat>
and activerecord touches a loooot of other things
<sevenseacat>
not just the db
<bootstrappm>
okay, cool. I'll just agree to disagree, thanks
<bootstrappm>
anyways zenspider, just figuring out how to stub out some Devise stuff
<sevenseacat>
cool :)
<bootstrappm>
there are some guides but they use rspec or do it a slower way than I'd like
oo_ has joined #ruby
<bootstrappm>
gonna just mess around until I figure it out
rbennacer has joined #ruby
casadei_ has quit [Remote host closed the connection]
Mives has joined #ruby
jonr22 has joined #ruby
roxtrongo has joined #ruby
<drbrain>
if rails says "we support testing of type X and Y" saying "no, actually they only have Z" it's really hard to communicate when someone only wants to X if you make them say "Z" instead
<sevenseacat>
I think that was directed at me
jonr22 has quit [Remote host closed the connection]
<drbrain>
there was a lot of back-and-forth
vipaca has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<zenspider>
bootstrappm: why stub it at all?
<zenspider>
is it going out to an external service?
<sevenseacat>
I mean if you want to stub authenticate_user! then just stub it, thats fine. but don't muck around with devise internals, and don't pretend you're unit testing when you're not
freerobby has quit [Read error: Connection reset by peer]
Mives has left #ruby ["WeeChat 1.3"]
<sevenseacat>
why else would you want to 'stub authenticate_user!' if not to 'simulate signing in' ?
ramfjord has quit [Ping timeout: 260 seconds]
freerobby has joined #ruby
<bootstrappm>
never said unit testing but how do you say that when you're trying to do the exact same thing pretending everything is an integration test? That sounds like saying "oh well actually the test that you wrote to test that arithmetic function is an integration test because it touches a lot of other things, like Math.add". The whole point of getting tested packaged software is that you're not testing that when you write stuff on top of it
keen__________17 has joined #ruby
<bootstrappm>
but it doesn't matter really, doesn't solve the problem
maletor has quit []
<zenspider>
really seems like you two are talking past each other for the sake of talking past each other
<sevenseacat>
well my first response was the docs that explained how to handle authentication in controller tests
<bootstrappm>
zenspider: I want to stub it because I don't want to login in my test, basically. I'll test being logged in somewhere else but I just want to test the logic of the action in this test
xcesariox has joined #ruby
* sevenseacat
shrugs
jenrzzz has quit [Ping timeout: 264 seconds]
keen__________16 has quit [Ping timeout: 246 seconds]
<bootstrappm>
so I'd rather just have the auth stuff return true (a stub) so it looks like I'm logged in without having to worry about having a user in the db, the time it takes for it ACTUALLY check, etc. Just trying to get quick digestible tests
<zenspider>
bootstrappm: login... for a model's unit test? either you're not communicating something or ... I doubt there's an or
finisherr has joined #ruby
opensource_ninja has joined #ruby
<bootstrappm>
hah no, its a controller action. Simulating a request to soft delete something
<zenspider>
and you said the db was stubbed out already...
agent_white has quit [Remote host closed the connection]
<bootstrappm>
no, that was more of a hypothetical unit test in rails
tcopeland has joined #ruby
<bootstrappm>
I could stub it out though
dgutierrez1287 has joined #ruby
<zenspider>
bootstrappm: you realize you're being a pain in the ass, right?
<bootstrappm>
its on my todo list as those tests take 1.5 each
<bootstrappm>
I don't actually :/ sorry zenspider
<zenspider>
say what you mean. describe your actual problem at hand. stop obfuscating issues in order to argue
<eam>
how do I test rand()
<bootstrappm>
I tried! I just said agree to disagree and then was told disagreeing doesn't change the facts >:|
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bootstrappm>
but okay, got it
<zenspider>
what's wrong with: <blah>.current_user = user1 ? no stubbing. no nothing. (for some value of <blah>... wherever you hang that)
<bootstrappm>
hm, let me try
<drbrain>
eam: I would override it with a method that records the arguments and returns 4
<drbrain>
then verify the arguments separately
chouhoulis has joined #ruby
<eam>
it's as good of a random number as any other I suppose
<drbrain>
since it is Kernel#rand you can often override it directly on the instance you're testing
<zenspider>
4?!? no way! 42!!
<drbrain>
def subject.rand(*a) … record arguments …; 4; end
[k- has quit [Ping timeout: 244 seconds]
<eam>
I need an integration test though, how do I know the results are really random
<zenspider>
the alternative answer is: don't test rand
<drbrain>
eam: hire a cryptologist
<zenspider>
srand w/ a static seed and use rand normally
<zenspider>
your job is not to test ruby
<sevenseacat>
+1
<sevenseacat>
rubyhas its own tests
<eam>
for rand? (and you realize it's a jackass question of course)
dgutierrez1287 has quit [Ping timeout: 250 seconds]
vipaca has joined #ruby
<drbrain>
eam: (I did)
dopamean_ has joined #ruby
<eam>
sho' 'nuff test_securerandom.rb
mary5030 has joined #ruby
iateadonut has joined #ruby
jeadre has quit [Remote host closed the connection]
tejasmanohar has joined #ruby
<zenspider>
eam: you know sarcasm doesn't convey over plain text, right?
<eam>
zenspider: no, it never does. It can't, even. Impossible.
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
vdamewood has joined #ruby
CloCkWeRX has left #ruby [#ruby]
bruno- has quit [Ping timeout: 246 seconds]
havenwood has joined #ruby
Rollabunna has quit [Ping timeout: 255 seconds]
finisherr has left #ruby [#ruby]
finisherr has joined #ruby
bender_unit has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
stardiviner has joined #ruby
nettoweb has joined #ruby
finisherr has quit [Client Quit]
baweaver has quit [Remote host closed the connection]
dfockler has joined #ruby
blt has joined #ruby
howdoicomputer has quit [Ping timeout: 240 seconds]
swgillespie has joined #ruby
choke has joined #ruby
Akagi201_ has joined #ruby
RudestBuddhist has joined #ruby
Akagi201_ has quit [Remote host closed the connection]
yfeldblum has quit [Remote host closed the connection]
HAL2328 has quit [Quit: Leaving]
<RudestBuddhist>
Hey guys, I’m making my first jump into playing with JSON files. I’ve got a file that I want to find the difference between two timestamps but when I try to manipulate the keys I get a ‘no implicit conversion of String into Integer (TypeError)’. I’ve tried converting and cleaning up the file but no avail. Can someone point me in the right direction for a tutorial or something for manipulating JSON in ruby?
jeadre has joined #ruby
Akagi201 has quit [Ping timeout: 252 seconds]
toertore has joined #ruby
swgillespie has quit [Client Quit]
<dfockler>
RudestBuddhist: Make sure you aren't trying to access an array as a hash
RegulationD has joined #ruby
<havenwood>
>> []['']
<ruboto>
havenwood # => no implicit conversion of String into Integer (TypeError) ...check link for more (https://eval.in/431472)
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RudestBuddhist>
dfockler: I thought array’s were hashes in ruby?
<RudestBuddhist>
dfockler: It’s similar to a dictionary?
j4cknewt has quit [Remote host closed the connection]
<RudestBuddhist>
so am I accidently parsing that json_hash into a array?
kshah has joined #ruby
<RudestBuddhist>
it would appear so…
Jardayn has quit [Quit: Leaving]
j4cknewt has joined #ruby
<havenwood>
RudestBuddhist: Show us the Array? Are you wanting a Hash? Key/value pairs?
<kshah>
I’m running into a bizarre problem using ActiveRecord (not Rails) where my very simple loop-over-an-array-of-hashes script is causing dozens of threads to appear
<kshah>
any help appreciated, I can’t tell what the cause is
<RudestBuddhist>
havenwood: key/value pairs would be ideal
mary5030 has quit [Read error: Connection reset by peer]
RegulationD has quit [Ping timeout: 246 seconds]
mary5030 has joined #ruby
<RudestBuddhist>
havenwood: I thought that’s how I could access it but for some reason if I call json_hash[1] for example, I get the entire thing back, instead of just one key which I would expect
howdoicomputer has joined #ruby
<havenwood>
RudestBuddhist: Show us the return value and someone can explain it to you.
<RudestBuddhist>
so I have a ton of those responses from a JSON I’ve grabbed. I’d like key value pairs for each so I could compare all of the start times, and all of the end times
<havenwood>
kshah: Even if it's not a Rails app the #RubyOnRails channel is the most familiar with ActiveRecord. You might ask there as well, just mention you're cross-posting.
<kshah>
havenwood: I already have, no responses. I don’t think they can help anyway
<havenwood>
kshah: It looks like "The default ConnectionPool maximum size is 5."
<havenwood>
kshah: You're creating a connection pool for each product.
<havenwood>
kshah: 5 * x
r_baron has quit [Quit: leaving]
towski_ has quit [Remote host closed the connection]
<kshah>
havenwood: “with_connection” just checks a connection out of the pool and yields it to a block
mkosaki has quit [Read error: Connection reset by peer]
tkuchiki has joined #ruby
quazimodo has quit [Remote host closed the connection]
<havenwood>
kshah: You're not just calling #with_connection on an existing pool.
mkosaki has joined #ruby
sankaber has joined #ruby
<kshah>
havenwood: and ActiveRecord::Base.connection_pool according to L108 of connection_handling.rb just retrieves the connection pool itself
<havenwood>
kshah: I was wondering if it did after saying that. I know Ruby but not Rails.
r_baron has joined #ruby
<RudestBuddhist>
havenwood: looks like symbolize names is what I want
NightMonkey has quit [Ping timeout: 252 seconds]
<havenwood>
kshah: I'm actually I've just started learning Rails in earnest.
<havenwood>
And I waffle on how to say things and then say them badly.
darwingr has quit [Ping timeout: 250 seconds]
<kshah>
my recent experiences with Rails after being a very solid user (since 1.2.0) have been.. abysmal to say the least
<kshah>
things which were once straightforward to script up are now overly complicated and slow
<kshah>
Sequel looks to be a fine alternative as an ORM
<havenwood>
kshah: I really have been enjoying Roda lately. It's by the maintainer of Sequel.
<kshah>
sevenseacat: and I also tried not using the connection pool block as well, same problem
<sevenseacat>
kshah: is that opening a new connection for every product? >_>
juanpablo_ has joined #ruby
<kshah>
sevenseacat: that is what rhizome implied however the documentation does not state this at all, with_connection should only be checking a connection out of the pool
<kshah>
sevenseacat: regardless, when I don’t use the connection pool I have literally the same exact problem
<sevenseacat>
why not just use one single connection
<sevenseacat>
open it, use it, close it at the end
<kshah>
sevenseacat: at the start of the loop establish, at the end disconnect?
<sevenseacat>
yeah
roxtrongo has quit [Remote host closed the connection]
<kshah>
sevenseacat: Ill give that a go, I’ve done that before, not for a week though so I’ll try it again
Yzguy has quit [Quit: Zzz...]
solocshaw has quit [Ping timeout: 264 seconds]
theery has joined #ruby
rbennacer has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 240 seconds]
oo_ has quit [Remote host closed the connection]
A124 has quit [Read error: Connection reset by peer]
juanpablo_ has quit [Ping timeout: 250 seconds]
crankharder has joined #ruby
freerobby has quit [Quit: Leaving.]
<kshah>
sevenseacat: when I did that last time the startup time between the conection/disconnection was immense
<sevenseacat>
what startup time? of loading activerecord before the connection?
bender_unit has joined #ruby
xcesariox has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<kshah>
sevenseacat: establishing the connection
<sevenseacat>
i dont see how it would make a difference, whether you establish it inside the loop or outside
xylotism has joined #ruby
oo_ has joined #ruby
<kshah>
sevenseacat: we’re talking about reusing a connection or establishing it for every iteration of the loop and then closing it at the end of the loop though
bmurt has joined #ruby
cajone has joined #ruby
<kshah>
vs.
tenderlove has joined #ruby
<sevenseacat>
err... huh
<sevenseacat>
now I'm very confused as to what you're doing - I'm telling you to do the former
<sevenseacat>
use one connection for the entire import script
A124 has joined #ruby
<sevenseacat>
which should definitely be faster than establishing it n times
<kshah>
sevenseacat: that’s what I’ve been doing....
<xylotism>
Hi guys... I have a potentially complex question -- how does a GUI library like Shoes, Visualruby, FXRuby hold up vs. coding in another language, like Java or Python?
<kshah>
sevenseacat: I’m not using the with_connection block anymore, I got rid of that
pontiki has joined #ruby
<sevenseacat>
so what code do you have now?
ekain has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mase-chatter has quit [Quit: Leaving]
<xylotism>
Context: I've so far been using Ruby very effectively as a scripting tool, but I recently wanted to add more user interaction than just command line input, without developing a full web app. Something I can package and deliver to Windows/potentially Mac clients.
<kshah>
sevenseacat: well, I tried the same exact code w/those two lines (the with_connection and it’s end) commented out
<kshah>
sevenseacat: that didn’t work, went out of control again
<kshah>
sevenseacat:
tjohnson has quit [Quit: Connection closed for inactivity]
rafaelcout has joined #ruby
diegoviola has quit [Quit: WeeChat 1.3]
<kshah>
sevenseacat: so now I’m running it with establish_connection and connection.disconnect! at the top and ends of the loop respectively (inside it of course)
<sevenseacat>
lol
<pontiki>
hi
<kshah>
sevenseacat: yes, I’m aware it’s ridiculous to be establishing and disconnecting an AR connection for every single iteration of the loop
<kshah>
sevenseacat: it’s also the *ONLY* way this script is able to run somehow
<RudestBuddhist>
hey guys I have a two strings "22:49:02.871" and ”22:57:02.913”. I’d like to find the difference between those two times but .to_f and .to_i are not giving me the correct numbers. What could I convert them to so I can manipulate them with the ruby math library?
Unopoo has left #ruby ["Leaving(what's the difference between this and quitting?)"]
chills42 has quit [Remote host closed the connection]
<sevenseacat>
they look like times, not integers or floats
chills42 has joined #ruby
AndChat|159600 has joined #ruby
<RudestBuddhist>
they are times, but it didn’t look like Date would get me what I want
<RudestBuddhist>
actually it looks like the Time gem might be what I want...
<sevenseacat>
no, but Time might
<kshah>
RudestBuddhist: Time.parse
BraddPitt has quit [Quit: Lost terminal]
<RudestBuddhist>
awesome, thanks for helping the newbie :)
<sevenseacat>
RudestBuddhist: we're not all guys here also, just so you know :)
<RudestBuddhist>
hehe sorry
* sevenseacat
tries to not be passive-aggressive about it
gambl0re has joined #ruby
choke has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
samukasmk has joined #ruby
chills42 has quit [Ping timeout: 272 seconds]
* RudestBuddhist
appreciates it
nym has quit [Quit: Connection closed for inactivity]
David27 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
mary5030 has quit [Remote host closed the connection]
Xiti has quit [Quit: Xiti]
arescorpio has joined #ruby
jackjackdripper has joined #ruby
hfp_work has quit [Quit: bye]
hfp has quit [Quit: bye]
mary5030 has joined #ruby
mary5030 has quit [Read error: Connection reset by peer]
Swappticon has joined #ruby
AndChat|159600 has quit [Ping timeout: 244 seconds]
mary5030 has joined #ruby
EasyCo has joined #ruby
hfp has joined #ruby
hfp_work has joined #ruby
choke has joined #ruby
mary5030 has quit [Ping timeout: 246 seconds]
freerobby has joined #ruby
pharaoh2 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
freerobby1 has joined #ruby
freerobby has quit [Read error: Connection reset by peer]
Swappticon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
davedev24 has joined #ruby
sevenseacat has joined #ruby
tkuchiki has quit [Remote host closed the connection]
Musashi007 has joined #ruby
Fraeon has joined #ruby
anisha has joined #ruby
dopieee is now known as dopie
Oka has quit [Quit: o/]
rubie has joined #ruby
mozzarella has quit [Quit: WeeChat 1.2]
darkf has joined #ruby
ht__ has joined #ruby
pontiki has quit [Ping timeout: 244 seconds]
xcesariox has joined #ruby
Stalkr_ has joined #ruby
Stalkr^ has joined #ruby
arescorpio has joined #ruby
mary5030 has joined #ruby
Swappticon has joined #ruby
casadei_ has joined #ruby
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Stalkr_ has quit [Ping timeout: 264 seconds]
astrobunny has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
Gnomethrower has joined #ruby
Gnomethrower has quit [Changing host]
Gnomethrower has joined #ruby
ramfjord has quit [Ping timeout: 256 seconds]
craysiii has joined #ruby
khebbie has joined #ruby
centrx has quit [Quit: "You cannot fix a machine by just power-cycling it with no understanding of what is going wrong."]
khebbie has quit [Remote host closed the connection]
rehat_ has joined #ruby
jgt has joined #ruby
Jerro has joined #ruby
r_baron has quit [Ping timeout: 265 seconds]
bronson has joined #ruby
mozzarella has joined #ruby
minimalism has quit [Quit: leaving]
astrobunny has joined #ruby
bronson has quit [Ping timeout: 255 seconds]
siempref_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Swappticon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
opensource_ninja has quit [Quit: opensource_ninja]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
bricker has joined #ruby
rubie has quit [Remote host closed the connection]
Rollabunna has joined #ruby
mozzarella has quit [Quit: WeeChat 1.2]
rubie_ has joined #ruby
rubie_ has quit [Remote host closed the connection]
Rollabunna has quit [Ping timeout: 250 seconds]
fella5s has joined #ruby
dhjondoh has joined #ruby
pawnbox has joined #ruby
fostertheweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jgt has quit [Ping timeout: 240 seconds]
ruby-lang751 has joined #ruby
ruby154 has joined #ruby
oldbay has joined #ruby
ruby-lang751 has quit [Client Quit]
ruby154 has quit [Client Quit]
samukasmk has quit [Remote host closed the connection]
bootstrappm has quit [Quit: Leaving.]
pawnbox has quit [Remote host closed the connection]
tkuchiki has joined #ruby
karapetyan has joined #ruby
bootstrappm has joined #ruby
tkuchiki has quit [Remote host closed the connection]
postmodern has joined #ruby
tkuchiki has joined #ruby
devoldmx has joined #ruby
RegulationD has joined #ruby
riotjones has joined #ruby
Musashi007 has quit [Quit: Musashi007]
karapetyan has quit [Ping timeout: 260 seconds]
rubie has joined #ruby
arescorpio has quit [Ping timeout: 244 seconds]
devoldmx has quit [Ping timeout: 260 seconds]
riotjones has quit [Ping timeout: 240 seconds]
khebbie has joined #ruby
RegulationD has quit [Ping timeout: 260 seconds]
khebbie has quit [Remote host closed the connection]
mozzarella has joined #ruby
pawnbox has joined #ruby
psy has quit [Ping timeout: 246 seconds]
[k- has joined #ruby
aganov has joined #ruby
swgillespie has joined #ruby
juanpablo_ has joined #ruby
bender_unit has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leat2 has joined #ruby
pawnbox has quit [Ping timeout: 244 seconds]
Stalkr^ has quit [Quit: Leaving...]
juanpablo_ has quit [Ping timeout: 246 seconds]
codenapper has quit []
claw has quit [Ping timeout: 240 seconds]
codenapper has joined #ruby
codenapper has quit [Client Quit]
voltalio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
codenapper has joined #ruby
senayar has joined #ruby
claw has joined #ruby
Mia has joined #ruby
arup_r has joined #ruby
tagrudev has joined #ruby
dgs has quit [Ping timeout: 260 seconds]
pawnbox has joined #ruby
Musashi007 has joined #ruby
ruurd has joined #ruby
segmond has quit [Ping timeout: 244 seconds]
jackjackdripper has quit [Quit: Leaving.]
naftilos76 has joined #ruby
dgs has joined #ruby
dhjondoh has quit [Ping timeout: 252 seconds]
fedexo has joined #ruby
blt has quit [Ping timeout: 252 seconds]
krz has quit [Ping timeout: 250 seconds]
arooni_______ has quit [Ping timeout: 244 seconds]
arooni has quit [Ping timeout: 244 seconds]
andikr has joined #ruby
jonr22 has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
amclain has quit [Quit: Leaving]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
acke has joined #ruby
segmond has joined #ruby
sevenseacat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
riotjones has joined #ruby
sevenseacat has joined #ruby
jonr22 has quit [Ping timeout: 264 seconds]
bender_unit has joined #ruby
jas02 has joined #ruby
armyriad has quit [Quit: Leaving]
armyriad has joined #ruby
dhjondoh has joined #ruby
ayonkhan has joined #ruby
senayar has quit []
ilken has joined #ruby
riotjones has quit [Read error: No route to host]
ilken has quit [Changing host]
ilken has joined #ruby
claw has quit [Ping timeout: 255 seconds]
swgillespie has joined #ruby
shock_one has joined #ruby
swgillespie has quit [Client Quit]
ICantCook has joined #ruby
<ICantCook>
j #python
mary5030 has quit [Remote host closed the connection]
rehat_ has quit []
mary5030 has joined #ruby
<baweaver>
it's /join python
<baweaver>
ICantCook: ^
Axy has joined #ruby
claw has joined #ruby
nofxx has quit [Ping timeout: 260 seconds]
fostertheweb has joined #ruby
shock_one has quit [Ping timeout: 244 seconds]
nofxx has joined #ruby
Jerro has quit []
Mia has quit [Ping timeout: 244 seconds]
<ICantCook>
baweaver: Sorry, hexchat got me. I did "/join #ruby" while in another channel, and then started typing "/j #python". It ended up putting the '/' in the text field of the previous channel before Hexchat responded and moved me to this window, which got the 'join #python"
<baweaver>
heh, not a problem.
mary5030 has quit [Ping timeout: 250 seconds]
jonr22 has joined #ruby
xcesariox has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox_ has joined #ruby
last_staff has joined #ruby
tvw has joined #ruby
pawnbox has quit [Read error: Connection reset by peer]
leat2 has quit [Remote host closed the connection]
bootstrappm has joined #ruby
leat2 has joined #ruby
krz has joined #ruby
bootstrappm has quit [Client Quit]
bootstrappm has joined #ruby
tenderlove has joined #ruby
MichaelSmith has joined #ruby
shock_one has joined #ruby
pontiki has joined #ruby
lxsameer has joined #ruby
mordocai has quit [Remote host closed the connection]
firstdayonthejob has joined #ruby
fostertheweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
skade has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
oldbay has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
leat2 has quit [Remote host closed the connection]
pontiki has quit [Ping timeout: 246 seconds]
leat2 has joined #ruby
karapetyan has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Client Quit]
nhhagen has joined #ruby
jenrzzz has joined #ruby
bayed has joined #ruby
charliesome has joined #ruby
[1]kk has joined #ruby
Macaveli has quit [Remote host closed the connection]
shock_one has quit [Remote host closed the connection]
DoubleMalt has joined #ruby
karapetyan has quit [Remote host closed the connection]
howdoi has joined #ruby
karapetyan has joined #ruby
AlphaAtom has joined #ruby
kjones_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dgs has quit [Ping timeout: 260 seconds]
xcesariox has joined #ruby
RudestBuddhist has joined #ruby
karapetyan has quit [Ping timeout: 256 seconds]
beast has joined #ruby
GeissT has quit [Remote host closed the connection]
<RudestBuddhist>
Hey Everybody, I’m trying to nest some conditionals inside of a while loop. I believe I can use a while but using do … end while <some condition> correct? For some reason I can’t reach my end code. Not sure if it’s the while that is causing me issues or my if conditions. Could someone point me in the right direction?
davidhq has quit [Read error: Connection reset by peer]
khebbie has quit [Remote host closed the connection]
davidhq has joined #ruby
pontiki has joined #ruby
michael_mbp has joined #ruby
ramfjord has quit [Ping timeout: 265 seconds]
jgt has joined #ruby
skade has joined #ruby
khebbie has joined #ruby
leafybasil has quit [Remote host closed the connection]
chthon has joined #ruby
pontiki has quit [Ping timeout: 268 seconds]
jgt has quit [Ping timeout: 240 seconds]
CustosL1men has joined #ruby
morenoh149 has quit [Ping timeout: 250 seconds]
c0m0 has joined #ruby
shock_one has quit []
bazbing80 has joined #ruby
jonr22 has joined #ruby
PINGwin4IK has joined #ruby
futilegames has quit [Quit: futilegames]
dmolina has joined #ruby
<bazbing80>
hey all. If a create a class that has a | attr_reader :name | I can both read and write name to an instance of the class. same with attr_writer. I can both read and write an attribute created with attr_writer. So what's the point of attr_accessor if both attr_reader and attr_writer can both individually read and write? I mean maybe I'm wrong, this is just based in irb experimentation
nhhagen has joined #ruby
r0uder has joined #ruby
fidalgo has joined #ruby
<bazbing80>
yeah I think I was mistaken, scratch that :P
nhhagen has quit [Read error: Connection reset by peer]
<bazbing80>
okay, how can the number attribute be set if it can only be read? Is an internal method the only way? if I do | g = Gary.new | what are all the possible ways I can make g.number equal something other than nil?
nhhagen has joined #ruby
felixrsmith has joined #ruby
wpp has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
jas02 has quit [Ping timeout: 264 seconds]
marr has joined #ruby
leafybasil has joined #ruby
devbug has quit [Read error: Connection reset by peer]
<[k->
i count 3
VeryBewitching has quit [Quit: Konversation terminated!]
<jhass>
bazbing80: if you truly never defined a writer and also didn't define an initializer that takes an argument and sets it to that: instance_variable_set(:@number, x), but that way is a hack and not what the author of the class intended
jas02 has joined #ruby
<[k->
there is also instance_eval
<[k->
and def instance.number
jas02 has quit [Read error: Connection reset by peer]
cisco has joined #ruby
felixrsmith has quit [Ping timeout: 246 seconds]
<jhass>
all hacks though
nhhagen has quit [Ping timeout: 260 seconds]
cisco has quit [Max SendQ exceeded]
<[k->
and reopening the class explicitly
jgt has joined #ruby
cisco has joined #ruby
cisco has quit [Max SendQ exceeded]
cisco has joined #ruby
tenderlove has quit [Remote host closed the connection]
cisco has quit [Max SendQ exceeded]
jenrzzz has quit [Ping timeout: 244 seconds]
<bazbing80>
jhass so attr_reader's only purpose is to expose the result of a class' method of the same name?
dgs has joined #ruby
jas02 has joined #ruby
dhjondoh has joined #ruby
yfeldblum has joined #ruby
<jhass>
attr_reader :foo is a shortcut to defining the method def foo; @foo; end;
<jhass>
@foo is called an instance variable
ruurd has quit [Quit: ZZZzzz…]
astrobunny has quit [Remote host closed the connection]
<bazbing80>
jhass: ahh, now that is interesting. thanks
nhhagen has joined #ruby
astrobunny has joined #ruby
Rollabunna has joined #ruby
<[k->
it is also optimised by the interpreter and a common ruby idiom
nhhagen has quit [Remote host closed the connection]
Voker57 has joined #ruby
astrobunny has quit [Remote host closed the connection]
<bazbing80>
[k-: it's more efficient than writing def foo; @foo; end ?
tenderlove has joined #ruby
suchness has joined #ruby
tenderlove has quit [Remote host closed the connection]
emilkarl has joined #ruby
tvw has joined #ruby
<jhass>
probably slightly, but your motivation for using it should be having to write less code ;)
juanpablo_ has joined #ruby
<bazbing80>
jhass: indeed. a balance between readability and less code anyway :P I didn't know attr_reader returned the result of an instance var i.e. the result of the attribute can be set anyway within the class (and maybe more places in hacky code)
Rollabunna has quit [Ping timeout: 265 seconds]
<[k->
yes, it is more efficient \o/
nhhagen has joined #ruby
<[k->
it's so common that it is definitely optimised for performance
<shevy>
hmm
Igorshp has joined #ruby
chthon has quit [Ping timeout: 244 seconds]
ruurd has joined #ruby
<atmosx>
I have to write another 10 pages
sevenseacat has joined #ruby
<atmosx>
fuck
<atmosx>
ops sorry
<atmosx>
I'll write in the afernoon probably.
skade has joined #ruby
juanpablo_ has quit [Ping timeout: 264 seconds]
<bazbing80>
atmosx I fear a mute is coming
* atmosx
ducks
arup_r has quit [Remote host closed the connection]
<shevy>
the word rhymes with duck
<shevy>
such as luck
pawnbox_ has joined #ruby
rbowlby has quit [Remote host closed the connection]
oo_ has quit [Remote host closed the connection]
allomov has joined #ruby
poguez_ has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Ping timeout: 260 seconds]
oo_ has joined #ruby
Hounddog has quit [Remote host closed the connection]
devoldmx has joined #ruby
<emilkarl>
Hi, is there a nice way to group and count a hash based on a value, like this… http://pastie.org/10411938
dumdedum has joined #ruby
DoubleMalt has quit [Remote host closed the connection]
<karapetyan>
ah, thanks you... but now i try to describe task that i can't understand
davidhq has joined #ruby
<karapetyan>
i even can imagine algorithm
<karapetyan>
i spent about 4 hours and have no any results
<shevy>
feels like me when writing code
<shevy>
yeah, I end up watching youtube videos :(
<[k->
cat: :(
<shevy>
there be no cats in singapore
juanpablo_ has quit [Ping timeout: 250 seconds]
<suchness>
karapetyan: "For each item in a set of items, do this thing to that item."
<[k->
there are cats in Singapore D:<
<karapetyan>
:)
krz has quit [Quit: WeeChat 1.2]
<suchness>
sevenseacat: And what would you prefer?
<sevenseacat>
?guys
<ruboto>
Though inclusion was probably intended, not everyone relates to being "one of the guys". Maybe consider using "folks", "all", "y'all", or "everyone" instead?
<suchness>
Well, I don't relate to being included in y'all or everyone.
<sevenseacat>
suchness: ok, what would you recommend. we can update it
<sevenseacat>
though I won't remove 'everyone'
jedney has quit [Quit: Leaving]
<karapetyan>
do you have any ideas and can anyone help me how to solve this type of tasks?
ranchodev has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shevy>
a rabbit problem
<suchness>
sevenseacat: I recommend relaxing and not making a point every time someone says guys to hop on your soapbox. It's pointless and never related to the issue at hand. It's also discouraging for a person to come into IRC and instantly be called out for yet another thing.
eosinx has quit [Ping timeout: 268 seconds]
al2o3-cr has quit [Ping timeout: 268 seconds]
<sevenseacat>
ok, if you don't have any constructive suggestions, not a lot I can do
<jhass>
karapetyan: I have troubles relating the example to the problem, that seems to be x = 6 & n = 3?
<shevy>
haha
<suchness>
sevenseacat: You aren't going to change the world in an IRC chat, take your war somewhere it actually matters.
<shevy>
I also have problems to relate to rabbits
bronson has quit [Ping timeout: 246 seconds]
<apeiros>
suchness: why don't you take your own advice? to me it seems like you're just throwing a tantrum.
<karapetyan>
shevy: what exactly? :)
<shevy>
karapetyan I don't quite understand it yet but it seems as if .step could be used? if you need the rabbit to hop
<jhass>
karapetyan: ah, just weirdly formatted
<suchness>
apeiros: I was asked my opinion.
<shevy>
the format are rabbit tracks
<shevy>
*is
nhhagen has quit [Remote host closed the connection]
<apeiros>
suchness: yes, after you threw a tantrum
<apeiros>
which IMO just goes to show that sevenseacat is much more mindful of others than you manage to be.
<suchness>
apeiros: I hardly think saying "This again?" qualifies as a tantrum.
nhhagen has joined #ruby
<karapetyan>
shevy: jhass i need to know count of every possible unique rabbits routes going to top
<jhass>
karapetyan: so to rephrase the problem a bit more formal: in how many ways do to the numbers from 1 to n add up to x.
felixrsmith has quit [Ping timeout: 240 seconds]
<apeiros>
suchness: I do. and even more so in the collective.
<shevy>
this is why nobody likes rabbits
<karapetyan>
jhass: seems i have bad explanation :(
<ruboto>
suchness, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
<shevy>
what determines "N - number of steps that rabbit can jump at one time"?
<shevy>
ah
<shevy>
you want it to be 1, then 2, then 3 etc... ?
Spami has joined #ruby
<karapetyan>
yes. all possible options
<karapetyan>
1 + 1
<karapetyan>
1 + 2
<karapetyan>
2 + 1
<karapetyan>
1 + 1 + 1 + 1
<shevy>
yeah so you have to find the algorithm that will scale towards all steps
<MatthewRock>
Hey Ruby guys. I want to call grep from Ruby. I'm doing so using backticks: `echo #{string} | grep -P regex`. However, I get some errors, depending on regex, which aren't showing up in grep called from command line.
<tbuehlmann>
when having a convenience class method that prepares/parses input before calling the constructor, which one would you prefer? 1: Something.from(json_string) or 2: Something.from_json(json_string)
<[k->
upon calling the method, it will create a cache and store the result of the method being called with its arguments
AndChat|159600 has quit [Quit: Bye]
<[k->
this is called a lookup table i presume
<[k->
it caches the results of an expensive method so that it does not need to reperform the method many times
casadei_ has quit [Ping timeout: 265 seconds]
sgambino has joined #ruby
<[k->
hence, it is an optimisation technique to make things run faster
prambaud_ has joined #ruby
<shevy>
tbuehlmann second would be more explicit
Igorshp has quit [Remote host closed the connection]
<shevy>
first one would be shorter
charliesome has joined #ruby
<shevy>
:)
mary5030 has quit [Remote host closed the connection]
<[k->
the second one is better, probably
mary5030 has joined #ruby
<[k->
n1lo, sorry it doesnt create two methods
<tbuehlmann>
let's say there's no chance of adding another method like from_xml
<shevy>
yeah
<shevy>
second variant
<[k->
n1lo it takes an existing method and "makes a backup for it"
<shevy>
how often do you have to type it?
<tbuehlmann>
saying the method "from" makes no sense on its own, I'd argue that knowing about the method name alone doesn't happen. params are part of the signature, so you have to know them as well
<[k->
n1lo: then it redefines the existing method to become a cache/a pure function
<[k->
so, if you have a method foo, it creates _foo, which does the same as foo
CustosLimen has quit [Ping timeout: 244 seconds]
<tbuehlmann>
shevy, mh, it's not about writing but reading. how would you read "Something.from(json_string)" and how would you read "Something.from_json(json_string)"?
<[k->
n1lo: and then it redefines foo as a cache
rdark has quit [Remote host closed the connection]
<shevy>
well I would not use a variable called json_string probably
<niemcu>
consider reading someone else's code, I would prefer to see from_json cause it doesnt make me think what would be in that parameter
<jhass>
tbuehlmann: your variables shouldn't describe your data type but what the data represents, so I'd argue specifying the data type in the method name makes sense. Something.from_json(serialized_something)
<shevy>
niemcu yeah
mary5030 has quit [Ping timeout: 244 seconds]
<[k->
n1lo: when you call foo(a,b,c), if you did not call it before, it will call _foo(a,b,c) and store the result
tkuchiki has joined #ruby
<[k->
n1lo: afterwards, when you call foo(a,b,c) again, it does not need to call _foo, it just takes it from the hash, which is a zillion times faster
<tbuehlmann>
all very good arguments
<jhass>
tbuehlmann: though following that line of thought one could also argue that if there's only one serialization format for Something, Something.deserialize(json) could make sense too
<tbuehlmann>
I like the signature argument, too, but I think this is something for a perfect world
<shevy>
:D
<shevy>
we did progress a lot in this discussion
<[k->
n1lo: of course, if you call it with foo(a,b,d) it will have to call _foo(a,b,d) again and the process repeats for all different kinds of arguments
<shevy>
by showing that both options are good!
rdark has joined #ruby
<tbuehlmann>
jhass, yeah, that's the from_xml thing I mentioned. let's say it's just this one method
aaronmcadam has quit [Quit: Leaving...]
<n1lo>
[k-, How I call foo(a,b,c) using it ?
bruno- has quit [Ping timeout: 240 seconds]
<jhass>
I guess what I'd miss with just "from" is that the method does something but from doesn't describe (accurately enough) what it does
<[k->
n1lo, when you call f(:foo), you must already have a method called foo
<[k->
so, you can just call foo
gambl0re has quit [Ping timeout: 264 seconds]
jonr22 has joined #ruby
jonr22 has quit [Remote host closed the connection]
<jhass>
another argument I could come up with is that the json stdlib adds to_json, so from_json gives nice symmetry
jonr22 has joined #ruby
<tbuehlmann>
yup
<tbuehlmann>
being explicit here makes sense, will go with that
tkuchiki has quit [Remote host closed the connection]
<[k->
CSV.from(xml)
<sonOfRa>
In the C Extension API, I can use Check_Type to raise an exception if the type doesn't match. Is there also a version that just returns false if the type doesn't match?
<sonOfRa>
need to add some functionality to the rkerberos gem, or invoke the kerberos shell utilities
voltalio has joined #ruby
<sonOfRa>
I don't like invoking shell utilities in web applications.
stardiviner has quit [Quit: Code, Sex, Just fucking world.]
Zai00 has quit [Ping timeout: 246 seconds]
sharkman has joined #ruby
<sharkman>
will the regex (.*) match breaklines?
workmad3 has quit [Ping timeout: 244 seconds]
RegulationD has quit [Ping timeout: 246 seconds]
malconis has joined #ruby
<apeiros>
sharkman: only with the m flag
malconis has quit [Remote host closed the connection]
<apeiros>
also \n is "newline", not breakline ;-)
<sharkman>
:)
<sharkman>
what is \r ?
<apeiros>
carriage return
<sharkman>
whats the difference between \r and \n
fxn has quit [Quit: bye]
malconis has joined #ruby
hinbody has joined #ruby
<apeiros>
the same as the difference between "a" and "b" - they're different characters.
Zai00 has joined #ruby
<sharkman>
but arent they HTML code that both start a new line?
Igorshp has joined #ruby
dopie has quit [Ping timeout: 268 seconds]
<apeiros>
o0
<[k->
no
nettoweb has quit [Ping timeout: 265 seconds]
<apeiros>
they both are whitespace. whitespace does not matter in html
<[k->
that is <br>
<[k->
apeiros did you go for tea?
TvL2386 has quit [Remote host closed the connection]
<apeiros>
no. why?
chouhoulis has quit [Remote host closed the connection]
ruby-lang788 has joined #ruby
<sharkman>
ohh, i see, you mean both \r and \n are used for formatting the code, but it wont affect the output on browsers?
ruby-lang788 has quit [Client Quit]
<shevy>
hmmm... 2 hours in the rewrite... I suddenly realize that the error I had was due to the main regex not handling one corner case properly...
<apeiros>
sharkman: yes. both affect the output the same as an ordinary space does.
jcoe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nettoweb has joined #ruby
ericfournier2 has joined #ruby
jmarrec has quit [Quit: Leaving]
leat2 has joined #ruby
<apeiros>
sharkman: of course, assuming you don't have white-space: pre
<ericfournier2>
Hi! Ruby is baffling me this morning. I'm trying to get the minimum of two numbers, but I'm getting a "comparison of Fixnum with nil failed". I've simplified my statement to:"run_length = ((1 > 12) ? 1 : 12)", and I'm still getting that error. I have no idea what is "nil" in that statement.
<apeiros>
ericfournier2: runs fine. are you sure that's the code where you can still reproduce the problem?
NeverDie has joined #ruby
<shevy>
hehe
jcoe has joined #ruby
<shevy>
double baffle!
wpp has quit [Quit: ZZZzzz…]
<ericfournier2>
Well, it's the statement returning the error. It's inside an action controller object, but I don't think that should have an impact.
<jhass>
it might very well be the wrong line you're looking at
havenwood has joined #ruby
<jhass>
"controller object" sounds like rails, are you looking at the full trace?
ishahnaz has quit [Read error: Connection reset by peer]
renanoronfle has quit [Ping timeout: 272 seconds]
whippythellama has joined #ruby
<ericfournier2>
Yeah, itS' rails. I'm looking at the trace, and it's throwing at the "each" in "min", which I removed from the code 20 minutes ago. Seems like I have some sort of caching problem after all.
<[k->
apeiros: you were gone for so looooong
<apeiros>
[k-: that happens sometimes
<ericfournier2>
Ah, if I remove the line entirely, it still crash and burn.
freezevee has joined #ruby
Igorshp has quit [Remote host closed the connection]
dc has joined #ruby
<freezevee>
How can I reverse the order of a hash @hash = {0=>"a", 2=>"b", 3=>"c", 4=>"d", 5=>"e"} to become {0=>"e", 2=>"d".... etc ?
<freezevee>
the order of values of a hash
<apeiros>
freezevee: hash.to_a.reverse.to_h
<jhass>
freezevee: looks like you actually want an array with nil elements
<apeiros>
oh, the values. well, sort_by(&:last) instead of .sort then.
<freezevee>
apeiros: so you first convert it to an array
<freezevee>
let me try it
arup_r has joined #ruby
Igorshp has joined #ruby
lavros has joined #ruby
<freezevee>
apeiros: it becomes {5=>"e", 4=>"d", 3=>"c", 2=>"b", 0=>"a"}
<apeiros>
if it's reversing, yes. if it's sorting, then you don't need to.
<freezevee>
I don't know how to describe it
<freezevee>
swapping ?
<jhass>
?xy freezevee
<ruboto>
freezevee, it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<jhass>
big one, I bet
dc has quit [Client Quit]
<apeiros>
freezevee: oh, I should have read your example. your example does not really match your question.
arup_r has quit [Remote host closed the connection]
juanpablo_ has joined #ruby
dumdedum has joined #ruby
<apeiros>
(actually there's now 3 contradicting descriptions of your problem)
<apeiros>
freezevee: this looks like a hash used as an array
bigbadbear has joined #ruby
<jhass>
freezevee: but why the hell would you need that?
<freezevee>
no idea
<freezevee>
experimenting
<freezevee>
should I use an array ?
<jhass>
yes, like I said initially
<freezevee>
.invert will work like that then ?
<jhass>
what? no
<[k->
no
<jhass>
[k- just understood your problem even less
<yxhuvud>
for arrays, then #reverse would be the method to use.
<[k->
indeed
<freezevee>
let's say you have a = [1,2,3,4,5]
<freezevee>
a[0] = 1
<suchness>
==
<freezevee>
reverse will reverse the array to [5,4,3,2,1]
<[k->
that's a wasted computation
<freezevee>
so a[0] = 5
<freezevee>
it makes sense
<suchness>
==
tjohnson has joined #ruby
<freezevee>
I am such an idiot
<freezevee>
thanks guys
Gnomethrower has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros>
suchness: you should look away
<apeiros>
?guys freezevee
<ruboto>
freezevee, Though inclusion was probably intended, not everyone relates to being "one of the guys". Maybe consider using "folks", "all", "y'all", or "everyone" instead?
<freezevee>
haha
<freezevee>
thanks friends !
<apeiros>
you're welcome :)
<apeiros>
even if I still don't know what you're actually trying to solve ;-)
arup_r has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Gnomethrower has joined #ruby
<freezevee>
apeiros: an array of arrays
juanpablo_ has quit [Ping timeout: 244 seconds]
<[k->
a table?
<freezevee>
yes
pegasuspect has quit [Quit: pegasuspect]
<[k->
an associative array?
dopamean_ has quit [Ping timeout: 252 seconds]
<jhass>
freezevee: that's still implementation/solution, not a problem description ;)
karapetyan has joined #ruby
<freezevee>
to be honest I don't want the solution
<freezevee>
I want to find it myself :P
Gnomethrower has quit [Read error: Connection reset by peer]
<freezevee>
I know you always help but... I am denying it this time
leat2 has quit [Ping timeout: 272 seconds]
<[k->
> jhass always help
<freezevee>
I am trying to use a hash as an array with no reason, that's a great help
<[k->
hehehehehehehe
<freezevee>
:)
rippa has joined #ruby
<adaedra>
jhass, channel's most valuable
jas02 has quit [Quit: jas02]
<[k->
indeed, a hash is not suitable for a table
<apeiros>
depends.
bmurt has joined #ruby
tagrudev has quit [Remote host closed the connection]
<adaedra>
> use a hash as an array
<adaedra>
I smell PHP
casadei_ has joined #ruby
jcoe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<[k->
adaedra: that's a set!
karapetyan has quit [Ping timeout: 265 seconds]
<adaedra>
game, set, match
<[k->
no, set really does this
hoylemd has joined #ruby
<shevy>
good old php
<adaedra>
we have to go higher
<adaedra>
and be upset
* adaedra
leaves
<sharkman>
is anyone else cold
<adaedra>
COLD!?
<[k->
the world is on fire
soc42 has joined #ruby
gamename has joined #ruby
<hoylemd>
Best practices question: what's the accepted way to encode large-ish(> 10 lines, nicely formatted) data structures into a method? Rubocop likes to complain if any method is larger than 10 lines.
<jhass>
>> require "set"; Set.new([1, 2, 3])[0] # not sure I'd call this array still if that property is lost [k-
<ruboto>
jhass # => undefined method `[]' for #<Set: {1, 2, 3}> (NoMethodError) ...check link for more (https://eval.in/431833)
<sharkman>
im in starbucks i am in patns and a sweatshirt and im about to get hypothermia
<suchness>
hoylemd: Aside from refactoring into smaller methods? Or perhaps implementing a class?
renanoronfle has joined #ruby
<apeiros>
hoylemd: no silver bullets. hence there's no answer to that generic question.
solocshaw has joined #ruby
<adaedra>
I had to get outside, oh god
<[k->
why is a datastructure a method
Gnomethrower has joined #ruby
solocshaw has quit [Remote host closed the connection]
pegasuspect has joined #ruby
<[k->
a bird pooped on adaedra's windoe
solocshaw has joined #ruby
<hoylemd>
suchness: The smallest method I could refactor into would still just return the entire data structure though, so if I have a data structure that has > 10 members, there'll be no way to create it in a method without ging over that limit.
pegasuspect has quit [Client Quit]
<adaedra>
[k-: did you mean: window
<[k->
Y
<suchness>
hoylemd: May I look at your method, on pastie.org perhaps?
<hoylemd>
A class might work, but The data structures are created as dictionaries so they can be easily json-ified
<[k->
now what will you do adaedra?
<adaedra>
And no, windows are clean
<adaedra>
I'm eating ice cream
<[k->
why did you go outside then?
<hoylemd>
suchness: I can't show you the one I'm working on verbatim, but I'll whip up an anaolgous example (if I can do that before a meeting :/)
<[k->
to get icecream?
<shevy>
he was in need of a baguette
soc42 has quit [Remote host closed the connection]
<suchness>
hoylemd: That's fine, just replace anything sensitive, I'll still understand it.
<hoylemd>
aw damn. Meeting is now. I'll ask again later
<[k->
abyss went for a meeting and never came back
<adaedra>
[k-: got things to do
benaiah has quit [Ping timeout: 252 seconds]
<[k->
why do programmers have so many meetings @.@
chills42 has quit [Remote host closed the connection]
mary5030 has joined #ruby
<shevy>
because they receive their instructions that way
<adaedra>
Emulation of social activities.
<shevy>
and to give fancy presentations
benaiah has joined #ruby
<shevy>
[k- you will have to do this as well eventually
<sharkman>
but when a game is in progress, espn puts all the play by play info in a JSON variable, espn.gamepackage.data
<sharkman>
im wondering if there is a way to retrieve this JSON variable even when a game ends? to put a request through and force them to give it to me?
nhhagen_ has joined #ruby
<n1lo>
How can I get the string value inside String class ?
Oka has joined #ruby
RegulationD has joined #ruby
<[k->
the string value inside the string class is a string
<centrx>
n1lo, self ?
hanmac has joined #ruby
niemcu has quit [Ping timeout: 268 seconds]
dfockler has joined #ruby
<suchness>
sharkman: Seems like a question better suited to espn.
<n1lo>
centrx, yeah. +_+
<sharkman>
yes it is. but you guys are what im left with
<suchness>
sharkman: Alright, let me just quickly reference my espn manual.
jxv has joined #ruby
nhhagen has quit [Ping timeout: 252 seconds]
khebbie has joined #ruby
<suchness>
sharkman: Nothing, drat.
<sharkman>
lol youre funny suchness
<suchness>
sharkman: What kind of answer did you expect?
beast has quit [Quit: Leaving]
oldbay has joined #ruby
<sharkman>
maybe the variable is accessible through some javascript magic
<suchness>
sharkman: Maybe, but you've offered absolutely no resources, no examples, nothing. No one here is going to charge out and figure out a niche question better suited to ESPN.
beast has joined #ruby
dgutierrez1287 has joined #ruby
<sharkman>
you are answering for other people
<[k->
?ot sharkman
<ruboto>
sharkman, this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
<apeiros>
I don't think sharkman's question was offtopic
<apeiros>
but I also think suchness' assessment is right on
dfockler has quit [Ping timeout: 265 seconds]
<adaedra>
much topic
<adaedra>
such ness
<adaedra>
wow
<apeiros>
lol
<apeiros>
dogedra
<[k->
very wow*
adaedra is now known as dogedra
ndrei has quit [Ping timeout: 244 seconds]
<[k->
do you have the k factor?
<dogedra>
this is my life now
<dogedra>
many woof
bigbadbear has joined #ruby
polishdub has joined #ruby
<[k->
RFC444 defines many as more than or equal to 4
nhhagen_ has quit [Ping timeout: 268 seconds]
aganov has quit [Remote host closed the connection]
khebbie has quit [Remote host closed the connection]
Igorshp has quit [Remote host closed the connection]
charliesome has joined #ruby
Chau has joined #ruby
tvw has quit [Remote host closed the connection]
pegasuspect has quit [Ping timeout: 250 seconds]
dionysus69 has joined #ruby
shmilan has joined #ruby
rubie has joined #ruby
momomomomo has quit [Ping timeout: 272 seconds]
acke has quit [Remote host closed the connection]
momomomomo has joined #ruby
bruno-_ has joined #ruby
Mives has joined #ruby
camm1 has joined #ruby
prefixed has joined #ruby
Guest33856 has quit [Quit: Leaving]
soc42 has joined #ruby
SCHAAP137 has quit [Remote host closed the connection]
dopie has joined #ruby
skullcrasher has quit [Remote host closed the connection]
dmolina has quit [Quit: Leaving.]
slawrence00 has joined #ruby
<camm1>
Hello everyone, do you know how to doc a @param with yardoc when is a "list" of Objects?
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bruno-_ has quit [Ping timeout: 240 seconds]
<dogedra>
a list how?
<dogedra>
vararg, or array of Object?
TPBallbag has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
momomomomo has quit [Quit: momomomomo]
elperdut has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bayed has quit [Quit: Connection closed for inactivity]
<camm1>
array of Object
<dogedra>
Any kind of object, or is there a limit?
linuxboy_ has joined #ruby
<[k->
Array<Object> iirc
Igorshp has joined #ruby
pegasuspect has joined #ruby
<[k->
And Array<String, Fixnum, Hash> iirc
<dogedra>
Object is very generic, if you want a limit, you have to indicate it
athinggoingon has joined #ruby
<apeiros>
IMO Array<Object> is redundant. Array is sufficient.
<camm1>
Thank you
Swappticon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dfockler>
Yeah it's like @param [Array<Object>]
Mives has quit [Ping timeout: 268 seconds]
<camm1>
Thanks a lot.
pawnbox has joined #ruby
alexUaN has quit [Quit: alexUaN]
bluOxigen has quit [Ping timeout: 264 seconds]
<dfockler>
I guess in Ruby you shouldn't expect the array to contain a specific type, because it can contain any number of types
<dogedra>
Just use Array if it's *any* object, otherwise Array<T> it is (i.e. Array<String>, Array<#poke>)
linuxboytoo has quit [Ping timeout: 256 seconds]
<dogedra>
dfockler: that's for documentation tho
<dfockler>
yeah
bruno-_ has joined #ruby
<[k->
... Array<T>
<[k->
...if you pass in any other objects, the behaviour is undefined
Igorshp has quit [Remote host closed the connection]
<dfockler>
well it's docs not code, the docs don't care what type you pass in
<dogedra>
that's a hint for users!
<dogedra>
such hint
<dogedra>
much dynamic types
<dfockler>
I document for the Users!
<[k->
lusers
nhhagen has joined #ruby
rwyoung has joined #ruby
<dfockler>
trousers
<[k->
:o
Igorshp has joined #ruby
<[k->
dirty dirty
bruno-_ has quit [Ping timeout: 250 seconds]
<sharkman>
do you guys agree that users in the linux irc channel are smarter than people here?
<dfockler>
definitely
<sharkman>
20+ iq points smarter?
<[k->
?guys
<ruboto>
Though inclusion was probably intended, not everyone relates to being "one of the guys". Maybe consider using "folks", "all", "y'all", or "everyone" instead?
<suchness>
I would say 15, 20 is pushing it
<dogedra>
sharkman: why do you want to compare?
<dogedra>
Also, what does "being smarter" means? How do you measure it? Just by IQ points?
<sharkman>
maybe they are immorallar than us
fostertheweb has joined #ruby
<sharkman>
yeah using like IQ points
codecop has joined #ruby
<sharkman>
yeah using like IQ points
<dogedra>
I don't know my IQ score. What do we do?
<sharkman>
you can guess
bigbadbear has quit [Ping timeout: 240 seconds]
<suchness>
I guess dogedra is at least 210 iq.
Igorshp has quit [Ping timeout: 240 seconds]
apt-get has joined #ruby
<dogedra>
many iq
<suchness>
Which makes the linux people around 225.
dgutierrez1287 has quit [Remote host closed the connection]
mprelude has quit [Quit: WeeChat 1.3]
ruurd has joined #ruby
yfeldblum has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
ndrei has quit [Ping timeout: 268 seconds]
momomomomo has joined #ruby
r_baron has joined #ruby
bruno- has joined #ruby
krisquigley has quit [Remote host closed the connection]
senayar has quit []
amclain has joined #ruby
chihhsin has joined #ruby
agent_white has joined #ruby
bootstrappm has joined #ruby
mikecmpbll has quit [Ping timeout: 265 seconds]
bruno- has quit [Ping timeout: 240 seconds]
r_baron has quit [Ping timeout: 268 seconds]
bubbys has quit [Ping timeout: 264 seconds]
bubbys has joined #ruby
bricker has joined #ruby
ruurd has quit [Read error: Connection reset by peer]
hyperdrive has joined #ruby
DoubleMalt has quit [Remote host closed the connection]
camm2 has joined #ruby
bruno- has joined #ruby
mleung has joined #ruby
Jackneill has joined #ruby
craigp has joined #ruby
oldbay has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
camm1 has quit [Ping timeout: 246 seconds]
djbkd has joined #ruby
craigp_ has joined #ruby
minotep has joined #ruby
krz has joined #ruby
mroark has joined #ruby
mhib has joined #ruby
ruurd has joined #ruby
<shevy>
slash_nick adaedra
<[k->
good one
User458764 has joined #ruby
<slash_nick>
lol
bruno- has quit [Ping timeout: 255 seconds]
fostertheweb has joined #ruby
tkuchiki has joined #ruby
armyriad has quit [Quit: Leaving]
craigp has quit [Ping timeout: 268 seconds]
momomomomo has quit [Quit: momomomomo]
djbkd has quit [Ping timeout: 265 seconds]
armyriad has joined #ruby
craigp_ has quit [Ping timeout: 268 seconds]
marr has quit [Ping timeout: 264 seconds]
linuxboy_ has quit [Remote host closed the connection]
linuxboytoo has joined #ruby
TPBallbag has quit [Remote host closed the connection]
slawrence00 has quit [Ping timeout: 246 seconds]
marr has joined #ruby
armyriad has quit [Max SendQ exceeded]
tkuchiki has quit [Ping timeout: 246 seconds]
armyriad has joined #ruby
armyriad has quit [Max SendQ exceeded]
jgt has quit [Ping timeout: 272 seconds]
tercenya has quit [Remote host closed the connection]
minimalism has joined #ruby
hyperdrive has quit [Ping timeout: 250 seconds]
EllisTAA has joined #ruby
camm2 has quit [Quit: Leaving.]
camm1 has joined #ruby
<hoylemd>
Repeating earlier question: What's the best practices way to keep a method to less than 10 lines (as Rubocop wants) when the method needs to define a large-ish data structure? example: http://pastie.org/10412720
tercenya has joined #ruby
tomchapin has quit [Read error: Connection reset by peer]
skullcrasher has joined #ruby
tomchapi_ has joined #ruby
dorei has joined #ruby
Lycanii has joined #ruby
<bootstrappm>
I wouldn't worry too much about that guideline hoylemd. For example, if you put your whole data structure on one line you'd have a 4-line method … does that mean its a better method? No, I'd say its worse because its less readable
<bootstrappm>
just keep it short and to the point
mleung has quit [Quit: mleung]
al2o3-cr has joined #ruby
<bootstrappm>
if you're gonna share that data structure across methods put it somewhere else, sure, but don't do it for the sake of saving a few lines
hyperdrive has joined #ruby
ekain has joined #ruby
ndrei has joined #ruby
roxtrongo has joined #ruby
bootstrappm has quit [Quit: Leaving.]
ruurd has quit [Ping timeout: 272 seconds]
mleung has joined #ruby
terlar has quit [Ping timeout: 240 seconds]
shadoi has joined #ruby
psy_ has joined #ruby
ruurd has joined #ruby
psy_ has quit [Max SendQ exceeded]
skade has quit [Quit: Computer has gone to sleep.]
fostertheweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
roxtrong_ has joined #ruby
Trieste has joined #ruby
psy_ has joined #ruby
shadoi1 has joined #ruby
siemprefresco has joined #ruby
fostertheweb has joined #ruby
bootstrappm has joined #ruby
arup_r has joined #ruby
RegulationD has joined #ruby
j_suth has quit [Read error: Connection reset by peer]
<Sou|cutter>
hoylemd: Disable the cop on that method is what I'd do
fantazo has joined #ruby
ndrei has quit [Ping timeout: 264 seconds]
bootstrappm has joined #ruby
ngscheurich has joined #ruby
FernandoBasso has joined #ruby
RandyT has joined #ruby
RegulationD has quit [Ping timeout: 265 seconds]
symm- has joined #ruby
apt-get has joined #ruby
fostertheweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bootstrappm has quit [Client Quit]
howdoicomputer has quit [Ping timeout: 246 seconds]
riskish has joined #ruby
ndrei has joined #ruby
frozen3 has joined #ruby
ruurd has quit [Read error: Connection reset by peer]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
tejasmanohar has joined #ruby
apt-get has quit [Ping timeout: 268 seconds]
ruurd has joined #ruby
voltalio has joined #ruby
voltalio has quit [Client Quit]
<shevy>
hehe
nanoz has joined #ruby
CustosL1men has quit [Ping timeout: 240 seconds]
n008f4g_ has joined #ruby
sampai has joined #ruby
User458764 has joined #ruby
<certainty>
actually i'd considere breaking up the construction of the datastructure
<certainty>
consider, even
artmost has joined #ruby
apt-get has joined #ruby
khebbie has joined #ruby
renanoronfle has quit [Remote host closed the connection]
ruurd has quit [Read error: Connection reset by peer]
Zai00 has quit [Quit: Zai00]
<centrx>
hoylemd, Why is the data structure being defined in the method?
RandyT_ has joined #ruby
RandyT_ has quit [Client Quit]
khebbie has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
RandyT_ has joined #ruby
voltalio has joined #ruby
bootstrappm has joined #ruby
sshuff is now known as sshuff|gone
artmost has quit [Client Quit]
fostertheweb has joined #ruby
shmilan has quit [Ping timeout: 244 seconds]
RegulationD has joined #ruby
ramfjord has joined #ruby
skinkitten has joined #ruby
kirun has joined #ruby
Kricir has quit []
sampai has quit [Quit: leaving]
banister has quit [Read error: Connection reset by peer]
<shevy>
hoylemd you could trick it by defining a constant for the part that remains static; the part that then gets changed of that hash could be used or become assigned to another variable e. g. @instance_variable
<shevy>
the main reason why smaller methods are preferred is because they are often much easier to work with or refactor than those 500 lines of code methods
wldcordeiro has joined #ruby
cornerma1 has joined #ruby
skinkitten has quit [Quit: Leaving]
ruurd has joined #ruby
phutchins has quit [Ping timeout: 240 seconds]
<tubbo>
hoylemd: you make a MethodLength exception for that file
<tubbo>
that's what i do anyway
<shadoi1>
always follow the rules unless they are stupid.
shadoi1 is now known as shadoi
camm1 has quit [Ping timeout: 240 seconds]
bootstrappm has quit [Quit: Leaving.]
hanmac has quit [Ping timeout: 244 seconds]
jgt has joined #ruby
cornerman has quit [Ping timeout: 252 seconds]
cornerma1 is now known as cornerman
NeverDie has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
anaeem1_ has joined #ruby
yfeldblum has quit [Ping timeout: 246 seconds]
AlphaAtom has joined #ruby
anaeem1_ has quit [Remote host closed the connection]
leafybasil has quit [Remote host closed the connection]
<certainty>
obviously the values there aren't produced out out thin air. I mean the parts of the datastructure. There probably is business logic hidden there. If it is it should be expressed elsewhere.
leafybasil has joined #ruby
bruno- has joined #ruby
<certainty>
make these pieces composable
soulcake has quit [Quit: Quack.]
voltalio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chthon has quit [Ping timeout: 244 seconds]
shmilan has joined #ruby
bootstrappm has joined #ruby
voltalio has joined #ruby
The_Phoenix has quit [Read error: Connection reset by peer]
fantazo has quit [Ping timeout: 265 seconds]
ruurd has quit [Read error: Connection reset by peer]
<centrx>
chrisseaton, speculating it's related to DATA
<shevy>
lol
<chrisseaton>
I get all of that - but what goes into T_DATA as opposed to any of the more clearly named symbols?
[k- has quit [Read error: No route to host]
[k- has joined #ruby
yfeldblum has joined #ruby
ruurd has joined #ruby
<hanmac>
chrisseaton: T_DATA is used for bindings and stuff, T_DATA is the representation for a C pointer bound to an ruby object (PS: but i dont know why the DATA class exist in ruby visible)
dionysus69 has joined #ruby
<chrisseaton>
Ah so it's a generic opaque handle into a VM object I guess
<jhass>
eam: I think they held the announcement for 1.9
<jhass>
jeffw_: I believe there's a ruby2.0 package but the ones I linked are better
jzigmund has joined #ruby
<jeffw_>
ya I am not gonna install ruby from a 3rd party ppa
<jhass>
because $reasons
Martxel has left #ruby ["Leaving"]
<jeffw_>
if I really get desperate I might just use the latest ubuntu in a virtual machine
Pupeno has quit [Remote host closed the connection]
freerobby has joined #ruby
<havenwood>
jeffw_: The Brightbox packages are a pretty common turn-to to deal with lack of up-to-date Ubuntu Ruby packages.
bruno- has joined #ruby
acke has quit [Remote host closed the connection]
nettoweb has joined #ruby
A124 has quit [Read error: Connection reset by peer]
A124 has joined #ruby
platzhirsch has joined #ruby
<havenwood>
Wily for 2.2 :P
voltalio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<havenwood>
And don't forget to install: ruby2.2-dev
<shevy>
he is in a prison
firstdayonthejob has joined #ruby
elperdut has quit [Ping timeout: 240 seconds]
<havenwood>
At least Vivid has 2.1.
mblagden_ has quit [Ping timeout: 272 seconds]
<havenwood>
A supported Ruby!
paulcsmith has quit [Quit: Be back later ...]
<shevy>
hmmm
<shevy>
let me ask a noob question
<shevy>
big arrays will slow my ruby programs down?
<apeiros>
shevy: define "big"
<havenwood>
shevy: If the Array is infinite you'll never get to the end. Not ever.
<shevy>
yeah that is one problem
<apeiros>
and no, a big array per se will not slow down your program
paulcsmith has joined #ruby
senayar has quit [Remote host closed the connection]
<shevy>
I was having fun with Readline and setting a completion proc
<apeiros>
a big array which has to be swapped out due to its size but you access swapped out parts frequently - yes, that will slow down your app. a lot.
<hoylemd>
To all the folks who chimed in re: my data structure method length issue: Thanks for the input! My team is a little averse to disabling cops willy-nilly, but there has been talk of loosening the method length metric to 20 lines. Another option to consider would be having a fixture generator module that has module-specific rubocop exceptions.
bruno- has quit [Ping timeout: 265 seconds]
<shevy>
the array that I was using had less than 20.000 entries, but they actually were calculated/done anew whenever someone presses enter
kgirthofer has quit [Ping timeout: 264 seconds]
<apeiros>
but that's not really a problem of array. it's more a problem of not having enough ram or not organizing your data well enough to fit into available ram
<eam>
bigger datasets generally means slower programs
pagios has joined #ruby
<pagios>
when should i use ruby on rails and when should i use sinatra? thanks
<eam>
whether due to lack of memory, or just doing more work when traversing it
bruno- has joined #ruby
<mwlang>
What exactly is a “Backend” on I18n?
<havenwood>
pagios: Use Rails when it's a Basecamp clone and use Sinatra when it's Hello, World!
<pagios>
cool :)
<apeiros>
mwlang: the thing which retrieves a value for a key
<mwlang>
For example: “I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend)”
<shevy>
havenwood is in a good mood again :)
<pagios>
havenwood: sql goes well with rails?
<BraddPitt>
yes, very pagios
<apeiros>
mwlang: standard would be the yaml based backend
<jeffw_>
if you really want a laugh on CentOS 6.6 Final I have
AlphaAtom has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jeffw_>
because CentOS likes to "backport"
<havenwood>
pagios: SQL goes with SQL databases. Rails and Sinatra are both most often used with SQL of one sort or another.
<apeiros>
pagios: rails is over in #rubyonrails
<mwlang>
So, if I wanted to add a new lookup mechanism to Rails, I’d just chain up a new backend?
<apeiros>
mwlang: that too sounds like #rubyonrails
<havenwood>
pagios: Sinatra, unlike Rails, doesn't have a SQL toolkit baked in. Popular choices are to use ActiveRecord from Rails or the very nice Sequel gem.
<ytti>
[ytti@ytti.fi ~]% time ruby -e 'Array.new 200_000_000'
<ytti>
ruby -e 'Array.new 200_000_000' 0.21s user 1.55s system 55% cpu 3.176 total
<ytti>
[ytti@ytti.fi ~]% time ruby -e 'Array.new 100_000_000'
<ytti>
ruby -e 'Array.new 100_000_000' 0.13s user 0.24s system 95% cpu 0.383 total
<ytti>
[ytti@ytti.fi ~]% time ruby -e 'Array.new 1_000_000'
<ytti>
ruby -e 'Array.new 1_000_000' 0.03s user 0.00s system 96% cpu 0.037 total
<havenwood>
ytti: Mah eyes!
* apeiros
hands havenwood some bleach
<ytti>
i have cheap bleach for sale
<mwlang>
apeiros: heh…it feels more directly ruby to me…not exactly trying to tie into Rails so much as the I18n framework.
<pagios>
so a typical platform would contain js/ajax/htmlcss talking to a website which has a backend gateway being rails and rails talking to sql, is this the correct way to start building a platform? like fb twitter etc?
dman777_alter has joined #ruby
<dman777_alter>
what is the best way to say details = "#{response['name']}:\n#{response['content']}" if "#{response['key']}:\n#{response['value']}" does not exist??
<mwlang>
apeiros: had no idea i18n belonged to the Rails effort!
<pagios>
flexible enough and scalable enough
shevy has quit [Read error: Connection reset by peer]
<baweaver>
don't cross post dman777_alter
<havenwood>
pagios: The maintainer of Sequel also created a very fine Rack adapter that would be an alternative to Sinatra: http://roda.jeremyevans.net
urbanmonk has joined #ruby
shmilan has quit [Ping timeout: 244 seconds]
<havenwood>
pagios: I'd recommend creating a very simple, vanilla Rack app. Then port it to Roda and try some Roda plugins. Then try a Rails app.
<eam>
ytti: time ruby -e'([1] * 1_000_000).reject! {true}' # great example of simple things getting slow with size
bruno- has quit [Ping timeout: 244 seconds]
<pagios>
havenwood: but is my logic correct?
banjara has quit [Quit: Leaving.]
<pagios>
is thera anything in between these entities for improving performance etc?
<eam>
reject! is O(n^2) on most rubies :(
bruno- has joined #ruby
<havenwood>
pagios: Yeah, Twitter's frontend is still Rails. Rails comes with conventions for all of the above and security measures in place, etc. Roda on the other hand starts with just a router and you add plugins to build the framework you need for the given task.
<apeiros>
eam: what?
<eam>
apeiros: sup
<apeiros>
22:52 eam: reject! is O(n^2) on most rubies :(
<apeiros>
that… sounds wrong?
<eam>
it's because it shifts the entire array every rejection (as opposed to reject which is O(n))
senayar has joined #ruby
senayar has joined #ruby
<apeiros>
at least for both Array and Hash I don't see why it would have to be
<pagios>
do you guys recommend any book for startups? i need to know how startups are building their infrastructures nowadays
<eam>
I think it's getting changed (in which case it would be O(n) but potentially invalid during iteration)
northfurr has joined #ruby
<apeiros>
eam: code says it creates a new array
<apeiros>
oh, wait
<eam>
apeiros: reject does, reject! doesn't
<apeiros>
looked at reject, not reject!
<eam>
yeah
<eam>
2x memory or O(n^2) pick your poison
<apeiros>
2x memory is usually the better pick
<eam>
agreed
Pupeno has joined #ruby
<eam>
(and I think reject! may be changing to simply leave self in an invalid state during iteration, so it'll be fast/small but not "correct")
<apeiros>
and even without 2x memory you can do it in O(n)
bmurt has quit []
<apeiros>
you keep a shift-count and move every item. you can optimize to use memcpy by figuring slices.
<eam>
right - but then accesses to the object during the iteration will see ... stuff
<apeiros>
true
<eam>
which is an ok concession probably
new_user has joined #ruby
<apeiros>
again, choose your poison
EllisTAA has joined #ruby
<eam>
yeah, right answer imo
<apeiros>
either "see stuff" or "be locked out"
karapetyan has joined #ruby
<havenwood>
pagios: Microservices. Monolith. No, Microservices.
<apeiros>
personally I prefer "locked out"
bruno- has quit [Ping timeout: 244 seconds]
<baweaver>
If you get to a point where that's _actually_ an issue, ruby might not be the best idea.
<apeiros>
"see stuff" is IMO never a good choice :-/
<baweaver>
havenwood: are the rogues still at it? (suppose I could ping avdi as well here)
<new_user>
Ugh. when you have array's within array's, a matrix, and you need to call on array[index[index2]] is there a command for that? Because that isnt working as is.
freerobby has quit [Quit: Leaving.]
<havenwood>
baweaver: Sure are, lots of episodes lately but fewer hosts per episode.
paulcsmith has quit [Quit: Be back later ...]
<apeiros>
eam: I wonder whether they could use their existing COW infrastructure to only update the "visible" array upon actual access
Pupeno has quit [Remote host closed the connection]
nanoz has quit [Read error: Connection reset by peer]
<new_user>
Looking now
<havenwood>
pagios: I'd suggest listening to those for some context. Then create a plain, simple Rack app. Port it to Roda. Look at Roda plugins. Then go through a Rails book like R4IA.
mleung has quit [Quit: mleung]
paulcsmith has joined #ruby
* havenwood
is going through R4IA
djcp has quit [Ping timeout: 246 seconds]
<baweaver>
new_user: your above code tries to run an index on a number
<new_user>
baweaver seems I'm still not far enough along in this code to understand what's even happening there.
<baweaver>
to get an element of that array you need to pull another index.
<havenwood>
pagios: Good, those are good things to think about.
<new_user>
Hrm.
shmilan has joined #ruby
tejasmanohar has joined #ruby
bruno- has quit [Ping timeout: 255 seconds]
<mwlang>
heh…insteresting seeing that rails.ru rackup.
<bricker>
Is there any language where you can say "return this at the end of the method: { ... }", and then do other stuff? I know Go has "defer" but it's not quite what I mean.
<pagios>
havenwood: whats an example of Monolith vs microservices?
urbanmonk has quit [Quit: urbanmonk]
<baweaver>
bricker: tap or returning?
<new_user>
basically, the only way for me to do it without the $ rescue /raise because I'm trying to build on the code that I know already--before finding shortcuts. I'll have to go... row1 = array[index] and then row1[index2]
<baweaver>
Normally known as a K Combinator
soulcake has joined #ruby
baweaver has quit [Remote host closed the connection]
<mwlang>
pagios: monolith just means a framework that provides everything you could possibly think you might need. microservices are the opposite extremes…just enough is provided to get you working efficiently.
soulcake has joined #ruby
oetjenj has joined #ruby
<pagios>
mwlang: yea but like concrete examples
<platzhirsch>
bricker: like a callback?
<bricker>
platzhirsch: no, just a compiler feature I guess
<mwlang>
rails is monolith. rack is micro. rails is actually built on top of rack if that means anything to you.
<platzhirsch>
bricker: or maybe something like the guarantee block in a try catch
vF3hNGxc47h8 has joined #ruby
<platzhirsch>
ensure in ruby
<bricker>
nah that's not what I mean
<bricker>
doesn't matter, just curious really
<nofxx>
there was a nice pastie thing which runs the code, anyone knows?
<havenwood>
pagios: You're also on the right track with Martin Fowler related discussions. Read on.
<nofxx>
jsfiddle for ruby*
<eam>
apeiros: doubt it, since reject! is the W in COW :)
<jeffw_>
is there a good gui to manage + install + uninstall ruby gems?
chouhoulis has quit [Read error: Connection reset by peer]
<apeiros>
eam: not meant like that
<new_user>
Alright, I have another question. But first I need to know how you guys hosted those post on repl.it
chouhoulis has joined #ruby
<platzhirsch>
Padrino..
<platzhirsch>
is that Sinatra gone mad?
<new_user>
Anyone give me a quick walkthrough how to make and get the url form this site?
bruno- has joined #ruby
<apeiros>
eam: the idea is basically: other parties accessing during reject! would see stuff, but when they perform a lookup, it is blocked, the array is updated, and after that, it can access it
<new_user>
nevermind
<toertore>
pagios, mwlang monolith usually refers to how an application is architectured; a monolith is a single app that does everything and everything is very coupled together; "microservices" is an alternative approach where you have several apps that do one or a few things each
<apeiros>
and the COW infrastructure afaik already deals with different parties accessing an array/hash
<toertore>
you can make small rails apps
shevy has joined #ruby
<eam>
yeah, I think you'd need a copy of the array (or some other similarly invasive approach in terms of size/speed)
<pagios>
microservices communicate via what protocols usually?
<mwlang>
for me, when I build a complex website, I’ll build with Rails because I often hire other developers to work on it…Rails is well known, well documented, and follows a set convention for the most part, so it’s easy to find developers that can help. But dirt simple websites, I’ll build with Sinatra or something else because they’re small, efficient, and have enough meat to build something rapidly.
dgutierrez1287 has joined #ruby
<toertore>
pagios: doesn't matter, could be http
Pupeno has joined #ruby
FernandoBasso has joined #ruby
<mwlang>
toertore: I knew I was missing something there…I was transliterating microframework with microservices. *doh*
<shevy>
ytti hmmm... why take the smaller arrays more cpu time than the larger 200 milion variant?
rodfersou has quit [Quit: leaving]
camm1 has left #ruby [#ruby]
urbanmonk has joined #ruby
senayar has quit [Remote host closed the connection]
<pagios>
can rails replace apache btw?
kirun has quit [Quit: Client exiting]
baweaver has joined #ruby
<eam>
pagios: rails is an application framework, you could run it using apache
<pagios>
cool
<new_user>
Figured that out. The QUESTION#2 https://eval.in/432008 <-- can anyone tell me why the array in this is being destroyed by the method?
bruno- has quit [Ping timeout: 240 seconds]
firstdayonthejob has quit [Read error: Connection reset by peer]
Pupeno has quit [Remote host closed the connection]
<pagios>
eam: so users would go to apache and then apache would direct traffic to rails
dgutierrez1287 has quit [Ping timeout: 240 seconds]
<apeiros>
new_user: stack = arr # this does not copy the array
<apeiros>
new_user: stack will refer to the *same* array object as arr
<apeiros>
"some string" in both `other` and `ary` are the same object
ldnunes has quit [Quit: Leaving]
<apeiros>
it was not copied.
<eam>
"copy this" vs "copy this and everything under this"
<new_user>
Ah, okay
Pupeno has joined #ruby
n20420 has left #ruby [#ruby]
urbanmonk has quit [Quit: urbanmonk]
imperator has quit [Quit: Leaving]
dgs has quit [Quit: dgs]
<apeiros>
>> ary = ["some string"]; other = ary.dup; other[0].upcase!; other.pop; ary # maybe even better example - shows that the array was copied (ary still contains the string)
<ytti>
shevy, the larger ones get some downtime due to I/O wait and average CPU use goes down
danman has joined #ruby
danman has quit [Client Quit]
yfeldblum has joined #ruby
Synthead has joined #ruby
Hrorek has quit [Read error: Connection reset by peer]
vickleton has quit [Remote host closed the connection]
Rurik has joined #ruby
mleung has joined #ruby
bruno-_ has quit [Ping timeout: 240 seconds]
tcopeland has quit [Ping timeout: 240 seconds]
Musashi007 has joined #ruby
bruno-_ has joined #ruby
finisherr has joined #ruby
Neverdie has joined #ruby
dogedra is now known as adaedra
Rurik has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
bruno-_ has quit [Ping timeout: 260 seconds]
dopamean_ has quit [Ping timeout: 255 seconds]
<shevy>
adaedra! you are back!
<adaedra>
I was never far away
c0m0 has quit [Ping timeout: 246 seconds]
<adaedra>
If you're talking about my temporary nick, blame apeiros
<apeiros>
I didn't not do nothing!
<platzhirsch>
We thought you were dead
leafybasil has quit [Remote host closed the connection]
juanpablo_ has quit [Read error: Connection reset by peer]
<eam>
I'm still not sure you're not dead
dblessing has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<eam>
are ... are you a ghost?
Jackneill has quit [Ping timeout: 265 seconds]
<apeiros>
they're a daedra. nuff said.
<shevy>
he was undead
<platzhirsch>
Fear the Walking Dead
<platzhirsch>
that's what I have to say about that
<shevy>
fear the roaming platzhirsch!
<eam>
"undead" is weird because everyone agrees undead are actually dead
<platzhirsch>
indeed
* platzhirsch
bells
<platzhirsch>
:|
<baweaver>
We have ways of dealin' with zombies
* baweaver
shines hammer
charliesome has joined #ruby
<shevy>
they will hide in threads
<platzhirsch>
Where's yorickpeterse
<shevy>
a zombie
kadoppe has quit [Ping timeout: 260 seconds]
charliesome has quit [Client Quit]
timonv has joined #ruby
<platzhirsch>
Dude, we need your holy XML parser Oga to defeat the zombies
DmitryBochkarev has joined #ruby
<ytti>
exec summary, how is it better tha nokogiri, not challenging, just curious
Pupeno has joined #ruby
<adaedra>
apeiros: you're the one who give the name!
<adaedra>
gave?
<eam>
well for one it's newer
<platzhirsch>
better than nokogiri? There's something better than nokogiri?
<adaedra>
ugh, english,
<apeiros>
adaedra: what? I didn't name you adaedra!
<apeiros>
or did I?
<adaedra>
eam: I'm dead on the inside
<adaedra>
apeiros: no, dogedra
kadoppe has joined #ruby
<apeiros>
aha
sharkman has quit [Quit: Leaving]
ruurd has quit [Quit: ZZZzzz…]
Pupeno has quit [Remote host closed the connection]
terabytes has quit []
toertore has quit [Read error: No route to host]
bootstrappm has quit [Quit: bootstrappm]
bootstrappm has joined #ruby
northfurr has quit [Quit: northfurr]
<mwlang>
what’s the most efficient way to remove “.foo” from this string (“foo” can be any valid model name): “activerecord.attributes.foo.login" => “activerecord.attributes.login”
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<adaedra>
['.foo'] = ''
<eam>
unless there's another element called .foobar.
<ytti>
proper regular expression scales extremely well
<mwlang>
actually, since I know the “prefix” I want to operate will always be “activerecord.attributes”, perhaps: "activerecord.attributes.#{a.split('.').last}" (where a = "activerecord.attributes.foo.login"
juanpablo_ has joined #ruby
malconis has joined #ruby
<ytti>
but these enchanced engines which support uhh, unregular expressions, can scale terribly
<cek>
How do you invoke a byebug debugger from withing ruby program?
<cek>
"debugger" doesn't work
dgs has joined #ruby
<jhass>
cek: I just use pry + pry-byebug
<adaedra>
^
<mwlang>
adaedra: is regexp even going to be faster than: "activerecord.attributes.#{a.split('.').last}" if a =~ /^activerecord.attributes/
<jhass>
and then require "pry"; binding.pry
<adaedra>
a.start_with?
leafybasil has joined #ruby
<ytti>
mwlang, the point is, the features ruby offers make regular expression non regular
<ytti>
mwlang, academically speaking
apt-get has quit [Ping timeout: 252 seconds]
<ytti>
mwlang, which are /impossible/ to scale to same performance as proper regular expression
workmad3 has joined #ruby
<cek>
ouch, actually, it worked. It just doesn't stop on debugger but the line after that, so if debugger is the last line, nowhere to stop
<ytti>
mwlang, however, this will mostly be academic issue, as the poor scalability will only occur in somewhat constructed examples
<adaedra>
mwlang: but otherwise, your solution should be ok
jxv has quit [Remote host closed the connection]
<mwlang>
ytti: Ah
<ytti>
mwlang, read the article when you have time, it's quite interesting
<mwlang>
adaedra: I forgot about start_with? nice change there: "activerecord.attributes.#{a.split('.').last}" if a.start_with? "activerecord.attributes"
nhhagen has quit [Remote host closed the connection]
yqt has quit [Ping timeout: 246 seconds]
<karapetyan>
shevy: dat fucking rabbits killing me)
* mwlang
almost flunked finite automata class. :-o
mblagden_ has joined #ruby
jamesaxl|2 has joined #ruby
bruno- has joined #ruby
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
victortyau has quit [Remote host closed the connection]
<ytti>
mwlang, pfft, i'm completely uneducated, that article does not require science background
Voker57 has quit [Read error: Connection reset by peer]
<ytti>
i applaud to the author, i know i'm not able to explain complex issues in that clarity
<ytti>
to someone who has no clue of the subject, i'm useless