<haylon>
emrgerd, so much easier. Thank you @lambchop
d^sh has joined #ruby
cschnei__ has quit [Ping timeout: 252 seconds]
jphase_ has joined #ruby
jphase has quit [Read error: Connection reset by peer]
oleo has quit [Read error: Connection reset by peer]
kies has joined #ruby
jphase has joined #ruby
shinnya has quit [Ping timeout: 248 seconds]
jphase_ has quit [Ping timeout: 252 seconds]
jphase_ has joined #ruby
juggler has quit [Remote host closed the connection]
jphase has quit [Ping timeout: 255 seconds]
voiceftp has quit [Ping timeout: 255 seconds]
oleo has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jphase has joined #ruby
enterprisey has quit [Read error: Connection reset by peer]
live__ has joined #ruby
live__ has quit [Remote host closed the connection]
oleo has quit [Remote host closed the connection]
oleo has joined #ruby
jphase_ has quit [Ping timeout: 255 seconds]
mim1k has joined #ruby
gizmore has joined #ruby
knight33 has joined #ruby
jphase_ has joined #ruby
jphase has quit [Ping timeout: 255 seconds]
gizmore|2 has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 248 seconds]
thomasv314 has joined #ruby
__Yiota has joined #ruby
Azure has quit [Remote host closed the connection]
Azure has joined #ruby
mgorbach has quit [Ping timeout: 240 seconds]
workmad3 has joined #ruby
jphase has joined #ruby
mgorbach has joined #ruby
jphase_ has quit [Ping timeout: 246 seconds]
dc4 has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
mjuszczak has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 248 seconds]
helpa has quit [Remote host closed the connection]
enterprisey has joined #ruby
mjuszczak has quit [Client Quit]
Emmanuel_Chanel has joined #ruby
mjuszczak has joined #ruby
eb0t has quit [Quit: WeeChat 1.9.1]
swirlsMD has joined #ruby
eb0t has joined #ruby
eightlimbed has joined #ruby
eb0t has quit [Client Quit]
kapil___ has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 248 seconds]
Kug3lis is now known as Kug3lis_off
mjuszczak has quit []
smelnicki has quit [Ping timeout: 246 seconds]
Radar has quit [Read error: Connection reset by peer]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
guardianx has joined #ruby
ozcanesen has joined #ruby
cagmz_ has quit [Ping timeout: 260 seconds]
dc4 has quit [Ping timeout: 248 seconds]
oleo has quit [Ping timeout: 255 seconds]
enterprisey has quit [Read error: Connection reset by peer]
enterprisey has joined #ruby
armando has joined #ruby
dc4 has joined #ruby
dviola has quit [Quit: WeeChat 1.9.1]
tastytf has joined #ruby
uZiel has joined #ruby
eightlimbed has quit [Ping timeout: 258 seconds]
annhah has joined #ruby
helpa has joined #ruby
annhah has left #ruby [#ruby]
eightlimbed has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 255 seconds]
gix has quit [Ping timeout: 248 seconds]
alfiemax has joined #ruby
uneeb has joined #ruby
Radar has joined #ruby
gix has joined #ruby
apparition has joined #ruby
raynold has quit [Quit: Connection closed for inactivity]
armando has quit [Ping timeout: 252 seconds]
uneeb has quit [Remote host closed the connection]
jiuye has joined #ruby
jiuye has left #ruby ["Closing Window"]
bmurt has joined #ruby
orbyt_ has joined #ruby
eightlimbed has quit [Ping timeout: 258 seconds]
mim1k has joined #ruby
jenrzzz has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
DTZUZO_ has joined #ruby
code_zombie has quit [Quit: Leaving]
mjolnird has quit [Quit: Leaving]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
workmad3 has joined #ruby
eb0t has joined #ruby
cschneid_ has joined #ruby
thomasv314 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
workmad3 has quit [Ping timeout: 248 seconds]
cschneid_ has quit [Ping timeout: 258 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaruga has joined #ruby
jaruga has quit [Client Quit]
jaruga has joined #ruby
minimalism has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rajno has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
eb0t has quit [Quit: WeeChat 1.9.1]
mjolnird has joined #ruby
eb0t has joined #ruby
mim1k has joined #ruby
govg has joined #ruby
knight33 has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
swirlsMD has quit [Ping timeout: 258 seconds]
ur5us has quit [Remote host closed the connection]
cdg has joined #ruby
jenrzzz has joined #ruby
pilne has quit [Quit: Quitting!]
Freshnuts has joined #ruby
cdg has quit [Ping timeout: 252 seconds]
enterprisey has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
Emmanuel_Chanel has joined #ruby
Dimik has quit [Ping timeout: 264 seconds]
LocaMocha has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
enterprisey has joined #ruby
Guest25738 has quit [Read error: No route to host]
voiceftp has joined #ruby
armando has joined #ruby
jenu has joined #ruby
<jenu>
#RubyOnRails
bkxd has joined #ruby
biox has joined #ruby
latemus has joined #ruby
jenu has quit [Quit: Page closed]
<latemus>
dag. my script gets killed for using to much ram. is it the ruby way to read n lines from a file, parse, and write them to temp file so i can read in n more lines without dying of ram
<latemus>
ruby obediently uses up all the memory. i think i've encountered a design error on my part. is rubyish to use a temp file?
NeverTired has joined #ruby
<biox>
latemus what're you trying to do? are you reading a file into memory and trying to manipulate it?
<latemus>
biox: yes, exactly. parsing log files, putting them into hashes, correlating their parts
<latemus>
biox: thank you so much, i'm sure it will. things grow exponentially because of a nested loop
shortdudey123 has quit [Ping timeout: 255 seconds]
<latemus>
i'm dumping the output of the lastb command into a file and manipulating it
<biox>
latemus is this a practice in coding / is there some reason you're not using bash for this use-case? those tools are way faster at parsing log files and the like
shortdudey123 has joined #ruby
apeiros has joined #ruby
<latemus>
biox: i've done this in bash so many times but it always feels so clunky. i suppose i should just refactor my bash into better functions i can reuse, but the code when written in ruby is so easy to read
Cyrus1 is now known as Cyrus
<biox>
yea fair enough, i do stuff in ruby all the time that'd be better in bash because it's fun :)
Cyrus has quit [Changing host]
Cyrus has joined #ruby
<latemus>
biox: haha exactly
<biox>
latemus if you're parsing a log file and outputting to another file i'm wondering why you can't just parse one line at a time and then drop it to reduce memory consumptipon?
<latemus>
biox: see, that is my next move, at present it just inhaled the entire log into memory, im now going to read just one line at a time, pares, and write to an output file
<latemus>
i just wanted to ask if temp files are accebtible form acconding to the 'ruby way', because they remind me of using posix sh
<latemus>
s/accond/accord/
<biox>
tbh i have no idea. but i do know that you can use a lazy enumerator so you don't have to load the whole file into memory - you can do it on the fly discarding old data
<biox>
unless you need to sort it, in which case you'll need to do some extra hackery
basket has quit [Remote host closed the connection]
<latemus>
i do want to sort it. but i can just load the discard file back into memory and then sort, because it wasnt the file itself exhausting memory but the manipulation part while in memory. definitely looking up 'lazy enumerator'
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<biox>
latemus sure, hope it helps! lazy enum is what you're looking for i think
DTZUZO_ has quit [Read error: Connection reset by peer]
<latemus>
right on. just looked it up and that may solve my problem, thanks a million :)
kapil___ has quit [Quit: Connection closed for inactivity]
<latemus>
biox: ^^
postmodern has quit [Quit: Leaving]
workmad3 has joined #ruby
workmad3 has quit [Ping timeout: 258 seconds]
conta has joined #ruby
ana_ has joined #ruby
bkxd has quit [Ping timeout: 248 seconds]
bkxd has joined #ruby
guardianx has quit []
dionysus69 has joined #ruby
ozcanesen has quit [Quit: ozcanesen]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kapil___ has joined #ruby
biox has joined #ruby
kurt has joined #ruby
<kurt>
I’m packing it in for the evening. But I’ve just barely got a ruby language server plugin working for atom, using the one the vscode folks use. And I mean barely. If you’re friendly with atom and docker and want to poke at it, please do: https://github.com/kwerle/ide-ruby
<havenwood>
dminuoso: reminds me of gradual typing, at least you could use it to check the arguments provided to a method requires each method called on the arguments
<havenwood>
it quacks and walks, carry on!
blackmesa has joined #ruby
<havenwood>
dminuoso: hmmm, you could specify the arity as well
<matthewd>
For something quite so meta, I'd really prefer extend, so it stays away from instances
jamesaxl has joined #ruby
<havenwood>
dminuoso: it's not hard to check the method parameters, but it's kinda hard to decide how to notate it
bruno- has joined #ruby
<matthewd>
I must admit it took me a bit to realise the thing you were demonstrating isn't actually a yay-functional weirdness -- between the example, and the style around is_symbol / is_ancestor
<matthewd>
y u no `required_ancestors = @requires.grep(Module)`
Beams has joined #ruby
jamesaxl has quit [Ping timeout: 255 seconds]
jamesaxl has joined #ruby
Kug3lis is now known as Kug3lis_off
sekmo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
maybe it's just too much, but: requires(puts: {arguments: 0..Infinity})
kapil___ has quit [Quit: Connection closed for inactivity]
alfiemax has quit [Remote host closed the connection]
selim has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
alfiemax has quit [Remote host closed the connection]
mjolnird has quit [Quit: Leaving]
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
jphase has quit [Ping timeout: 252 seconds]
mikecmpbll has quit [Max SendQ exceeded]
ramfjord has quit [Ping timeout: 258 seconds]
mikecmpbll has joined #ruby
zautomata has joined #ruby
jphase has joined #ruby
ramfjord has joined #ruby
jphase_ has joined #ruby
sekmo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has joined #ruby
jphase has quit [Ping timeout: 258 seconds]
marr has joined #ruby
ur5us has quit [Remote host closed the connection]
jphase_ has quit [Ping timeout: 255 seconds]
nowhere_man has joined #ruby
bruno- has quit [Ping timeout: 246 seconds]
bw_ has joined #ruby
vondruch has quit [Ping timeout: 248 seconds]
marr has quit [Ping timeout: 248 seconds]
Guest56 has joined #ruby
Guest56 has quit [Client Quit]
alfiemax has quit [Remote host closed the connection]
vondruch has joined #ruby
claudiuinberlin has joined #ruby
jottr has joined #ruby
jphase has joined #ruby
nowhere_man has quit [Quit: Konversation terminated!]
nowhere_man has joined #ruby
jphase_ has joined #ruby
jphase__ has joined #ruby
jphase has quit [Ping timeout: 252 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jphase_ has quit [Ping timeout: 252 seconds]
jphase has joined #ruby
cdg has joined #ruby
swirlsMD has joined #ruby
jphase__ has quit [Ping timeout: 252 seconds]
megamos has quit [Ping timeout: 248 seconds]
morfin has joined #ruby
<morfin>
hello
jphase has quit [Ping timeout: 252 seconds]
claudiuinberlin has joined #ruby
cdg has quit [Ping timeout: 252 seconds]
ramfjord has quit [Ping timeout: 248 seconds]
swirlsMD has quit [Ping timeout: 252 seconds]
marr has joined #ruby
<morfin>
i have hash of hashes like {hashrate: {pplns: 10, solo: 20, total: 30}, fee: {pplns: 1, solo: 2, total: 3}} what's simpliest way to convert this hash to array of hashes like [{metric: :hashrate, value: 10, tags: {pool: 'foo', type: :pplns}, ...} ?
<ruby[bot]>
canton7: # => [{:metric=>:hashrate, :pplns=>10, :solo=>20, :total=>30}, {:metric=>:fee, :pplns=>1, :solo=>2, :tota ...check link for more (https://eval.in/883346)
ramfjord has joined #ruby
<morfin>
nope
<canton7>
you'll need to give more details, then
<morfin>
resulting hash should look like this: [{metric: :hashrate, value: 10, tags: {pool: 'foo', type: :pplns}}, ...]
<canton7>
where does 'value' come from? where do the 'tags' come from?
<morfin>
*array
<morfin>
value is 10, 20, 30 etc
ur5us has quit [Ping timeout: 260 seconds]
<morfin>
currently tag is key in inner hash
enterprisey has quit [Quit: Leaving]
LnxBil has joined #ruby
<canton7>
I give up I'm afraid, I've got work to do. You need to provide even more detail -- "value is 10, 20, 30 etc" doesn't describe how to calculate 'value' given ' {pplns: 10, solo: 20, total: 30}'
<morfin>
{pplns: 10, solo: 20, total: 30} values are coming from here
<tobiasvl>
The implementation makes no guarantees about the order in which the combinations are yielded.
<Bish>
but the fuck is a combination?
<tobiasvl>
(every time I google ruby docs I end up with different versions)
<matthewd>
Unique subsets
cats has quit [Ping timeout: 255 seconds]
<elomatreb>
*Unique subsets of length n
<matthewd>
Bish: The result of combining things?
<matthewd>
> a joining or merging of different parts or qualities in which the component elements are individually distinct
<Bish>
so.. for n=2 that means..
<Bish>
if i take every combination, swap the arrays inside the result, add these arrays to it
<Bish>
i get .. permutation?
<Bish>
so its permutation but [1,2] == [2,1] (for the method)?
<matthewd>
Yes, because with n=2, there are two possible orders for each combination
<Bish>
so its permutation but without order, i get it, great thanks
<Bish>
i never understood that
<elomatreb>
Think of set theory: {a,b} is the same set as {b,a}
<Bish>
yeah i got it now :)
<Bish>
i studied cs, but never listened in lin algebra
<Bish>
(where we had this kind of stuff)
<Bish>
i just didn't see the pattern
<elomatreb>
I wish I could get away with not listening in maths lectures :(
ldnunes has joined #ruby
<Bish>
that 2,1 is not in because 1,2 is
<Bish>
elomatreb: just dropout
<Bish>
who needs studying
cpruitt has joined #ruby
<elomatreb>
I do like it, it's just that I have a hard time with maths so I have to concentrate to get it
kassav_ has joined #ruby
<Bish>
yeah well, i liked it to, but it didnt get me anywhere to do it in uni
<matthewd>
Bish: If you think of them in terms of their actual implementation: permutation is (0...size).each {|i| (0...size).each {|j| next if i == j; yield [self[i], self[j]] } }
rippa has joined #ruby
<matthewd>
i.e., two nested loops both covering the whole range
dionysus69 has joined #ruby
<matthewd>
While combination is: (0...size).each {|i| (i...size).each {|j| next if i == j; yield [self[i], self[j]] } }
<matthewd>
i.e., the nested loop only covers the "remainder" of the outer loop in each cycle
andikr has quit [Remote host closed the connection]
knight33 has joined #ruby
<Bish>
matthewd: thanks alot!
kassav__ has quit [Ping timeout: 260 seconds]
<Bish>
finds.each_with_index do |h1,i1|
<Bish>
finds.each_with_index do |h2,i2|
<Bish>
found this code
<Bish>
how stupid!
<matthewd>
If it actually needs the indexes, it might be necessary ¯\_(ツ)_/¯
synthroid has quit [Remote host closed the connection]
ldnunes has quit [Ping timeout: 240 seconds]
vee__ has quit [Ping timeout: 248 seconds]
chouhoulis has joined #ruby
<Bish>
shit, it might be
<Bish>
but even then i could do
<Bish>
.each_with_index.permutation?
<morfin>
can i somehow find value(single) in hash and return it instead of array k,v ?
vtx has joined #ruby
<vtx>
hi guys, has anyone here ever authenticated against an ldap server with ruby?
<elomatreb>
morfin: Hash#values ?
Technodrome has joined #ruby
<morfin>
ah of course
<Bish>
>> {a:1,b:2,b:3}.find {|k,v| v == 3 }
<ruby[bot]>
Bish: # => /tmp/execpad-d697eb517b08/source-d697eb517b08:2: warning: key :b is duplicated and overwritten on li ...check link for more (https://eval.in/883490)
<ruby[bot]>
horsey99: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<horsey99>
this one /Users/foo/.rvm/gems/ruby-2.4.2@global/gems/did_you_mean-1.1.0/lib
<horsey99>
what the fuck does my .rvm/gems have to do with a freshly compiled ruby?
<havenwood>
horsey99: looks normal
<havenwood>
horsey99: seem my link above
<havenwood>
see*
<horsey99>
havenwood i'm reerring to the .rvm path
<havenwood>
horsey99: are you not using RVM?
__Yiota has joined #ruby
<horsey99>
no
<havenwood>
I have bad news for you... you're using RVM.
<horsey99>
well i am, but this is a freshly compiled ruby that i want to be completely self-contained
<havenwood>
;-P
<horsey99>
but i don't want to be using rvm for THIS ruby :)
<havenwood>
horsey99: rvm use system
<horsey99>
havenwood well my question is, how does that .rvm path end up on the $LOAD_PATH? is there an environment variable that it's setting?
<horsey99>
i just want to remove it, so this ruby is completely self contained
<matthewd>
`gem env` might have a clue
<matthewd>
But yes, removing it is what `rvm use system` should do
cschneid_ has quit [Read error: Connection reset by peer]
<horsey99>
cool but i'm also just curious -- where is that .rvm path being added to the $LOAD_PATH? is it an environment variable? if so, how can i see exactly how it's being set?
cschneid_ has joined #ruby
<havenwood>
horsey99: $GEM_HOME
<havenwood>
horsey99: You could go spelunking in the RVM source code and gain some insight. But it's a deep cave, be careful.
<havenwood>
horsey99: If you really want to get into RVM internals details, that's really more shell than Ruby, but I'd be happy to help in the #RVM channel.
oleo has quit [Ping timeout: 246 seconds]
<havenwood>
horsey99: Suffice it to say, the env var GEM_HOME gets set.
<havenwood>
dminuoso: It seems like it'd be good to coalesce the various issues and report them together.
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
most importantly i removed all parens, waging an eternal battle against parens ;-)
charliesome has joined #ruby
vee__ has quit [Ping timeout: 240 seconds]
cagomez has joined #ruby
jottr has quit [Quit: WeeChat 1.9.1]
ta__ has joined #ruby
kuchi has quit [Quit: WeeChat 1.9.1]
kuchi has joined #ruby
ta__ has quit [Remote host closed the connection]
ta__ has joined #ruby
eightlimbed has quit [Ping timeout: 258 seconds]
ta__ has quit [Read error: Connection reset by peer]
Freshnuts has joined #ruby
ta__ has joined #ruby
claudiuinberlin has joined #ruby
dcunit3d has joined #ruby
dc4 has quit [Ping timeout: 246 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
<zanoni>
Question, right now I"m doing #root_dir_scan = Dir.glob("lot of parameters") and then #root_dir_scan.each {|file| File.dirname(file)} . but is there a way to combine my second line into the glob?, so what gets written is just the dirname?
ldnunes has quit [Ping timeout: 240 seconds]
eroux has joined #ruby
<zanoni>
I mean instead of the array having everything, it will just have the dirname?
vee__ has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Psybur has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tmm88 has quit [Quit: Lost terminal]
swirlsMD has joined #ruby
selim_ has quit [Ping timeout: 264 seconds]
<nofxx>
zanoni, you want only the folders/directories?
eroux has quit [Ping timeout: 240 seconds]
selim has joined #ruby
jrafanie has joined #ruby
orbyt_ has quit [Read error: Connection reset by peer]
synthroid has quit [Remote host closed the connection]
<zanoni>
correct, my glob list includes various extension types but I just want the path to the file (not the files themselves) in the array
eightlimbed has joined #ruby
eightlimbed has quit [Client Quit]
eightlimbed_ has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
adlerdias has quit [Quit: adlerdias]
<havenwood>
zanoni: You could use Find.find from the stdlib to build the Array you want while traversing.
<elomatreb>
globbing, mapping to dirnames and getting the unique values may be simpler than that though
<zanoni>
yeah, i'm pretty hooked on glob :) , but i may give Find a go, it's be neater and faster then converting the array after the scan with map! and uniq!
cagomez has quit [Remote host closed the connection]
<matthewd>
It'll be slower than a manual Find etc, because it'll keep iterating the contents of a directory even after it gets a match, but unless you have enormous dirs, ¯\_(ツ)_/¯
cagomez has joined #ruby
synthroid has joined #ruby
Technodrome has joined #ruby
Flabbergazta has joined #ruby
<elomatreb>
`find . -type d -print0`.split "\x00"
<Flabbergazta>
hi is there a ruby equivalent of python rstrip and lstrip?
<elomatreb>
Uh, yes, lstrip and rstrip (on String)
<cr3>
if I have `def foo(a, b)` and I have `args = {a: 1, b: 2}`, how can I pass args so that a=1 and b=2?
<basket>
Regular sub would work fine, too, since you're anchored anyway
Dimik has joined #ruby
<matthewd>
cr3: foo(args[:a], args[:b])
imode has quit [Ping timeout: 264 seconds]
<matthewd>
cr3: You can't use names of positional parameters for invocation
<elomatreb>
Or you could define your method with keyword params and use **
<cr3>
matthewd: darn, that's what i thought from looking all over the place so thanks for the confirmation
yqt has joined #ruby
<zanoni>
matthewd, sorry, i went for that one, had to remember to require 'set' :) works fine
<elomatreb>
You could use foo(*args.values_at(:a, :b)) to save yourself the duplication, btw
<zanoni>
I'll probably try Find as well and test performance, i have about 5 terabytes to test it on
<zanoni>
lots of small files
<elomatreb>
I suspect in that case the solution I wrote with shelling out to find may actually be faster
ams__ has quit [Quit: Connection closed for inactivity]
Axy has quit [Read error: Connection reset by peer]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dc2 has joined #ruby
Technodrome has joined #ruby
alfiemax has joined #ruby
dcunit3d has quit [Ping timeout: 246 seconds]
raatiniemi has joined #ruby
<zanoni>
i'll try it , ty!
Guest16040 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
dc2 has quit [Ping timeout: 260 seconds]
vtx has joined #ruby
bruno- has joined #ruby
Guest16040 has quit [Quit: WeeChat 1.9.1]
dc2 has joined #ruby
synthroid has quit [Remote host closed the connection]
<Pierreb|home>
im trying to do things with time in ruby. i can get current time out (t.strftime("%H:%M")) anyone know how i can check how long it is left in hours/minutes until XX:XX time for example 23:00?
raatiniemi has quit [Quit: raatiniemi]
alfiemax has quit [Remote host closed the connection]
<apeiros>
Pierreb|home: that's sadly more effort than it should be. you can subtract two Time instances and get the difference in seconds
<Pierreb|home>
i only care about hours and minutes
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vtx has quit [Quit: vtx]
raatiniemi has joined #ruby
troys_ is now known as troys
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<al2o3-cr>
no probs
xixo has joined #ruby
<apeiros>
al2o3-cr: Time's are not durations
dc3 has quit [Ping timeout: 240 seconds]
<apeiros>
this will go awry the moment it's >24h or when you forget to use utc
eightlimbed_ has quit [Ping timeout: 258 seconds]
<apeiros>
*Times
<xixo>
Hi, what can it mean when I do `gem install foo`, but when I do `gem which foo` I get a "ERROR: Can't find ruby library file or shared library foo"?
[Butch] has quit [Quit: I'm out . . .]
<al2o3-cr>
apeiros: shit, you're right.
nofxx has quit [Remote host closed the connection]
<al2o3-cr>
i didn't think of that.
<xixo>
Something wrong with the gem's gemspec perhaps?
<havenwood>
matthewd: It complies with the ISO spec.
<havenwood>
But yeah, it's not CRuby.
<havenwood>
matthewd: I regretted typing that after hitting "Enter"
<ziggles>
Anyone here know if the Ruby track on exercism.io covers meta-programming?
<havenwood>
ziggles: Not that I've noticed, but I haven't done all the challenges.
<matthewd>
havenwood: Even ignoring the... limitations of the spec, the "part" in "complying with part of the ISO standard" doesn't seem irrelevant either ;)
<akkad>
mruby looks right.
<akkad>
thanks
<havenwood>
matthewd: touche
<akkad>
le petite enfant?
<havenwood>
a grandchild?
<ziggles>
havenwood thanks
<havenwood>
akkad: yeah, it's certainly related but is a subset
<havenwood>
akkad: and there are a variety of caveats
baweaver is now known as lemur
lemur is now known as baweaver
<havenwood>
matthewd: yeah, you're totally correct - I retract my statement
mtkd has quit [Ping timeout: 255 seconds]
<matthewd>
elisaado: I don't. I've literally never heard of it before.
<RickHull>
I asked in #minitest but it's pretty quiet
<matthewd>
elisaado: For a project I've never heard of, and which seems to have few users and no contributors, it seems to have an impressively well-organised presence: comprehensive readme, nice website
jeffreylevesque has joined #ruby
shwouchk has joined #ruby
<RickHull>
I don't understand the failure on L28 of output.txt -- why is it calculating a fit below 0.9 ?
troys is now known as troys_
alfiemax has quit [Remote host closed the connection]
Psybur has quit [Ping timeout: 260 seconds]
jeffreylevesque has quit [Ping timeout: 252 seconds]
<matthewd>
RickHull: Presumably it's calculating different times than you are
<RickHull>
it prints the times on one line. they match pretty close
<RickHull>
I am printing the tab separated times. minitest prints the times on one line. they basically match
<RickHull>
er, i print the N \t time (table)
<matthewd>
RickHull: Ah, hmm. I guess I'd be cracking open the gem, then.. find where it calls fit_exponential, and output its inputs and outputs
<RickHull>
the minitest code is pretty clean at a glance. I can't imagine there is a bug, but that's what it looks like from my tests
morfin has quit []
guacamole has joined #ruby
troys_ is now known as troys
ResidentBiscuit has quit [Read error: Connection reset by peer]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
smelnicki has joined #ruby
<zenspider>
and linear fits if you do 1000 or 10000 times
<matthewd>
So the differences in the manual timing are the extra block invocation, the fact it's an instance_exec, and the use of clock_time
<matthewd>
And technically the GC.start, though that's outside the timed section, so surely shouldn't influence anything
duckpuppy has joined #ruby
<matthewd>
Maybe try adjusting your manual loop to use some of those?
AnoHito has quit [Read error: Connection reset by peer]
<matthewd>
It sounds like the real answer is just that the numbers are close, but not close enough.. but it still seems potentially interesting to understand *why*
<RickHull>
yes, the numbers yield different r2
duckpupp1 has quit [Ping timeout: 248 seconds]
<RickHull>
so looks more like a timing problem now
chouhoulis has joined #ruby
<zenspider>
how different? is it output vs actual calculations different? The underflow should be small tho
tcopeland has quit [Quit: tcopeland]
apeiros has quit [Remote host closed the connection]
<zenspider>
(basically representation vs value)
<RickHull>
with my timing numbers, I get r2 0.961 from fit_exponential
<RickHull>
with minitest's timing numbers the r2 is 0.877
<RickHull>
i'm now cleaning this up after removing the debug edits from minitest/benchmark.rb
mim1k has joined #ruby
Psybur has joined #ruby
mjolnird has quit [Quit: Leaving]
marr has quit [Ping timeout: 252 seconds]
<RickHull>
updated, just less debug output
chouhoul_ has quit [Ping timeout: 240 seconds]
brw has joined #ruby
<RickHull>
one obvious explanation is just some extra unavoidable overhead in minitest
<RickHull>
at small n, maybe overwhelming?
<zenspider>
RickHull: I'm multitasking a bit too much (I came onto IRC to ask my own questions in #haskell :P)... are you saying that the timing numbers are different or that the fit/R2 calculation might be wrong on my side?
chouhoulis has quit [Ping timeout: 252 seconds]
<RickHull>
i think the math and the minitest lib code is fine
<zenspider>
benchmarking single calls is always going to be problematic regardless of framework overhead. You should always bunch them up to average out the noise
<matthewd>
I'm just intrigued which thing that the framework's doing is adding enough overhead to matter -- it's really not *that* far from the manual loop that's behaving so much "better"
<RickHull>
minitest timing of fib(3) is particularly bad for the r2
<RickHull>
which is not surprising
<RickHull>
fib(5) is probably dipping into noise territory as well
<zenspider>
matthewd: yeah. I dunno... there's all the extra overhead of the reporters and stuff... it is cleaner now that there's no real runner, but... *shrug*
<zenspider>
Again, happy to have all the benchmark stuff questioned and improved
<zenspider>
Maybe there should be a class const that says how many it should automatically do N.times ?
<RickHull>
one problem is I'm picking my N (= 35) to keep the test time reasonable
<RickHull>
just using this fib thing as a toy example
<matthewd>
RickHull: I'd be interested to see what happens to the quality of your manual timing if you switched to clock_time, say
<RickHull>
fib(35) is well into 99% signal territory
<RickHull>
and takes a while on the CPU
<RickHull>
i wouldn't want to do it say 10 times looped
haylon has quit [Changing host]
haylon has joined #ruby
<RickHull>
for small n in bench_range, you could loop extra times and math it out?
<matthewd>
(mostly because that's the easiest to match.. getting the instance_exec right would take more than swapping a method call)
<RickHull>
but not do it for large n?
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<zenspider>
Use Minitest.clock_time ?
jeffreylevesque_ has joined #ruby
GodFather has quit [Ping timeout: 260 seconds]
jeffreylevesque has quit [Ping timeout: 260 seconds]
<RickHull>
ooh, how about for each n in bench_range, execute in a loop up to a full second
jeffreylevesque_ is now known as jeffreylevesque
__Yiota has joined #ruby
<RickHull>
and math it out on the back end
roshanavand has quit [Ping timeout: 260 seconds]
<matthewd>
RickHull: That doesn't help at all
<matthewd>
The timing is the overhead you're trying to overcome; to do that you have to check the time at each iteration
thomasv314 has joined #ruby
cdg_ has joined #ruby
<zenspider>
I'll let you two sort it out... ping me if you need but I gotta study
<RickHull>
sounds good, further discussion to #minitest :)
jphase has quit [Remote host closed the connection]
<RickHull>
matthewd: #minitest? I have a new gist
cdg has quit [Ping timeout: 248 seconds]
Technodrome has joined #ruby
mochiyoda_ has joined #ruby
inoic has joined #ruby
inoic has quit [Client Quit]
Hexafox[I] has joined #ruby
eightlimbed_ has quit [Quit: Ex-Chat]
eightlimbed__ has joined #ruby
d10n-work has quit [Quit: Connection closed for inactivity]
shinnya has joined #ruby
workmad3 has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
eckhardt has joined #ruby
hahuang65 has quit [Ping timeout: 248 seconds]
Mia has quit [Read error: Connection reset by peer]
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
workmad3 has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
eightlimbed__ has quit [Ping timeout: 258 seconds]
lektrik has quit [Quit: Leaving]
mtkd has quit [Ping timeout: 260 seconds]
tlaxkit has joined #ruby
mtkd has joined #ruby
selim has quit [Read error: Connection reset by peer]
<scatterp->
hi i wrote a ruby script requiring a gem it works fine when executed from xterm and also puts $load_path however when i use the system function to run IT
<scatterp->
from cpp i get a diffrent output from load_path
<scatterp->
my question is where did my environment go and how to get back to it via cpp system
latemus has quit [Ping timeout: 240 seconds]
tvw has quit [Ping timeout: 255 seconds]
fullstack has quit [Ping timeout: 246 seconds]
<zenspider>
scatterp-: probably interactive shell settings vs not
<zenspider>
look at what you have in ~/.profile vs ~/.bashrc (assuming) vs ~/.bash_profile, etc
kapil___ has quit [Quit: Connection closed for inactivity]
<zenspider>
I have all of mine symlinked together and sort it out internally
fullstack has joined #ruby
<scatterp->
i lauch it with system "xterm -hold -e 'ruby test.rb'"
<zenspider>
set PATH in front of xterm
<zenspider>
if that fixes it, then address what I said above
ramfjord has quit [Ping timeout: 240 seconds]
<scatterp->
so system "set Path & xterm -hold -e 'ruby test.rb'"
ramfjord has joined #ruby
bruno-_ has quit [Ping timeout: 240 seconds]
Paraxial has quit [Remote host closed the connection]
Paraxial has joined #ruby
cdg_ has quit [Remote host closed the connection]
dc4 has quit [Ping timeout: 255 seconds]
troys_ is now known as troys
tcopeland has joined #ruby
fmcgeough has joined #ruby
<zenspider>
scatterp-: no... you need to learn your shell and how to set env vars
<zenspider>
scatterp-: something like: system "PATH=some:path:to:run:stuff xterm ..."
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has quit [Ping timeout: 255 seconds]
cdg has quit [Ping timeout: 260 seconds]
orbyt_ has joined #ruby
raynold has quit [Quit: Connection closed for inactivity]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nadir has quit [Quit: Connection closed for inactivity]
mjuszczak has quit []
Bhootrk_ has joined #ruby
Bhootrk_ has quit [Max SendQ exceeded]
jphase has joined #ruby
blackmesa has quit [Quit: WeeChat 1.9.1]
jphase has quit [Read error: Connection reset by peer]
jphase has joined #ruby
jphase has quit [Read error: Connection reset by peer]
ozcanesen has joined #ruby
jphase has joined #ruby
eightlimbed__ has quit [Ping timeout: 258 seconds]
mim1k has joined #ruby
eightlimbed__ has joined #ruby
alveric3 has joined #ruby
jphase has quit [Ping timeout: 252 seconds]
ramfjord has joined #ruby
cahoots has joined #ruby
alveric2 has quit [Ping timeout: 240 seconds]
<cahoots>
hi, is there any static code checker that finds things like the use of uninitialized variables? there are certainly cases where it would find false positives, e.g. where you really on method_missing, but it would be good to have a checker that assumes you're not doing that and shows you issues
mim1k has quit [Ping timeout: 252 seconds]
<RickHull>
>> foo
<ruby[bot]>
RickHull: # => undefined local variable or method `foo' for main:Object ...check link for more (https://eval.in/883781)
smelnicki has quit [Remote host closed the connection]
<RickHull>
cahoots: what kind of uninitialized variables are you concerned about?
scatterp- has quit [Ping timeout: 260 seconds]
<cahoots>
RickHull, let's say i rename a variable but i don't update all usages of it
<RickHull>
hm, i guess that's not a static checker
<cahoots>
?
<cahoots>
static checking of this is done in compiled languages...
_aeris_ has quit [Ping timeout: 248 seconds]
<RickHull>
my example shows that ruby itself will raise a NameError for an undefined variable
ramfjord has quit [Ping timeout: 248 seconds]
<RickHull>
that's about as static as it gets, I suppose
latemus has joined #ruby
<cahoots>
what you're saying is, you're not aware of a static checker that does this
ramfjord has joined #ruby
<elomatreb>
Because the false error rate would be impractically high, yes
jphase has joined #ruby
ozcanesen has quit [Quit: ozcanesen]
<elomatreb>
This is why you normally should have tests that cover every code path in Ruby
<RickHull>
it's not clear what a static checker would be, in the context of ruby. you could walk the AST maybe?
<cahoots>
elomatreb, metaprogramming is pretty uncommon in one-off scripts
lxsameer has quit [Ping timeout: 258 seconds]
<elomatreb>
Yes, but a static checker that knows about methods would have to know about every file in your project and all the files of the gems you use, etc
<RickHull>
cahoots: can you give an example where there is an initialization error that ruby doesn't catch, that a static checker could catch?
ahrs has quit [Remote host closed the connection]
<RickHull>
i showed the use of an uninitialized variable that ruby doesn't accept
<cahoots>
RickHull, running a program can take a while, and may not go through every code path on every run. static tests aren't bad, but this provides another layer off checking
ramfjord has quit [Ping timeout: 248 seconds]
<elomatreb>
I.e. if you just analyze every file by itself (like Rubocop does), 99% of the method calls could also be unknown variables
ahrs has joined #ruby
_aeris_ has joined #ruby
<RickHull>
right, what is an example? >> foo is not an example
<RickHull>
because ruby raises a NameError in this case
<cahoots>
i don't think you're understanding my point RickHull
<RickHull>
i'm asking for an example of your point :)
<elomatreb>
RickHull: I don't think they are concerned about that, it's just that to find every occurance of that you have to run every line in a project (which is a lot of work if you don't have tests)
<cahoots>
that's fair elomatreb, it may have to be more limited in scope, e.g. local variables would still be valid to check
ramfjord has joined #ruby
<RickHull>
i don't think you can get more static than what ruby does at requiretime
<RickHull>
and ruby raises a NameError at requiretime
<elomatreb>
No, it does not. It raises an error when executing the line with the invalid variable
<cahoots>
elomatreb, dependencies can still be checked statically, it just requires the sort of complex indexing that good ides do
<RickHull>
elomatreb: great example, thanks!
<RickHull>
i believe this is equivalent to a #cstylemacro (M4?)
<RickHull>
which would also have trouble with static analysis?
<elomatreb>
RickHull: It can't know it at parse time since it might be a method call to something defined elsewhere (since even self could be changed)
duderonomy has quit [Ping timeout: 248 seconds]
<elomatreb>
cahoots: Anyway, the answer is that I don't think there is a Ruby tool that does this. Rubocop is the most common static checker, but it does file-by-file analysis
ramfjord has quit [Ping timeout: 260 seconds]
marr has quit [Ping timeout: 240 seconds]
<RickHull>
whatever your hypothetical static checker does, it would have to do at least what ruby does at requiretime -- agree?
ramfjord has joined #ruby
<RickHull>
i.e. build up some internal representation of what the text in the source file means
nofxx has quit [Read error: No route to host]
<cahoots>
yes, i agree
<cahoots>
makes sense, thanks
nofxx has joined #ruby
<elomatreb>
Rubocop does that, it operates on the AST. There are complete Ruby parsers written in Ruby