ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
runescape07rsps has joined #ruby
__Yiota has joined #ruby
skweek has quit [Ping timeout: 276 seconds]
<roboncloud>
i don't see any issues with rspec... works well
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
t-recx has quit [Quit: t-recx]
chouhoul_ has joined #ruby
nostalgiccloud has quit [Ping timeout: 260 seconds]
polishdub has quit [Quit: leaving]
<zenspider>
if you like an slow overly complicated test framework... sure
chouhoulis has quit [Ping timeout: 276 seconds]
nostalgiccloud has joined #ruby
cagomez has quit [Remote host closed the connection]
brent__ has quit [Ping timeout: 248 seconds]
nobitanobi has joined #ruby
cagomez has joined #ruby
__Yiota has quit [Ping timeout: 246 seconds]
laphoraig75 has quit [Ping timeout: 240 seconds]
cagomez has quit [Ping timeout: 240 seconds]
<roboncloud>
@zenspider i've experimented with most testing frameworks in Ruby: minitest, rspec(@ work, mostly), test-unit, & bacon. speed hasn't been an issue with any of them.
nobitanobi has quit [Remote host closed the connection]
nobitanobi has joined #ruby
kn-928 has quit [Ping timeout: 255 seconds]
guacamole has quit [Ping timeout: 260 seconds]
<roboncloud>
not sure if speed improvements minitest may make are negligible, too. if i use minitest or rspec, my rails test suite will still take too long to boot, and over time it normally only gets worse.
hutch34 has joined #ruby
spheric has joined #ruby
<elomatreb>
Boot time is another thing, but it is true that rspec seems to be rather slow. My suite currently takes ~2s for 150 examples (not including boot time, a fairly average Rails app).
nobitanobi has quit [Ping timeout: 260 seconds]
<roboncloud>
i'm doubtful that rspec is the bottleneck
nacsurte has quit [Ping timeout: 260 seconds]
<elomatreb>
But I got used to it years ago and it just feels more comfortable than test-unit-style frameworks
catphish has joined #ruby
nostalgiccloud has quit [Ping timeout: 240 seconds]
<zenspider>
roboncloud: then you're not measuring well enough.
<roboncloud>
are we also really complaining about 2s for 150 examples. anything under 1 minute is great to run all your projects tests. i don't think switching test framework is gonna shave anymore than a few seconds at most.
<zenspider>
elomatreb: what level are those tests?
<zenspider>
roboncloud: see above about measuring
<zenspider>
(ie, you're objectively wrong)
<roboncloud>
it sounds like you should have measurements already, given your level of confidence about it
<roboncloud>
want to share?
nostalgiccloud has joined #ruby
<elomatreb>
zenspider: No heavy integration stuff (no capybara or something like that), mostly just the components indepdently (if that's what you mean)
<catphish>
this is probably off topic, but i feel the need to rant about some ignorance that i just experienced from a fellow developer when i reported a bug: https://github.com/ruby-amqp/bunny/issues/515 is it really so hard to believe that an application only has one thread
<roboncloud>
it's easy to say you're wrong. you've written minitest, and claim rspec is "slow" to the point it matters. so show me some evidence of that please.
<zenspider>
I've shared plenty. go see my talks. my blog. etc.
<zenspider>
well.... since you've given no numbers. haven't given any meaningful statistics... yes. at this point you're making it up or wrong. I've published my numbers. I've curve fit it. I'm not talking out my ass
brent__ has joined #ruby
<roboncloud>
heh. okay, let's step back, because this is crazy. i asked for numbers, you said go find them, in my talks or blog. so i found a benchmark, on your blog. i adapted it, run it against ruby 2.4, posted the benchmark, AND the results.
<roboncloud>
so really, what are you talking about?
<zenspider>
running your code as-is on my system, since the tests are basically the same as my previous code.... they're running too fast on both. I don't think either version is actually running tests
<roboncloud>
that's posible
<roboncloud>
let me check
<zenspider>
you JUST posted the results.. so don't pretend you were forthright
<zenspider>
and a single run is meaningless
jenrzzz_ has quit [Ping timeout: 246 seconds]
<zenspider>
I think this is probably the cost of fork, loading code, and that's about it? I can't tell
<roboncloud>
i posted the benchmark, as a standalone executable script you could run on your computer (if you can bring yourself to install bundler)
<roboncloud>
yeah
<roboncloud>
the tests aren't running....
<zenspider>
I'm getting roughly .267 and .265... against my .3 and .9... so they're not running for some reason
<zenspider>
in the case of fork... it might not run the at_exit handler the same way...
milardov_ has quit [Remote host closed the connection]
<warrshrike_>
the only way I know other than regex is string.split chaining
<bougyman>
I'm trying not to program this for you and just get you thinking.
<warrshrike_>
bougyman: how would recursion do it? some bfs voodoo?
<warrshrike_>
learning from a gurus work
nicolai86 has joined #ruby
<warrshrike_>
bougyman: it would be very helpful if you programmed it tho ^_^
ur5us has quit [Ping timeout: 240 seconds]
<bougyman>
that's how you become guru.
<warrshrike_>
bougyman: fair enough ~_~
<bougyman>
not as helpful as you figuring it out yourself.
milardovich has quit [Read error: Connection reset by peer]
gix has quit [Quit: Client exiting]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bougyman>
there's no anchor you could use?
<bougyman>
That's kinda the rule with when you use regex or not.
<warrshrike_>
bougyman: whats an anchor
warrshrike has quit [Ping timeout: 260 seconds]
<bougyman>
If you can't anchor it, probably not the right tool.
nacsurte has quit [Ping timeout: 248 seconds]
<bougyman>
\b, for instance
<bougyman>
if the last ] were always followed by a \n, you could use $
milardovich has joined #ruby
<bougyman>
but that's not applicable here.
<bougyman>
^ and $ are anchors, but there are many others.
<warrshrike_>
bougyman: oh yeah I don't think it is. the thingies end with ] so I was using that as last matching char but as we saw it causes problems with [] in method args
<bougyman>
don't [ inside the ^[ ]$ fuck you up just as much?
<bougyman>
I guess only if they come after a ] in it.
<bougyman>
still, it's a mess.
<warrshrike_>
yeah...
<bougyman>
you can't contain on [ and ] if [ stuff ] stuff can contain [ and ]
<warrshrike_>
bougyman: exactly, thats the issue
dionysus69 has quit [Ping timeout: 260 seconds]
<warrshrike_>
"], [" maybe this can be the inter thingy boundary?
<bougyman>
wait, there's always quotes in the thing?
<bougyman>
If so, that's your anchor.
<warrshrike_>
what do you mean quotes? no theres no ""
<warrshrike_>
its just ], [
<bougyman>
[" starts it, and "] ends it.
<bougyman>
oh.
<bougyman>
well you put quotes there :)
<warrshrike_>
bougyman: hahah yeah I was quoting
<warrshrike_>
so it has this pattern []. [], []
<warrshrike_>
and each [] can have some [] too
<bougyman>
the comma could be used, I think that's why 08/15-22:03 <....... elomatreb> warrsrike: Can commas appear in the brackets/fields?
<bougyman>
he asked that.
<bougyman>
if there can be commas in there, too, that fucks you up, a bit
<bougyman>
cause you can't guarantee ], won't be in the input
<bougyman>
1st rule of regex: Know your data.
<elomatreb>
My initial thought was to split on ,\s*, to allow greedy matching on []
<warrshrike_>
yes it can have commas
<warrshrike_>
as java methods arguments are comma seperated
<warrshrike_>
and enclMEthods are just java methods
<warrshrike_>
what about ], [ tho?
A124 has quit [Quit: '']
<warrshrike_>
java method args can't begin with [ right?
<elomatreb>
If the format (i.e. the order of stuff) is fixed you could use that to your advantage
<warrshrike_>
so that means there can't be a ] followed by , followed but [ INSIDE the outer []
<warrshrike_>
elomatreb: yes its fixed
<warrshrike_>
id always comes first etc
SeepingN has quit [Quit: The system is going down for reboot NOW!]
jackjackdripper has joined #ruby
elsevero has joined #ruby
<elomatreb>
Then anchor the regex with the key names, that should allow you to use brackets and greedy matching
<warrshrike_>
elomatreb: how can I do that?
jamal7 has joined #ruby
<elomatreb>
E.g. /\[Node Id: (\d+)], \[Java Type & Name: (.+)], \[EncClass: ....
hahuang65 has joined #ruby
<elomatreb>
It won't be fast but I think it should work
<elomatreb>
Additional tip: Name your matching groups, like (?<node_id>\d+)
AndBobsYourUncle has joined #ruby
wilbert_ has joined #ruby
<warrshrike_>
elomatreb: this? res = str.scan(/\[Node Id: (\d+)], \[Java Type & Name: (.+)], \[EnclClass: (.+)], \[EnclMethod: (.+)\], /).to_h
hahuang65 has quit [Ping timeout: 240 seconds]
<elomatreb>
That last group would capture until the end of the string, if you only care about those keys you need to include the start of the next key as well to anchor it again
<warrshrike_>
elomatreb: iike this? res = str.scan(/\[Node Id: (\d+)], \[Java Type & Name: (.+)], \[EnclClass: (.+)], \[EnclMethod: (.+)\], \[/).to_h
MrBusiness has joined #ruby
ta_ has quit [Remote host closed the connection]
<elomatreb>
Almost, it would capture SflowType as well
frozengeek_ has joined #ruby
<elomatreb>
End it with [SflowType, and it should work
sleetdrop has joined #ruby
<warrshrike_>
elomatreb: so resa = str.scan(/\[Node Id: (\d+)\], \[Java Type & Name: (.+)\], \[EnclClass: (.+)\], \[EnclMethod: (.+)\], \[SflowType/).to_h
tastygradient has joined #ruby
<warrshrike_>
I get this error: `to_h': wrong array length at 0 (expected 2, was 4) (ArgumentError)
<elomatreb>
It seems to work for me (the regex)
<warrshrike_>
elomatreb: are you doing .to_h at end?
rabajaj has joined #ruby
kn-928 has joined #ruby
<elomatreb>
.to_h on an array expects an array of the form [[key, value], [otherkey, othervalue]], which would result in {key: value, otherkey: othervalue}
<elomatreb>
See above, you should start by naming your capture groups
oleo has quit [Quit: irc client terminated!]
dviola has quit [Quit: WeeChat 1.9]
ana_ has joined #ruby
<elomatreb>
Then, use #match instead of #scan and call #named_captures on the result to get a Hash (i.e. `str.match(/yourregex/).named_captures`)
frozengeek_ has quit [Quit: frozengeek_]
<warrshrike_>
elomatreb: I guess array is fine too since I'm just going to send the value to a function...
<warrshrike_>
why does enclMethod have a preceding whitespace?
<elomatreb>
Because there are two spaces in your data, but we only have one in the regex, so it captures the second space as well
kn-928 has quit [Ping timeout: 248 seconds]
<warrshrike_>
elomatreb: gotcha. will use str.strip on it
<elomatreb>
Keep in mind though that this whole thing will break when the format of the data changes even slightly
f48ds2 has joined #ruby
frozengeek_ has joined #ruby
alex`` has joined #ruby
wilbert_ has quit [Ping timeout: 240 seconds]
apparition has joined #ruby
<warrshrike_>
elomatreb: yeah format isn't expected to change. thanks a lot man
jameser has joined #ruby
alex`` has quit [Quit: WeeChat 1.9]
milardovich has quit [Remote host closed the connection]
uZiel has joined #ruby
dlitvak has quit [Quit: Connection closed for inactivity]
nacsurte has joined #ruby
shiranuidong has quit [Ping timeout: 255 seconds]
shiranuidong has joined #ruby
shiranuidong has quit [Max SendQ exceeded]
shiranuidong has joined #ruby
nacsurte has quit [Ping timeout: 246 seconds]
claw has quit [Ping timeout: 255 seconds]
claw has joined #ruby
enterprisey has quit [Remote host closed the connection]
<elomatreb>
But it sounds like you're in Rails? There must be a helper for that
<crst>
elomatreb: I'm in middleman
nacsurte has joined #ruby
mikecmpbll has joined #ruby
alfiemax has quit [Remote host closed the connection]
Silthias has joined #ruby
nacsurte has quit [Ping timeout: 246 seconds]
im0nde has quit [Quit: im0nde]
quobo has quit [Quit: Connection closed for inactivity]
Terens_ has joined #ruby
nofxxxx has quit [Ping timeout: 240 seconds]
<Terens_>
I spent 3 weeks and still cant find why ruby as a daemons
opekktar has quit [Quit: Leaving]
<Terens_>
wasts so much memory
<Terens_>
wates
<Terens_>
wastes
nofxxxx has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
ferr1 has joined #ruby
<dminuoso>
Terens_: I'd make a "yo ruby" joke, but I've been told to stop being hateful.
<dminuoso>
Terens_: Essentially Ruby has a really lazy GC, the VM is big and fat
jamesaxl has joined #ruby
<Terens_>
however agent just creates a small file 2-3kb every 15 secs. Memory starts at 40mb and now is 200mb .. also cpu starts at 2.5% and now is 30% and does the same thing.
<Terens_>
after 10 days
Antiarc has quit [Remote host closed the connection]
<dminuoso>
Terens_: Is it stable at 200mb memory?
Antiarc has joined #ruby
<dminuoso>
Terens_: use memory_profiler ?
Joufflu_Fail has quit [Ping timeout: 240 seconds]
Burgestrand has quit [Quit: Closing time!]
MichaelBurge has quit [Remote host closed the connection]
hightower2 has joined #ruby
vall has joined #ruby
MichaelBurge has joined #ruby
jinie_ has quit [Read error: Connection reset by peer]
cahoots has joined #ruby
Burgestrand has joined #ruby
quazimodo has joined #ruby
quazimodo has quit [Read error: Connection reset by peer]
quazimodo has joined #ruby
<quazimodo>
hey what's the preferred internal documentation implementation?
<quazimodo>
is it just rdoc?
<dminuoso>
quazimodo: rdoc is by far the most popular one. Other options include sdoc or yard
<dminuoso>
quazimodo: Don't use a preferred, try them out and judge for yourself.
<dminuoso>
YARD has that advantage of being incredibly extendible
jinie_ has joined #ruby
cahoots has quit [Ping timeout: 240 seconds]
kbengala has left #ruby [#ruby]
NeverTired has joined #ruby
Dimik has quit [Ping timeout: 276 seconds]
hahuang65 has joined #ruby
jackjackdripper has joined #ruby
<quazimodo>
ok
sagax has quit [Ping timeout: 240 seconds]
<quazimodo>
i had a java/.net programmer in the dog park tell me about how i use a scripting language and that real programmers approach from an architecture view and are this and that
<quazimodo>
he did backend also
<quazimodo>
and it was pretty lame
arne has quit [Ping timeout: 255 seconds]
arne has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
Mon_Ouie has quit [Ping timeout: 246 seconds]
Beams has joined #ruby
vall has quit [Read error: Connection reset by peer]
Mon_Ouie has joined #ruby
beilabs has joined #ruby
_main_ has joined #ruby
quobo has joined #ruby
lxnr has joined #ruby
crst has quit [Remote host closed the connection]
__main__ has quit [Ping timeout: 255 seconds]
_main_ is now known as __main__
__main__ has quit [Read error: Connection reset by peer]
jackjackdripper has quit [Quit: Leaving.]
__main__ has joined #ruby
<dminuoso>
quazimodo: The term "scripting language" seems to be just name calling.
<dminuoso>
For example: Can you define what a scripting language is exactly?
lxnr has quit [Ping timeout: 276 seconds]
nacsurte has joined #ruby
alfiemax has joined #ruby
Mon_Ouie has quit [Ping timeout: 255 seconds]
ltem has quit [Quit: Leaving]
biberu has joined #ruby
nacsurte has quit [Ping timeout: 248 seconds]
<matthewd>
dminuoso: One in which, in normal operation, the executed program is given to the runtime in source form
hackeron has joined #ruby
<matthewd>
dminuoso: Doesn't seem like a particularly *useful* distinction, mind you :)
hackeron has quit [Changing host]
hackeron has joined #ruby
<dminuoso>
matthewd: Which seems to apply to most attempts to provide a definition. In my experience what people are trying to express is "this looks like a serious language" and "this looks like a toy language"
dymaxion_ has joined #ruby
<dminuoso>
matthewd: And even that distinction of yours becomes really problematic. It seems to he universally accepted that python is a scripting language, but it can be precompiled. Is it still a scripting language according to your definition?
Mon_Ouie has joined #ruby
<matthewd>
Hence my "in normal operation" hedge ;)
<dminuoso>
Heh. :)
<matthewd>
See also, JavaScript seemingly headed towards a *need* for a compile step
<dminuoso>
matthewd: Considering the projected speedups in Rails with Ruby 3x3 I dont find that surprising
dymaxion_ has quit [Ping timeout: 240 seconds]
nofxxx has joined #ruby
savoir-faire has quit [Ping timeout: 276 seconds]
catphish has joined #ruby
nofxxxx has quit [Ping timeout: 248 seconds]
<dminuoso>
matthewd: Though why did you use "need" ?
<dminuoso>
catphish: I've thought about this problem a real while, and I simply don't see a trivial way to address it.
<dminuoso>
Other than what we talked about in the end
<catphish>
i think my proposed solution is the simplest, it still feels lightly hacky
<catphish>
but probably correct
hackeron has quit [Quit: leaving]
hackeron has joined #ruby
hackeron has quit [Client Quit]
hackeron has joined #ruby
hackeron has joined #ruby
hackeron has quit [Changing host]
<dminuoso>
catphish: I think it might be best to write a simple native extension that can forcibly create that situation.
hackeron has quit [Client Quit]
bweston92 has joined #ruby
hackeron has joined #ruby
tomphp has joined #ruby
<catphish>
that would be cool, i'll see if i can
hackeron has quit [Client Quit]
alfiemax has quit [Remote host closed the connection]
<dminuoso>
catphish: btw Ive also realized why you are getting this situatoin so frequently in the first place.
<dminuoso>
It's most likely a native extension.
<catphish>
that's entirely plausible, i have a lot of gems in this app
hackeron has joined #ruby
<dminuoso>
catphish: or rather any thread.
<dminuoso>
catphish: fork releases the gvl, so another thread can instantly consume it and then starts that atomic_inc/stuff/atomic_dec thing.
<dminuoso>
catphish: So fork is always closely aligned with that racey code.
<catphish>
oh, so immediately after calling fork, but before forking, another thread grabs the lock?
<dminuoso>
right.
<dminuoso>
which in itself is fine
<matthewd>
Does that imply having fork keep the GVL would fix it, though?
<dminuoso>
matthewd: Yes, absolutely.
<dminuoso>
Or let me rephrase: I think so. :)
<catphish>
another odd fact is that i thought my code pre-fork only had the one main thread, but i haven't verified this
<dminuoso>
catphish: Was there a pending signal?
<dminuoso>
Oh wait, we ruled out signal handlers on a single thread, because execution of the main thread is delayed until the signal handler is completed.
<catphish>
so, it does seem like the application only has one thread before it forks, i'm not sure why i didn't pay more attention to this fact previously
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jamesaxl has quit [Read error: Connection reset by peer]
<catphish>
i think the way forward is to try to force this to happen
<catphish>
fortunately that particular issue does seem to have been fixed
<matthewd>
> Please post questions to the mailing list in the future.
<catphish>
that much seemed like a reasonable request :)
<matthewd>
That thread seems to be a pretty good summary of why when I redirect people to our mailing list, I generally don't answer their question even if I know the answer.
<catphish>
i think my politeness in not calling it a bug from the outset was a mistake
mim1k has joined #ruby
<catphish>
but his ignorance astounded me, informed him repeatedly that i only had one thread, provided evidence of this, he didn't want to listen :(
<catphish>
but the issue is resolved, so i guess that's something
charliesome has joined #ruby
<matthewd>
catphish: Yes, the issue is resolved. Move on.
<matthewd>
Your position is, IMO, much less sympathetic than you seem to think it is, and that's before you keep trawling for said sympathy
nacsurte has joined #ruby
ltem has joined #ruby
<catphish>
i am not looking for sympathy, but for condemnation of Michael
astrobunny has quit [Remote host closed the connection]
astrobunny has joined #ruby
umaaji has joined #ruby
<catphish>
mostly for the childish act of locking a thread to assert that his version of facts is correct when it is not
astrobunny has quit [Read error: Connection reset by peer]
bronson has joined #ruby
DoubleMalt has joined #ruby
<apeiros>
catphish: Timeout::Error - are you using timeout? if so, that alone already creates a new thread.
nacsurte has quit [Ping timeout: 240 seconds]
kn-928 has joined #ruby
<catphish>
apeiros: i'm not, Bunny is, it uses several threads
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<catphish>
anyway, i don't really understand the bug, but i'm glad that it's fixed, and not caused by any mistake on my part (except not using the latest version)
pandaant has quit [Remote host closed the connection]
<dminuoso>
As long as there's no permanent trend or just an obviously unreasonable amount of memory used I dont think there's a problem
<catphish>
i often find memory usage in more complex apps can rise over a reasonably long period (days) before eventually settling on a steady value, that chart looks like a fairly small and sensible swing
mim1k has quit [Ping timeout: 248 seconds]
vondruch has joined #ruby
shwouchk has quit [Quit: Connection closed for inactivity]
runescape07rsps has quit [Ping timeout: 246 seconds]
mim1k has joined #ruby
<roboncloud>
catphish: maintenance burden of open source is real.
<roboncloud>
after answering same question for the 500th time, it's understandable if you might be a little tired of it
cahoots has quit [Ping timeout: 240 seconds]
hahuang65 has joined #ruby
quazimodo has quit [Read error: Connection reset by peer]
quazimodo has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hfp_work has quit [Quit: bye]
alfiemax has quit [Remote host closed the connection]
belmoussaoui_ has quit [Quit: belmoussaoui_]
hahuang65 has quit [Ping timeout: 240 seconds]
belmoussaoui_ has joined #ruby
nacsurte has joined #ruby
hfp_work has joined #ruby
opencw has joined #ruby
hahuang65 has joined #ruby
belmoussaoui_ has quit [Client Quit]
nacsurte has quit [Ping timeout: 240 seconds]
belmoussaoui_ has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
adlerdias has joined #ruby
faces has quit [Read error: Connection reset by peer]
runescape07rsps has joined #ruby
belmoussaoui_ has quit [Quit: belmoussaoui_]
apparition47 has joined #ruby
gregf_ has joined #ruby
<catphish>
roboncloud: indeed, i have open source software i can see how that could happen
tirej has joined #ruby
<roboncloud>
yeah. it's a pain in the ass. that's why i think it's better to not seek mass adoption, and if it comes by chance, it's better to emigrate to serbia than make oss customer support part of your life.
bikefighter has quit [Quit: Connection closed for inactivity]
DTZUZO has joined #ruby
<catphish>
for the most part it seems to be a fine balance between telling people they need to learn more / debug issues themselves, while still being polite and providing answers where you know them
<catphish>
and the pleasant small number of tickets that are actually fixable bugs :)
<roboncloud>
yea. if you wanna walk that line at all then probably right. doesnt sound worth it to me. id prefer to write more software than divert my time to issue support and the like.
tvw has joined #ruby
<roboncloud>
esp since it's my free time, which is limited
DTZUZO has quit [Ping timeout: 240 seconds]
uZiel has quit [Ping timeout: 268 seconds]
hutch34 has joined #ruby
hutch34 has quit [Ping timeout: 246 seconds]
beilabs has quit [Remote host closed the connection]
<dminuoso>
catphish: Use a condition a construct of 2 condition variables/semaphores/mutexes to enforce a precise serialization that forces fork to release the gvl, wait for the other thread to have incremeneted the counter, have that thread block, resume the fork and once forked release all synchronization methods and let it exit.
<roboncloud>
decentralised, and super convient.
<dminuoso>
*Use a construct
maryo has quit [Ping timeout: 240 seconds]
<catphish>
dminuoso: that sounds ideal, it will take me a while to pick through that sentence and turn it into code
bronson has quit [Ping timeout: 246 seconds]
ur5us has quit [Ping timeout: 260 seconds]
alfiemax_ has joined #ruby
alfiemax has quit [Read error: Connection reset by peer]
nacsurte has joined #ruby
hightower2 has quit [Ping timeout: 240 seconds]
adlerdias has joined #ruby
nadir has joined #ruby
DLSteve has joined #ruby
nacsurte has quit [Ping timeout: 248 seconds]
alfiemax has joined #ruby
ledestin has joined #ruby
gchristensen has joined #ruby
<gchristensen>
Hi, anyone know how to go from a netmask, ie: `255.255.255.192` to the cidr prefix length, ie: `26`? I'm not finding a way to do it with IPAddr.
jameser has joined #ruby
alfiemax_ has quit [Ping timeout: 246 seconds]
jameser has quit [Client Quit]
<dminuoso>
gchristensen: Yes.
dymaxion_ has joined #ruby
<dminuoso>
gchristensen: Do you want the answer spoonfed, or just a slight tiny hint?
<gchristensen>
how about a tiny hint to start? I'll probably learn it better that way.
<dminuoso>
gchristensen: What is a netmask?
<dminuoso>
And b) IPAddr#to_i
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
graft has quit [Ping timeout: 240 seconds]
mustmodify has joined #ruby
goyox86_ has quit [Ping timeout: 246 seconds]
rippa has joined #ruby
gusrub has joined #ruby
Rapture has quit [Read error: Connection reset by peer]
oleo has joined #ruby
tlaxkit has quit [Remote host closed the connection]
tlaxkit has joined #ruby
guacamol1 has quit [Quit: Lost terminal]
elsevero has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
aufi has quit [Quit: Leaving]
xzhao has joined #ruby
SpiffTR has joined #ruby
_sfiguser has joined #ruby
cahoots has joined #ruby
<mustmodify>
Just had a revelation. I guess it was obvious just hadn't occurred to me.
King_DuckZ has joined #ruby
<mustmodify>
Uh... actually, I'm confused. Can I define a method called ... say ... StateParser ?
<mustmodify>
I know it's against the convention.
<matthewd>
mustmodify: Yes
<King_DuckZ>
hi, is there a simple way to read the selection clipboard from ruby?
gloscombe has quit [Ping timeout: 248 seconds]
<King_DuckZ>
ruby 2.0.0p648, specifically
<mustmodify>
matthewd: Assuming I have a class Location, how would I define Location::StateParser as a method? Not a proc or lambda... but something that would use the interface Location::StateParser(input)
cahoots has quit [Client Quit]
<matthewd>
mustmodify: class Location; def self.StateParser(input); ..; end; end
<matthewd>
mustmodify: But still.. don't do that. :)
bronson has joined #ruby
<mustmodify>
weird, I just tried that and it didn't work for me. I had to call it as Location.StateParser
<dminuoso>
mustmodify: explicit parens
<mustmodify>
matthewd: but you're right, it's so foreign. I was just trying it on for size.
<mustmodify>
Oh...
<mustmodify>
that's probably it.
__Yiota has joined #ruby
<mustmodify>
dminuoso: good catch.
ana_ has quit [Ping timeout: 240 seconds]
catphish has quit [Read error: Connection reset by peer]
<mustmodify>
dminuoso: yep.
<mustmodify>
I've been learning React.
<mustmodify>
ES6 is actually pretty good. I mean, you still can't create a "regular old class", but...
<dminuoso>
Great! Now stop it and learn ELM instead.
<dminuoso>
:P
<mustmodify>
it's pretty good.
<dminuoso>
mustmodify: well the word "class" is so overloaded.. no matter what language you look at, the meaning is totally different.
xzhao has quit [Ping timeout: 240 seconds]
<mustmodify>
I really enjoyed passing around functions that didn't need classes, though. And I just created a module whose sole purpose was to contain a method, so I thought I'd just see how it felt. But it feels bad.
xzhao has joined #ruby
<mustmodify>
dminuoso: Sure. I mean an easy way to create an instance that knows itself and doesn't need all kinds of magic to access itself. Though I'm sure I'd need to write a more technical definition to really express what I mean.
<mustmodify>
Anyway, would it be technically correct to say that methods are not first-class objects in Ruby?
<dminuoso>
mustmodify: They are just not as elegantly accessible as functions in JavaScript for example.
<dminuoso>
mustmodify: Afaik the only things that are not first-class objects are procs and local variables.
<dminuoso>
*BLOCKS
<dminuoso>
Strike that, blocks too.
<mustmodify>
ok, well is there a technical word to say that? That functions aren't ... like ... conventionally aren't used alone?
kn-928 has quit [Ping timeout: 260 seconds]
King_DuckZ has left #ruby [#ruby]
<dminuoso>
mustmodify: Well these form of method objects are not particularly useful and unergonomic. You might as well act as if Ruby had no first-class functions/methods.
cagomez has joined #ruby
<dminuoso>
mustmodify: But then you have to realize that lambdas/procs come into place
<mustmodify>
unergonomic... hunh.
<mustmodify>
So I have a Location class. And our API often receives non-abbreviations for the 'state' field, or non-standard abbreviations, like "s.c." or " s. c." or "south carolina (SC)" or "Pakistan"
goyox86_ has joined #ruby
<mustmodify>
so I wrote a method that takes the common strings and fixes them.
<mustmodify>
It doesn't belong in Location because it's not really modeling that... it's just cleaning up from the API.
<mustmodify>
So I was going to call it Location::StateParser or something.
<mustmodify>
but I guess Location.state_parser is just as good.
<mustmodify>
It's the javascript taking hold of my brain.
MyMind has joined #ruby
Sembei has quit [Ping timeout: 248 seconds]
kn-928 has joined #ruby
gloscombe has joined #ruby
goyox86_ has quit [Client Quit]
mustmodify has left #ruby [#ruby]
gnufied has quit [Remote host closed the connection]
<havenwood>
dminuoso: 2.5-dev is acceptable as well. ;-)
goyox86_ has quit [Quit: goyox86_]
<havenwood>
2.old is old!
<matthewd>
Yeah, I think 2.0 was kwargs, then 2.1 for mandatory
<dminuoso>
havenwood: Remind me to change the rule before I try it out. The gun is ready on my desk.
nobitanobi has quit []
<dminuoso>
20>> def f(f:) end
<ruby[bot]>
dminuoso: # => /tmp/execpad-d461407f62a4/source-d461407f62a4:2: syntax error, unexpected ')' ...check link for more (https://eval.in/846200)
<ruby[bot]>
dminuoso: # => /tmp/execpad-e52841408a1a/source-e52841408a1a:2: syntax error, unexpected keyword_end, expecting ';' ...check link for more (https://eval.in/846210)
<dminuoso>
y u no parse.
elsevero has quit [Quit: elsevero]
elaptics has joined #ruby
AMHOL has quit [Ping timeout: 260 seconds]
grvgr has quit [Quit: Connection closed for inactivity]
Psi-Jack has joined #ruby
xcesariox has joined #ruby
<Psi-Jack>
What is an ideal way to check if a hash(of hash), has a key, and that key's value is true, so I can make a condition that handles appropriately whether the key exists and is true, or not?
<Doow>
Anyone know if the windows ruby installer (from https://rubyinstaller.org/downloads/ ) is possible run silently? or at least without user interaction.
<dminuoso>
Psi-Jack: ignore whether the key exists.
<matthewd>
Psi-Jack: `if h[k]`?
<dminuoso>
Psi-Jack: if it doesnt and you access it, you get a nil
cadillac_ has quit [Read error: Connection reset by peer]
<cschneid_>
Are `Float`s 64 bit under the covers? And are there any lower precision ones that use up less memory?
<cschneid_>
same w/ Fixnum I guess - I have a much more constrained range, but need millions of them :)
<Psi-Jack>
So, if the hash object node['zabbix']['agent_tags']['somekey'] = false, or is undefined, then 'if node['zabbix']['agent_tags']['somekey']' will still handle it as the false result for an else statement?
cadillac_ has joined #ruby
<Psi-Jack>
or would comparing if that == true, be better/the same?
cdg has quit [Ping timeout: 248 seconds]
<cschneid_>
Psi-Jack: I came in halfway through, but `== true` will check that it is *exactly* the value `true`, rather than if you left it off, it's "any truthy value" which is basically anything but false & nil.
<Psi-Jack>
Okay.
<Psi-Jack>
That part is fine. It mandates a specific structure. :)
theunrav_ has joined #ruby
jottr has joined #ruby
theunraveler has quit [Ping timeout: 240 seconds]
jamal7 has joined #ruby
<Psi-Jack>
mostly trying to clean up code that was using arrays when hashes could've been better.
<Psi-Jack>
And far cleaner. :)
jamal7 has quit [Client Quit]
marxarelli has joined #ruby
xall has quit [Ping timeout: 240 seconds]
jaequery has joined #ruby
username_ has joined #ruby
thuryn has quit [Quit: User wandered away]
Rapture has joined #ruby
herbmillerjr has quit [Quit: Konversation terminated!]
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
ResidentBiscuit has joined #ruby
<Papierkorb>
iomotoko: prototyping small ideas ... and actually, as calculator for some things for me lol
<havenwood>
iomotoko: You can put a `binding.irb` or `binding.pry` in your code for debugging.
<Psi-Jack>
So, now I have a whole lot of keys in a hash of hash. I want to loop through each node['zabbix']['trap_agents']['live'] where each key under there matches true. Similarly, for each true value for each key under node['zabbix']['agent_meta']
gloscombe has quit [Quit: WeeChat 1.9]
<tobiasvl>
Psi-Jack: you mean where every value under there matches true, right?
<Psi-Jack>
Yes. I have many key: value pairs in node['zabbix']['trap_agents']['live'] like node['zabbix']['trap_agents']['live']['script1.sh'] = true|false
Puffball_ has quit [Remote host closed the connection]
<Psi-Jack>
I actually need to act on both true, and false in that so that one I think is easy.
<Psi-Jack>
node['zabbix']['trap_agents']['live'].each do |script, flag|
<tobiasvl>
yeah
<Psi-Jack>
For the node['zabbix']['agent_meta']['$name'] I need only the true ones to build a space-seperated string.
Puffball has joined #ruby
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Max SendQ exceeded]
<tobiasvl>
well you can do the same thing basically, or use select
<tobiasvl>
node['zabbix']['trap_agents']['live'].select {|k, v| v }
s3nd1v0g1us has joined #ruby
<tobiasvl>
will return a hash with just the entries where the values are true
gchristensen has left #ruby ["WeeChat 1.7.1"]
t-recx has joined #ruby
<Psi-Jack>
Well, node['zabbix']['agent_meta'].select in that case. But isn't there a simpler way to build the string I need?
<Psi-Jack>
Without having to loop through it again after that .select? ;)
troys is now known as troys_
<tobiasvl>
of course, you can just do something like: node['zabbix']['trap_agents']['live'].select {|k, v| v }.keys.join " "
<Psi-Jack>
ahhh
KeyJoo has joined #ruby
BSAlb has joined #ruby
cwailes has joined #ruby
benjen has quit [Read error: Connection reset by peer]
<tobiasvl>
I guess I meant node['zabbix']['agent_meta']['$name'] but you get the gist
<Psi-Jack>
Yes, yes I do, thank you.
<cwailes>
I'm trying to use rbenv inside of a Docker image. When I run `rbenv install 2.2.2` it will download the tar.bz2 file, but then it simply exits with an return status of 1. Does anyone know where I can find additional info on what caused the error?
<Psi-Jack>
I can also use something similar to that but replace .keys.join with .any? to determine if there's any actual values resulting.
BSaboia has quit [Ping timeout: 240 seconds]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<tobiasvl>
yeah
benjen has joined #ruby
__Yiota has joined #ruby
Joufflu has joined #ruby
laphoraig92 has quit [Quit: Leaving]
<Psi-Jack>
.select {|k, v| v}.keys.join " " would join the values, or the keys?
<cwailes>
I don't usually use Ubuntu, but I have to in this instance.
<havenwood>
cwailes: In the chruby wiki we have the apt deps as: sudo apt-get install -y build-essential bison zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libffi-dev
cagomez has quit [Remote host closed the connection]
<cwailes>
Even with those dependencies installed rbenv still fails silently. I think I'll try the brightbox repo.
iomotoko has quit [Ping timeout: 260 seconds]
dviola has quit [Ping timeout: 260 seconds]
conta has joined #ruby
<havenwood>
cwailes: If you have issues with the Brightbox repo I'd be happy to help you build with ruby-install for rbenv, or I'm sure someone else could help you debug with ruby-build. Let us know!
quobo has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
synthroid has joined #ruby
chouhoulis has joined #ruby
<cwailes>
havenwood: Thanks a bunch. It looks like the repo installed Ruby just fine.
bronson has joined #ruby
synthroi_ has quit [Ping timeout: 246 seconds]
<cwailes>
havenwood: I was attempting to use ruby-build earlier. When I ran `rbenv install 2.2.2` it would download the tar file and exit with a status of 1.
elsevero has joined #ruby
<havenwood>
Maybe a permissions error? Great, nice to use a well-maintained package anyways!
conta has quit [Ping timeout: 240 seconds]
jottr has quit [Ping timeout: 255 seconds]
Silthias1 has quit [Read error: Connection reset by peer]
<cwailes>
havenwood: Could be. I'm kind of rushing through this. I've been trying to get this Ruby on Rails app running for a couple of days now and it hasn't been going well.
<Psi-Jack>
Hmmm.. For some reason node['zabbix']['agent_meta'].select {|k, v|}.keys join " " is coming back an empty string. :/
<Psi-Jack>
Oh... I forgot the v...
<Psi-Jack>
Hah!
cwailes has quit [Quit: cwailes]
cwailes has joined #ruby
bronson has quit [Ping timeout: 246 seconds]
mim1k has joined #ruby
username has quit [Ping timeout: 240 seconds]
ecuanaso has joined #ruby
username_ has quit [Ping timeout: 255 seconds]
FernandoBasso has quit [Ping timeout: 255 seconds]
dviola has joined #ruby
<tobiasvl>
yeah, the v alone means that it selects the ones where v evaluated to true
<tobiasvl>
select takes a block and selects those key-value pairs where the block evaluates to true
mim1k has quit [Ping timeout: 246 seconds]
marxarelli is now known as marxarelli|afk
nadir has quit [Quit: Connection closed for inactivity]
hammerhead has quit [Quit: Page closed]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GGMethos has quit [Ping timeout: 255 seconds]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FernandoBasso has joined #ruby
cdg has joined #ruby
harfangk has quit [Remote host closed the connection]
GGMethos has joined #ruby
cdg has quit [Ping timeout: 240 seconds]
npgm has joined #ruby
elsevero has quit [Quit: elsevero]
xall has joined #ruby
ledestin has joined #ruby
<xall>
currently working through ruby koans. needed a count so came up with this