havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.1, 2.3.3 & 2.2.6: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
thadtheman has joined #ruby
JeanCarloMachado has quit [Ping timeout: 258 seconds]
Ebok has quit [Quit: Leaving]
Pumukel has joined #ruby
tmtwd has joined #ruby
JeanCarloMachado has joined #ruby
enterprisey has quit [Ping timeout: 240 seconds]
Xiti has quit [Quit: Xiti]
l4v2 has joined #ruby
enterprisey has joined #ruby
ragesoss has quit [Remote host closed the connection]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ragesoss has joined #ruby
jonatin has joined #ruby
enterprisey has quit [Ping timeout: 258 seconds]
oliv_____ has joined #ruby
oliv_____ has quit [Remote host closed the connection]
bronson has joined #ruby
milardovich has quit [Read error: Connection reset by peer]
milardovich has joined #ruby
Renich__ has joined #ruby
Renich__ is now known as Renich
solocshaw has joined #ruby
bronson has quit [Ping timeout: 264 seconds]
zeddan has joined #ruby
ace05 has joined #ruby
cfec0b8d has quit [Ping timeout: 256 seconds]
Pumukel has quit [Ping timeout: 240 seconds]
ace05 has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
postmodern has joined #ruby
zeddan has quit [Ping timeout: 240 seconds]
rhyselsmore has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
d^sh has quit [Ping timeout: 268 seconds]
hahuang65 has quit [Read error: Connection reset by peer]
d^sh has joined #ruby
hahuang65 has joined #ruby
l4v2 has left #ruby [#ruby]
mooser has joined #ruby
l4v2 has joined #ruby
l4v2 has left #ruby [#ruby]
aglorei has quit [Ping timeout: 240 seconds]
mooser has quit [Ping timeout: 240 seconds]
aglorei has joined #ruby
oliv_____ has joined #ruby
cam27 has joined #ruby
fmartingr has quit [Quit: Connection closed for inactivity]
cam27 has quit [Client Quit]
cam27 has joined #ruby
cam27 has left #ruby [#ruby]
cam27 has joined #ruby
cam27 has quit [Client Quit]
cam27 has joined #ruby
cyphase has joined #ruby
cam27 has quit [Quit: cam27]
cam27 has joined #ruby
inkshark has joined #ruby
inkshark has quit [Client Quit]
milardovich has quit []
mikecmpbll has quit [Quit: inabit. zz.]
milardovich has joined #ruby
cam27 has left #ruby [#ruby]
cam27 has joined #ruby
JeanCarloMachado has quit [Ping timeout: 260 seconds]
duckpupp1 has joined #ruby
kent\n has joined #ruby
Pumukel has joined #ruby
duckpupp1 has quit [Ping timeout: 240 seconds]
cam27 has quit [Remote host closed the connection]
hutch34_ has quit [Quit: WeeChat 1.5]
cam27 has joined #ruby
thadtheman has quit [Ping timeout: 240 seconds]
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
arescorpio has quit [Ping timeout: 258 seconds]
houhoulis has joined #ruby
Verity has joined #ruby
<Verity> very nice
eclecticjohny has joined #ruby
milardovich has quit [Ping timeout: 260 seconds]
houhoulis has quit [Remote host closed the connection]
<Verity> lol
jameser has joined #ruby
Verity has quit [Remote host closed the connection]
Verity has joined #ruby
<Verity> oh no
<Verity> it didnt work
<Verity> NoMemoryError: failed to allocate memory
<Verity> from (irb):49:in `permutation' @_@
<Verity> and then all of my programs closed
<allisio> >> n = 474733953312345340626; 10.times.reduce('') { |s, c| n, b = n.divmod(128); s << b }
<ruby[bot]> allisio: # => "Ruby is <3" (https://eval.in/761584)
<Verity> n1n1
Sammichmaker has quit [Ping timeout: 256 seconds]
d^sh has quit [Ping timeout: 260 seconds]
<allisio> As matthewd pointed out earlier, you don't have near enough memory to store 45! permutations at once.
libastral has quit [Ping timeout: 268 seconds]
d^sh has joined #ruby
thadtheman has joined #ruby
libastral has joined #ruby
hutch34 has joined #ruby
<allisio> >> begin; a = [1]; loop { a += a }; rescue NoMemoryError; a.size; end
<ruby[bot]> allisio: # => 8388608 (https://eval.in/761588)
<allisio> Which is interesting, 'cause that's not even a power of 2.
<allisio> I take that back. :/
tau has joined #ruby
<Verity> I cant calculate it
<Verity> how much RAM I would need to hold all permutations of the phrase "the quick brown fox jumps over the lazy dog"
<Verity> it seems like it would be many gigabytes
<matthewd> Verity: Well I told you how many permutations there are earlier, so the RAM calculation is trivial from there
* Verity scrolls up
<allisio> >> (1..'the quick brown fox jumps over the lazy dog'.size).reduce(:*).to_s.gsub /(\d)(?=(\d{3})+$)/, '\1,'
<ruby[bot]> allisio: # => "60,415,263,063,373,835,637,355,132,068,513,997,507,264,512,000,000,000" (https://eval.in/761589)
<allisio> Too many RAMs.
<allisio> All the RAMs in this supercluster, to be sure.
<matthewd> Multiply by 43 bytes per string, divide by 1073741824: 2419442228716867912939070424946119909000000000 gigabytes
<Verity> why do I divide by that number
<Verity> and what on earth is all of this (1..'the quick brown fox jumps over the lazy dog'.size).reduce(:*).to_s.gsub /(\d)(?=(\d{3})+$)/, '\1,'
<matthewd> Bytes in a gigabyte
<Verity> 1..'phrase'
<Verity> matled, ah
<Verity> matthewd, ah
<matthewd> >> (1.."hello".size).to_a
<ruby[bot]> matthewd: # => [1, 2, 3, 4, 5] (https://eval.in/761590)
<Verity> >> (1..", world!".size).to_a
<ruby[bot]> Verity: # => [1, 2, 3, 4, 5, 6, 7, 8] (https://eval.in/761591)
<Verity> oh
<Verity> well thats easy enough
<Disavowed> Hey Verity - how's the project going??
<Verity> return an array of numbers from 1 to the legnthj of the str
<matthewd> (1..n).reduce(:*) is n factorial, which is the number of permutations in a collection of that size
<Verity> Disavowed, well, I think. I finally figured out the crc problem
<Disavowed> Oh neat! Are you still enjoying Ruby as a language?
<Verity> its funny you ask
<Verity> in fact I love it
<Verity> and more and more I feel as though I prefer it to python, but I do need to go deeper with python to be sure
<Verity> although I'm already enjoying ruby much more
ace05 has joined #ruby
<Verity> I never liked all of that indenting
<Verity> and I can use printf here
genpaku has quit [Remote host closed the connection]
<Verity> plus the syntax seems more clean
<Verity> I'll have more to go on soon hopefully, these are my initial impressions
<Verity> I made a simple encryption program too, just for fun
<Verity> its not the most secure
<Verity> but I found some great ruby features along the way
<allisio> Ruby has the best features.
<Disavowed> Verity: I know things about CPython that no-one should ever have to know, but I greatly prefer Ruby for many of the reasons you just delineated
<Disavowed> What features are you enjoying?
genpaku has joined #ruby
enterprisey has joined #ruby
Rodya_ has quit [Remote host closed the connection]
<Verity> I'm still learning it, but map is great
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Verity> also many of the methods that all objects seem to have
Pumukel has quit [Ping timeout: 240 seconds]
Vile` has joined #ruby
<allisio> >> Object.instance_methods.size
<Verity> so conversions are painless, once you know the tricks
<ruby[bot]> allisio: # => 56 (https://eval.in/761592)
<Verity> I learned about packing and unpacking today
Rodya_ has joined #ruby
<Verity> >> "hello".unpack('C*')
<ruby[bot]> Verity: # => [104, 101, 108, 108, 111] (https://eval.in/761593)
<Verity> :)
<Verity> actually that was yesterday
<Verity> but its great, regardless
<Verity> I've had some moments where I assumed something would work and it did
<Verity> that was nice
<allisio> Disavowed: I recently tried to do a deep dive into CPython, but I started hitting walls pretty quickly.
<Disavowed> It's funny you should mention map - It's a core tennet of functional programming and FP is a second class citizen in Python.
<Disavowed> allisio: I read one a while back - I'll see if I can dig it out for you
<Disavowed> My C is horrific but it was so well written
zeddan has joined #ruby
<allisio> Disavowed: Well, I wanted to try my hand at "fixing" the fact that `chr()` doesn't use "\b" as the repr() of 0x8, for instance.
<Verity> oh one more thing, Disavowed, I found my "IDE" for ruby -- I think
<allisio> Turns out the starting point was "Python/clinic/bltinmodule.c.h".
<Disavowed> allisio: Oh that's annoying - I had no idea that's what it did to be quite honest but I can see exactly why you'd want to fix that
rhyselsmore has joined #ruby
<Disavowed> Verity: What did you go with?
<allisio> >> require 'objspace'; ObjectSpace.memsize_of 'the quick brown fox jumps over the lazy dog' # matthewd: Not quite 43. :)
<ruby[bot]> allisio: # => 20 (https://eval.in/761599)
<Verity> I was going to try rubymine but I dont like signing in to use software. So I found visual studio code. On the left, hide/unhide file browser, I can edit my test text files right in there in tabs. Then its got console in the bottom for irb or running the program. It's also got colorizing and ruby highlighting. It has completion for variables you've added. There are plugins for syntax error and debugging, that I've yet to try.
Rodya_ has quit [Ping timeout: 246 seconds]
<Verity> I dont like that its M$ but its open source at least
<Verity> or something close to it
<Verity> its lighghtweight and fast and has increased my productivity with ruby
<Verity> I have access to rubymine for 1 year free though, so I may try that
Trynemjoel has quit [Ping timeout: 264 seconds]
<Disavowed> allisio: I think this was the series: https://tech.blog.aknin.name/2010/04/02/pythons-innards-introduction/ although I suspect it's a little broad for your use case. I really enjoyed reading it from a language design perspective
<Disavowed> Verity: if I was using windows, I would use Visual Studio for sure
<Disavowed> It's one of the best IDEs around in my opinion.
<Disavowed> I have a similarly low opinion of all things microsoft
<Verity> this is vs code
<Verity> its cross platform!
<Verity> if you may not have seen it
<Verity> its really quite nice, actually.
<Verity> its blowing up right now
<Verity> and there are many great plugins
Rodya_ has joined #ruby
milardovich has joined #ruby
<Verity> it seems to fit ruby well
<Verity> I dont need the bulk of a full ide
<Disavowed> Verity: I appreciate the link but you'll pry vim and tmux from my cold, dead hands!
<Disavowed> I actually hadn't seen it though - it looks very nice
<Verity> :)
zeddan has quit [Ping timeout: 240 seconds]
<Verity> do you use any special plugins for ruby, with vim?
<Disavowed> I might actually have a play with this
<Verity> or just basical syntax highlighting
<Disavowed> Yeah a few. I'm particularly fond of anything written by Mr. Pope: https://github.com/tpope?tab=repositories
<Verity> I've been learning some vim. I have a basic setting going on a vps
<Verity> I'll check that link
Rodya_ has quit [Remote host closed the connection]
<Disavowed> The Rails one is wonderful
<Disavowed> I think I use this too: https://github.com/vim-ruby/vim-ruby
<Disavowed> Verity: My tip would be to take a look at plugins like Nerdtree, MRU and Command T - once you can hop between files quickly, Vim becomes very usable, very quickly
<matthewd> Verity: How are you going on your original project?
DaniG2k has joined #ruby
<Verity> I've got the file read and the packets are built correctly. I could improve my padding code, perhaps. It may just be preference. I've started to add more constants and am beginning to think about the state machine
<Verity> I need to send start of transmission, wait for ack, etc]
<Verity> so that will be my next step now that I'm getting some of the basics down
<Verity> I'm really glad I decided to use ruby
<Verity> unless the serial port doesnt work right in the end, lol
<Verity> I havent tested it yet, I'm assuming it will work
<Verity> no errors when I call the methods, etc
<Verity> so I had a strange glitch, also, matthewd and Disavowed. I couldnt figure out why two bytes were being appended to the packet
<Verity> and one of them always seemed to be 194 or something
<Verity> it didnt make any sense
<Verity> the reason ended up being, packet << Digest::CRC8.hexdigest(packet) returned "bb"
<Verity> and .hex on it wasnt doing what I thought, somehow, someway
<Verity> I tried and tried to understand, but couldn't
<Verity> then, I guessed.
<Verity> packet << Digest::CRC8.digest(packet) fixed it.
<Verity> a perfect byte returned, a nd easily appended
mutter2017 has joined #ruby
<Verity> also, packet << " " until packet.length > 5 this is my padding code. I'm not sure if its the best
<Verity> it seems to work great
<Verity> I enjoy how readable ruby code is
oliv_____ has quit [Remote host closed the connection]
<matthewd> Are you working to a defined protocol, or is specifying it part of your task?
<Verity> its defined
<Verity> 7 byte packet, soh, 5 data bytes, 8 bit crc
<Verity> ack + nak, with start and eot
<Verity> and provisions for all states of transmission
<Verity> on send + recieve side
ledestin has joined #ruby
<Verity> receive
<matthewd> And spaces for padding?
<Verity> its actually supposed to be 0xFF, I meant to change that
<Verity> I have a week from wednesday to complete it, and I'm on schedule so far with the packets built and loaded into the array
bronson has joined #ruby
<Verity> >> "hello".chars
<ruby[bot]> Verity: # => ["h", "e", "l", "l", "o"] (https://eval.in/761602)
<Verity> >> "hello".chars << 0xFF
<allisio> Hey, why do you do that?
<ruby[bot]> Verity: # => ["h", "e", "l", "l", "o", 255] (https://eval.in/761603)
<Verity> is chars deprecated?
astrobunny has joined #ruby
<matthewd> huh?
<Verity> oh, it has to be a minimum size
<Verity> thats why we pad it
<Verity> the receiver expects 7 bytes
<havenwood> Verity: If something is deprecated it'll have a deprecation warning.
mutter2017 has quit [Quit: Mutter: www.mutterirc.com]
<Disavowed> Is there any way to see a list of clases in a module at runtime?
<Verity> havenwood, alrigth
<allisio> >> 'foo'.ljust 7, 'x' # Verity
<ruby[bot]> allisio: # => "fooxxxx" (https://eval.in/761605)
<allisio> Regrettably(?), you can't provide a codepoint as the second argument.
<Verity> >> 'hello'.ljust 7, 0xFF
<ruby[bot]> Verity: # => no implicit conversion of Fixnum into String (TypeError) ...check link for more (https://eval.in/761606)
<havenwood> Disavowed: module.constants
<matthewd> "\xFF"
jeyraof^mbpr has joined #ruby
<Verity> >> 'hello'.ljust 7, \xFF
<allisio> Disavowed: `mod.constants.grep(Class)`, even.
<ruby[bot]> Verity: # => /tmp/execpad-7df220ee167c/source-7df220ee167c:2: syntax error, unexpected $undefined ...check link for more (https://eval.in/761607)
<Verity> ah, I see
<matthewd> or even ?\xFF
oliv_____ has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
<Disavowed> allisio: Thank you, you saint.
<Verity> why the ?\xFF vs \xFF
<allisio> ? is for "character literals".
<allisio> The latter is just a SyntaxError.
<Verity> is it?
<matthewd> Verity: My general advice would be not to try to treat a string as a list of bytes; treat it as a list of characters, and only consider the real "rawness" at the very last moment you absolutely must
<matthewd> >> ?x == "x"
<ruby[bot]> matthewd: # => true (https://eval.in/761608)
<allisio> >> ?\M-~ == "\xFE"
<ruby[bot]> allisio: # => true (https://eval.in/761609)
<allisio> Shame about there not being a way to get "\xFF" with a metacharacter.
<Verity> I tried that a bit, but I need to be careful not to oversize the packet
<Verity> so I need to be aware of the sizes
<havenwood> >> module Disavowed; class Puppies; end; class Kittens; end; module Smurfs; end; end; Disavowed.constants.map { |const| Disavowed.const_get const }.grep Class
<ruby[bot]> havenwood: # => [Disavowed::Puppies, Disavowed::Kittens] (https://eval.in/761610)
<Verity> >> "hello" << \xFF
<ruby[bot]> Verity: # => /tmp/execpad-4c8bec10970c/source-4c8bec10970c:2: syntax error, unexpected $undefined ...check link for more (https://eval.in/761611)
<Verity> oh, its a syntax error
<matthewd> Verity: \x is a thing you do inside a string
<Verity> >> "hello" << "\xFF"; << ?\xFF
<ruby[bot]> Verity: # => /tmp/execpad-64bedcd68bd4/source-64bedcd68bd4:2: syntax error, unexpected <<, expecting keyword_end ...check link for more (https://eval.in/761612)
<havenwood> Verity: Please try things in your own REPL first. Just use @ruby[bot] for showing others.
<Radar> ^
<allisio> ^
<Verity> ^
<Verity> captain planet
<allisio> You should still go sit in the corner for a while.
ahrs has quit [Remote host closed the connection]
<Verity> I'm already in the corner, pretty much
<allisio> Are you gonna bite?
ahrs has joined #ruby
Trynemjoel has joined #ruby
<allisio> Is this a bug? https://eval.in/761613
Vile` has quit [Ping timeout: 240 seconds]
solocshaw has quit [Ping timeout: 260 seconds]
roamingdog has joined #ruby
Channel6 has quit [Quit: Leaving]
<matthewd> allisio: I don't think so; all tracepoints seem to be more scoped to syntax than semantics
<Verity> 20 13 05 0D 46 1F 09 13 4A 46 27 0A 0A 0F 15 0F 09 48
<matthewd> If you just want to know when a class comes into existence, inherited would be a better fit
jhack has quit [Quit: Leaving]
flegent has joined #ruby
<Verity> packet.ljust 7, ?\xFF leaves my packet at 5 bytes
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
Xiti has joined #ruby
<matthewd> Verity: That returns a new string; you need an assignment in there
pwnd_nsfw` has joined #ruby
astrobunny has quit [Remote host closed the connection]
uxp has joined #ruby
<matthewd> >> a = "foo"; b = a.ljust(5, "X"); [a, b]
<ruby[bot]> matthewd: # => ["foo", "fooXX"] (https://eval.in/761614)
shinnya has joined #ruby
<Verity> ah
<Verity> I'll save some ram like this
<Verity> a nice clean solution
<Verity> PAD = 0xFF.chr
<Verity> packet << PAD until packet.length > 5
<Verity> and self documenting
pwnd_nsfw has quit [Ping timeout: 260 seconds]
<Verity> but I will mess around with ljust right now to learn it well
renatosilva has joined #ruby
<Verity> so the () are by choice there
Kallis has quit [Quit: Leaving]
solocshaw has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
<matthewd> Saving RAM is not a rubyish concern; in general, favour non-mutating methods
flegent has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix has quit [Ping timeout: 246 seconds]
<matthewd> (you've previously seen one of the reasons for that: you might be mutating something that's referenced from elsewhere)
solocshaw has quit [Ping timeout: 240 seconds]
<allisio> In any case, doing with an explicit loop what you could do with a built-in method call is pretty silly.
uxp has quit [Quit: leaving]
<allisio> Sunob points for being less performant too.
gix has joined #ruby
t-recx has quit [Ping timeout: 260 seconds]
<matthewd> Also that. Using a method whose entire purpose is padding a string to a defined length is pretty self documenting.
<Verity> perhaps I'll look into this a bit
Pumukel has joined #ruby
<Verity> how often should I use ()
<Verity> and is it ok one line to use, thee next not
<Verity> its fixed
<Verity> >> pkt = "1hi"; packet = packet.ljust(6, PAD);
<ruby[bot]> Verity: # => uninitialized constant PAD (NameError) ...check link for more (https://eval.in/761615)
<matthewd> Beyond the obvious "when it's necessary", I use them when I'm using the return value, as opposed to a more statement-like invocation
<Verity> so thats how I can change it
solocshaw has joined #ruby
tristanp has joined #ruby
astrobunny has joined #ruby
flegent has joined #ruby
kobain has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
solocshaw has quit [Client Quit]
_tk421_ has quit [Remote host closed the connection]
_tk421_ has joined #ruby
zeddan has joined #ruby
pilne has quit [Quit: Quitting!]
<Verity> how can I write pad as hex
<Verity> PAD = 255 is what I'm doing now
<Verity> PAD = 255.chr, really
<Verity> PAD = ?\xFF is error
thadtheman has quit [Ping timeout: 256 seconds]
<Verity> incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
<matthewd> Ah, right. You'd want "\xFF".b
<allisio> Why?
<allisio> >> 'abc' << ?\xFF
<ruby[bot]> allisio: # => "abc\xFF" (https://eval.in/761616)
zeddan has quit [Ping timeout: 260 seconds]
<matthewd> 0xFF.chr is a reasonable option too
flegent has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd> allisio: Because that's not an 8-bit string, and the end-goal is to have one of those for writing out
jdm has joined #ruby
milardovich has quit []
<Verity> ruby is so great
thatsnotjack has quit [Ping timeout: 268 seconds]
<Verity> I'm worried about one thing, though.
<Verity> this
<Verity> defining my own CRC class
<Verity> I have a specific generator polynomial and divisor constant
tk422 has joined #ruby
<Verity> this table I'm not too sure about
_tk421_ has quit [Ping timeout: 246 seconds]
<allisio> You can do whatever you want in Digest::CRC#update.
thadtheman has joined #ruby
DaniG2k has quit [Quit: leaving]
Rodya_ has joined #ruby
<Verity> should I be putting some of my code into a function here
<Verity> the part that oepns the file and builds the packets
<Verity> I dont want to make a function for no reason, often its not clear to me when its beneficial
Pumukel has quit [Ping timeout: 258 seconds]
nofxx has joined #ruby
enterprisey has quit [Ping timeout: 268 seconds]
carbonage has quit [Quit: Leaving]
mutter2017 has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
agent_white has quit [Read error: Connection reset by peer]
dviola has quit [Quit: WeeChat 1.7]
jenrzzz has joined #ruby
CloCkWeRX has joined #ruby
<Verity> im going to split it up
<Verity> buidlking the packets is the same every time, so it gets a func
<Verity> but sending them needs a state machine, so it might reallyh clutter the code also
<Verity> so it will have a function
<Verity> but then, how far do I break it down, does sending a packet inside the state machine have a function
CloCkWeRX has quit [Ping timeout: 260 seconds]
agent_white has joined #ruby
roamingdog has quit [Remote host closed the connection]
mooser has joined #ruby
<Verity> ???
mutter2017 has quit [Quit: Mutter: www.mutterirc.com]
<Verity> and also, how can I get this on one line : if packet.length < 6 packet << EOT end
<Verity> I thought indents dont matter
<Verity> but I have to put them on their own line with the end etc
<elomatreb> You need to separate the condition from the if body, either use a ; or `then`
<Radar> Verity: Are you doing the thing again where you talk about code without actually showing the code?
<elomatreb> Alternatively, use the modifier-if, i.e. `packet << EOT if packet.length < 6`
mutter2017 has joined #ruby
<Radar> [14:50:02] <Verity>should I be putting some of my code into a function here
<Radar> I'm referring to ^
<Radar> +1 for using the modifier-if
enterprisey has joined #ruby
thadtheman has quit [Ping timeout: 240 seconds]
mooser has quit [Ping timeout: 240 seconds]
mostlybadfly has joined #ruby
<Verity> ok
tk422 has quit [Ping timeout: 260 seconds]
kernelPaniq has quit [Remote host closed the connection]
kernelPaniq has joined #ruby
<Verity> why might I choosde if packet.length < 6; packet << EOT end vs packet << EOT if packet.length < 6
jenrzzz has quit [Ping timeout: 260 seconds]
<elomatreb> That ; in there is pretty awkward imo, and it's the accepted convention
CloCkWeRX has joined #ruby
spicerack has joined #ruby
Robtop__ has joined #ruby
cam27 has quit [Quit: cam27]
<Verity> so 'packet << EOT if packet.length < 6' is actually preferred over 'if packet.length < 6 then packet << EOT end' its more than just preference
pwnd_nsfw` has quit [Ping timeout: 260 seconds]
thadtheman has joined #ruby
agent_white has quit [Remote host closed the connection]
chaos95 has quit [Ping timeout: 258 seconds]
mutter2017 has quit [Quit: Mutter: www.mutterirc.com]
thadtheman has quit [Ping timeout: 264 seconds]
mutter2017 has joined #ruby
astrobunny has quit [Remote host closed the connection]
mutter2017 has quit [Client Quit]
renchan has joined #ruby
Autolycus has joined #ruby
bronson has joined #ruby
<renatosilva> Verity: it's preference because they do the same thing
<renatosilva> however writing ugly code is always a preference :)
Suslov has joined #ruby
astrobunny has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
jusa has joined #ruby
Pumukel has joined #ruby
Suslov has quit [Quit: Leaving...]
davorb has quit [Read error: Connection reset by peer]
vampirehunter has joined #ruby
davorb has joined #ruby
tenderlove has quit [Read error: Connection reset by peer]
tenderlove has joined #ruby
thadtheman has joined #ruby
flegent has joined #ruby
muelleme_ has joined #ruby
zeddan has joined #ruby
igniting has quit [Ping timeout: 240 seconds]
astrobunny has quit [Remote host closed the connection]
enterprisey has quit [Ping timeout: 256 seconds]
agent_white has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
rhyselsmore has quit [Ping timeout: 260 seconds]
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
shinnya has quit [Ping timeout: 260 seconds]
astrobunny has joined #ruby
flegent has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
muelleme_ has quit [Ping timeout: 260 seconds]
zeddan has quit [Ping timeout: 240 seconds]
thadtheman has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
spyder55 has joined #ruby
spyder55 has quit [Client Quit]
Pumukel has quit [Ping timeout: 256 seconds]
enterprisey has joined #ruby
cyphase has quit [Ping timeout: 258 seconds]
vampirehunter has quit [Quit: Textual IRC Client: www.textualapp.com]
spyder55 has joined #ruby
LiquidInsect has quit [Read error: Connection reset by peer]
Beverage1 has joined #ruby
thadtheman has joined #ruby
LiquidInsect has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
astrobunny has quit [Remote host closed the connection]
Beverage has quit [Ping timeout: 246 seconds]
wkoszek has joined #ruby
<wkoszek> How can I open an issue at https://github.com/ruby/xmlrpc
<Radar> wkoszek: You can't. They don't have it enabled.
astrobunny has joined #ruby
<wkoszek> Radar: This is a part of the core Ruby library. I just wonder if the report should be made in ruby/ruby?
<Radar> wkoszek: I am not sure where it should go.
<wkoszek> Radar: I'll e-mail the hstb@ and ask him
thatsnotjack has joined #ruby
thadtheman has quit [Ping timeout: 240 seconds]
muelleme_ has joined #ruby
spyder55 has quit []
cyphase has joined #ruby
charliesome has joined #ruby
astrobunny has quit [Remote host closed the connection]
cyphase has quit [Ping timeout: 258 seconds]
astrobunny has joined #ruby
Pumukel has joined #ruby
<wkoszek> I'm attempting to understand if this module would let me do XML RPC request via SSL, but without cert validation. I could a piece of code: https://github.com/ruby/xmlrpc/blob/master/lib/xmlrpc/client.rb#L445
Rodya_ has joined #ruby
thadtheman has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
igniting has joined #ruby
<tau> hi.
<tau> i need some help to understand something.
<tau> someone on?
Rodya_ has quit [Ping timeout: 246 seconds]
<wkoszek> tau: yes
<ineb> wkoszek: OpenSSL::SSL::VERIFY_NONE is the option youre looking for
<wkoszek> ineb: Yeah, but from what I see, I have no way to pass it in this module
<tau> wkoszek i'm not sure whether that explains all of it though.
<ineb> wkoszek: maybe monkeypatch? https://paste.xinu.at/d192QO/
<tau> i'm trying to understand something else too: in ruby, it seems i can just extend existing classes by using : class Name # define new methods end then the underlying class gets extended. whats the name of it? is it inheritance?
<ineb> wkoszek: i hope you know that it is a bad thing what youre trying to do
tmtwd has quit [Ping timeout: 258 seconds]
muelleme_ has quit [Ping timeout: 260 seconds]
<wkoszek> ineb: yes
certainty has joined #ruby
Chch has joined #ruby
<tau> ii'm trying to see where socket.puts is defined in here https://ruby-doc.org/stdlib-2.4.0/libdoc/socket/rdoc/Socket.html#method-i-connect_nonblock it seems it is not listed in the part of the class methods either.
<dminuoso> tau: It's called reopening that class.
Pumukel has quit [Remote host closed the connection]
<wkoszek> ineb: I have a self-signed, which is pretty popular to just get encryption.
<dminuoso> tau: Depending on the scenario it's also called monkey patching (which is usually the case when you modify a class/module that does not belong to you)
Pumukel has joined #ruby
zapata has quit [Ping timeout: 264 seconds]
lightheaded has quit [Remote host closed the connection]
<dminuoso> tau: However! Module.prepend is generally the better solution to do that. You just define your own module with the additions, and then you prepend it into the original class.
<tau> dminuoso i see. is monkey patching advisable in ruby? is it 'good'?
<dminuoso> tau: No.
lightheaded has joined #ruby
<tau> dminuso so is it bad in ruby?
<ineb> tau: and your explanation with your puts problem is almost right. However, Socket#puts is a instance method, not a class method. A class method would be called with self.puts, however, the instance method is just called with plain 'puts'.
<ineb> And as you correctly figured out, it overwrites the Kernel.puts method
<dminuoso> tau: Well it's common enough to mention it -> but you effectively violate design contracts if you do it.
oliv_____ has quit [Remote host closed the connection]
<ineb> tau: to further answer your question. Socket is getting the puts from IO
<tau> dminuoso i see.
Chch has quit [Quit: Leaving]
<tau> ineb but, i have the feeling i should use self.puts in Socket(when monkey patching it) isnt it?
<dminuoso> tau: I personally advise against it. The problem is that sometimes it's faster to simply monkey patch ThirdPartyClass than to fork the repository, make a change, commit it and make a pull request, and wait for that version to be released to rubygems.org
<dminuoso> tau: Which is why it's so damn popular
<tau> dminuoso i see.
<ineb> tau: you can check by yourself. Install pry as alternative to irb, and create a socket object
<ineb> show-source Socket.new(AF_INET, SOCK_STREAM, 0).puts
<ineb> shows you how Socket#puts is defined
Pumukel has quit [Ping timeout: 240 seconds]
<dminuoso> tau: Though there are a select few cases where monkey patching has valid use cases, in particular when you *add* methods to core classes.
<dminuoso> tau: For example ActiveSupport extends a lot of Ruby core classes to the point where you can do fancy stuff like: time = Time.now - 5.hours.ago
<tau> dminuoso so, monkey patching in ruby is okay when one knows what he is doing, right?
<dminuoso> tau: As with all the tools, yes.
Verity has quit [Ping timeout: 246 seconds]
<dminuoso> tau: The issue with monkey patching is just that if you do it it will have unknown effects.
<tau> ineb i have the feeling that Socket.puts comes from a module. it seems to not be defined in the class Socket, isnt it?
<tau> dminuoso yea. i see.
lightheaded has quit [Ping timeout: 258 seconds]
<dminuoso> tau: For example: Let's say you start using the File api. Now you would expect that API to have an .open method right?
<tau> dminuoso yes.
<dminuoso> So you write code that assumes that File.open("foo.js") does a specific thing. Now if someone monkey patched that method to delete a file for whatever bizarre reason, your code will be faulty
<ineb> tau: yes, IO module, as i wrote.
renatosilva has quit [Quit: http://renatosilva.net]
<tau> ineb oh. i see. thank you.
antgel has joined #ruby
<dminuoso> tau: So yeah.. dont modify foreign classes unless you know what you are doing.
<tau> i mean, how to know which modules a given class includes?
<tau> dminuoso i see.
<dminuoso> tau: There is no immediate way to do it.
<tau> dminuoso yeah, well, i believe that monkey matching would be mostly safe when it is aggregating new methods to a class but not changing existing methods, wouldnt you agree?
aufi has joined #ruby
<dminuoso> tau: klass.anscestors.select { |e| e.is_a?(Module) }
<tau> dminuoso you mean knowing if a class includes a given module?
<dminuoso> ^-
<tau> dminuoso but i ask knowing that from the docs.
<dminuoso> tau: The easiest way is to check against ancestors directly
<tau> like
<tau> there is no place where it says 'Socket includes IO module'.
<dminuoso> tau: It does indirectly.
<tau> dminuoso how so?
<dminuoso> tau: it inherits from BasicSocket which in turn inherits from IO
<dminuoso> Scroll to the top, to the left there is a card that says "Parent"
<tau> oh
<tau> i see.
<tau> i see it now.
<tau> but BasicSocket says 'Parent' , it gives the feeling that Socket inherits from BasicSocket.
<tau> i mean
<tau> i wonder that Socket class is defined as : class Socket\ninclude IO ... end
<tau> isnt it?
<dminuoso> tau: It gives that feeling because it actually does inherit.
<dminuoso> tau: No.
<ineb> and BasicSocket inherits from IO
<tau> dminuoso lemme show you a snippet of code.
<dminuoso> tau: IO is a class, you cannot include classes.
<tau> yes.
mooser has joined #ruby
<tau> i thought IO was a module(according to ineb)
<tau> hold on
<tau> lemme give a snippet
<tau> it will clarify better what i mean.
<dminuoso> tau: The thing is: there is not much of a difference between classes and modules.
<dminuoso> They are almost 100% identical.
zapata has joined #ruby
<dminuoso> Ruby just imposes a few arbitrary rules on them. Like you cant inherit from a module, or include/prepend/extend a class.
hutch34 has quit [Ping timeout: 240 seconds]
Pumukel has joined #ruby
<ineb> tau: i wrote IO module but i should have written IO class. sorry.
<dminuoso> tau: But in effect whether you said: class Socket; include IO; end; or class Socket < IO; end #=> would make no difference whatsoever to inheritance and rules.
antgel has quit [Ping timeout: 240 seconds]
<dminuoso> tau: It would be the same, except for these arbitrary class/module rules I mentioned
<tau> i think it may clarify better.
<tau> ineb no worries.
<ineb> dminuoso: dont forget super here.
<dminuoso> tau: Right. including and inheriteting are not really any different.
<dminuoso> ineb: Nope.
<dminuoso> ineb: super does not apply, it acts exactly the same.
<tau> dminuoso hmm, lemme give you another snippet.
<tau> hold on
thadtheman has quit [Ping timeout: 260 seconds]
nofxx has quit [Ping timeout: 260 seconds]
<tau> oh
<tau> dminuoso i see. i thought that
<tau> hold on
mooser has quit [Ping timeout: 240 seconds]
<tau> so
<tau> i think i understood.
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<tau> i was thinking that i always had to use 'self.method' to access instance methods.
<tau> from a given class instance.
<tau> but it seems it is not really required. if i have a class instance with two methods alpha and beta i can just call alpha from beta without using self.alpha.
<tau> dminuso are the two forms equivalent, isnt it?
<tau> i got confused because i was reading a ruby tutorial and everyone was using self.method for class instances.
<wkoszek> By the way, I'd still be interested in getting some testers for my Ruby builds: https://github.com/wkoszek/ruby_packages
rippa has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<tau> i may help you, wkoszek.
<tau> just have to check for time.
<tau> i'll drop you a channel where i usually hang, so you can find me there.
<tau> its #vy
thadtheman has joined #ruby
<tau> dminuoso thank you for the insight.
<tau> it helped a lot.
<tau> i'm just curious what to name 'self', i mean it seems to be available naturally in classes but it is not mentioned anywhere(as it happens in python) class name:\n def method(self, ..):
_sfiguser has quit [Remote host closed the connection]
last_staff has joined #ruby
lightheaded has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
siovene has joined #ruby
P1ro has quit [Remote host closed the connection]
cfec0b8d has joined #ruby
bastelfreak has quit [Ping timeout: 264 seconds]
roshanavand has joined #ruby
bronson has joined #ruby
thadtheman has quit [Ping timeout: 268 seconds]
bronson has quit [Ping timeout: 268 seconds]
Xiti has quit [Quit: Xiti]
andikr has joined #ruby
P1ro has joined #ruby
Sauvin is now known as bocaneri
roamingdog has joined #ruby
harfangk has joined #ruby
<dminuoso> tau: It's rather Python that's a bit bizarre in that respect actually.
vali has joined #ruby
conta has joined #ruby
<dminuoso> tau: self in Ruby is a little different
biberu has joined #ruby
<dminuoso> tau: There's certain things in Ruby that change what "self" means. For example if you open a class, then "self" will refer to the class object itself. If you open a method, then "self" will refer to the instance of a given class.
<tau> how do you 'think' about self in ruby?
roamingdog has quit [Ping timeout: 264 seconds]
<dminuoso> tau: It's a little closer to "this" from JavaScript if you are familiar with that.
wnd has quit [Excess Flood]
<dminuoso> But only so much.
<tau> i see.
vondruch has quit [Ping timeout: 246 seconds]
davorb has quit [Read error: Connection reset by peer]
<tau> dminuoso i'm just curious why in some ruby docs(they dont mention you dont need self to call a class instance method).
akkad has quit [Excess Flood]
wnd has joined #ruby
davorb has joined #ruby
<ineb> tau: you can learn all the details about your questions if you learn rubys object model.
<ineb> there a quite some resources about it on the web
thatsnotjack has quit [Ping timeout: 256 seconds]
<dminuoso> tau: "self" is the default receiver for a method if no other is specified.
<dminuoso> tau: For example, if you write: foo.bar then foo will receive the method bar. but if you only write bar(), then it's the same as writing self.bar()
<matthewd> Yeah, it's not necessary (except a few corner cases) -- more like C++, Java, etc
<tau> i see.
akkad has joined #ruby
<tau> i wonder if there are bindings for this : http://wiki.tcl-lang.org/5016
<dminuoso> tau: Now this self business has a lot of implications. It also helps understand how class methods work.
<tau> i have a project thats written in python but ruby is a better language for it. i plan to migrate to ruby and maybe have bindings for that in ruby.
<tau> dminuoso true.
<dminuoso> tau: For example ever noticed how class methods are defined on something that has to do with "self" ?
<dminuoso> Such as def self.foo; end
<tau> yes.
<dminuoso> If you remember, I told you that inside a class definition self becomes the object itself. :-)
<dminuoso> And def foo.bar; end just creates a singleton method on foo, *whatever* foo is.
<tau> those def method.name are a bit tricky to understand.
<tau> i'll write a snippet now.
<dminuoso> tau: they just create a singleton method on an object.
<dminuoso> tau: A method that only belongs to that object and nothing else.
<tau> dminuoso hold on
fmartingr has joined #ruby
jgnagy has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 240 seconds]
jgnagy has joined #ruby
CloCkWeRX has quit [Ping timeout: 240 seconds]
bigkevmcd has joined #ruby
<dminuoso> tau: Try that in your Ruby.
<tau> dminuoso i tried.
<matthewd> tau: The only thing you should have as `foo` in a `def foo.bar` definition is `self`
<dminuoso> tau: "alpha" has to be an object of some kind.
<dminuoso> tau: Which it is not.
<matthewd> You *can* do other things, but it's not something you generally *should* do
<dminuoso> tau: My point is just that when you do say: def self.foo; end there is nothing magical to it, because the object "self" exists in that (and every) context.
hutch34 has joined #ruby
jgnagy has quit [Ping timeout: 240 seconds]
<dminuoso> And you just define that method onto self (whatever that may be)
<tau> dminuoso i wonder what def alpha.foo means inside that class. i mean the usability of it.
Snickers has joined #ruby
<dminuoso> >> def self.foo; end; puts self.methods.include?(:foo)
<ruby[bot]> dminuoso: # => true ...check link for more (https://eval.in/761671)
zeddan has joined #ruby
<dminuoso> tau: The usefulness depends on the circumstance. Generally you will only define singleton methods on class objects.
<matthewd> dminuoso: I really don't think this is a helpful lesson as a follow-on to "how to self". They both have 'self' in their title, but they're a long way apart on any reasonable spectrum (relevance, utility, clarity, ..)
<dminuoso> Yeah probably
stan has quit [Read error: Connection reset by peer]
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
<tau> hold on
<tau> i'll add some commentaries to that snippet which maps to some of my doubts.
stan has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<tau> wait
<tau> i gave the wrong code.
zeddan has quit [Ping timeout: 260 seconds]
<matthewd> tau: This is really not useful. Don't do that.
<tau> mathewd i see.
Qchmqs has joined #ruby
lightheaded has quit [Ping timeout: 260 seconds]
<matthewd> Basically, I'm not sure what you're expecting it to do, but it's not what it does do
<dminuoso> tau: methods are not first class objects like they are in JavaScript.
mark_66 has joined #ruby
<tau> hold on
<tau> lemme try to clarify my doubt.
Kug3lis has joined #ruby
<matthewd> I think "in quite the same way" would be more accurate than "like" there
<tau> i think i got the right question: http://codepad.org/SteOhoOY
<matthewd> tau: Yeah.. that's not a thing.
<matthewd> Methods are called on objects
lightheaded has joined #ruby
<matthewd> Which method you got the object from doesn't affect which methods it responds to
<matthewd> Line 21 is defining beta on `nil`
<matthewd> 26 could equally be `nil.beta` and it would work just the same
<tau> i'm a bit confused with something now.
<matthewd> (because nil is the object that `a.alpha` returns)
astrobunny has quit [Read error: Connection reset by peer]
<tau> matthewd yes, alpha returns nill. but i can call beta on it and it gets called too.
<matthewd> As I said, *you are defining beta on nil*
<matthewd> >> def nil.hello; puts 'howdy'; end; nil.hello
<ruby[bot]> matthewd: # => howdy ...check link for more (https://eval.in/761686)
<matthewd> ^ what you are doing
<tau> matthewd but when i defined beta on nil, the function couldnt be 'aware' of what it returns because it wasnt executed.
<tau> get it?
<tau> when i do def (a.alpha).beta puts "it works" end
<matthewd> Yes it was
<tau> sorry
<tau> oh
<tau> i see.
<tau> indeed.
<tau> it was first executed.
<tau> i got it.
<tau> matthewd i didnt notice that, sorry.
<tau> yes, now i got it.
Bish has quit [Remote host closed the connection]
<tau> interesting.
<tau> so, when i do def method.name it executes the method.
<tau> but what to do when the method receives arguments?
* wkoszek needs to figure out how to make ruby be ruby-2.4 after ./configure && make
* wkoszek wanted to take his ruby_packages repo and push it to a ppa
nertzy has quit [Ping timeout: 240 seconds]
<matthewd> tau: You're not defining `method.method`. You're defining `*value*.method`
<tau> mathewd yes. i see.
<tau> i got it.
<matthewd> tau: If the LHS needs arguments, then you need to give them (and the expression then needs to be in parens)
<tau> i see.
<matthewd> But again: don't ever do this
<tau> matthewd excellent.
<tau> ruby has an amazing syntax.
<tau> it may be confusing sometimes.
<tau> due to its power i think.
jenrzzz has quit [Ping timeout: 260 seconds]
ineb has left #ruby [#ruby]
ta_ has joined #ruby
<matthewd> A big difference between ruby and python is that there are, by design, a bunch of ways to do a given thing. That often means there are ways to string things together in a needlessly complicated way.
jenrzzz has joined #ruby
<tau> methewd yeah.
vondruch has joined #ruby
aganov has joined #ruby
<tau> mathewd how long have you been using ruby?
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
<tau> thank you guys for the insight.
<tau> i'm off now.
<matthewd> I'm not sure.. maybe 12 years?
<matthewd> No worries!
jpterry has quit [Ping timeout: 268 seconds]
lightheaded has quit [Ping timeout: 240 seconds]
lightheaded has joined #ruby
Autolycus has quit []
ace05 has quit [Read error: Connection reset by peer]
jpterry has joined #ruby
Rodya_ has joined #ruby
roamingdog has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
Rodya_ has quit [Ping timeout: 246 seconds]
flying has joined #ruby
nOwz has quit [Ping timeout: 268 seconds]
roamingdog has quit [Ping timeout: 240 seconds]
ujjain has quit [Read error: Connection reset by peer]
<fmartingr> If you've been 12 years maybe you can point me to some article or something that explain the `@` notation on class attributes, I come from python and don't quite get it... ^_^U
mikecmpbll has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
Silthias has quit [Ping timeout: 260 seconds]
ytrjkr has joined #ruby
antgel has joined #ruby
spider-mario has quit [Quit: WeeChat 1.7]
pandaant has joined #ruby
Burgestrand has joined #ruby
spider-mario has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
tau has quit [Remote host closed the connection]
<matthewd> I was going to suggest https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/to-ruby-from-python/, but it doesn't look like it really addresses instance variables
<fmartingr> Im going to put an example from a thing I did in python and how I tried to replicate it in ruby (without success). I ended up using the constructors but that was not quite what I wanted.
<fmartingr> Thank you for the links anyway, I will take a look at them later :)
enterprisey has quit [Remote host closed the connection]
mooser has joined #ruby
jsrn_ has joined #ruby
ujjain has joined #ruby
ujjain has joined #ruby
ujjain has quit [Changing host]
banisterfiend has joined #ruby
mooser has quit [Ping timeout: 264 seconds]
<matthewd> fmartingr: I think I'd do that with a nested constant
agent_white has quit [Quit: night]
dionysus69 has joined #ruby
kristofferR has quit [Quit: Textual IRC Client: www.textualapp.com]
<fmartingr> I'd give a try. I have only been using ruby for some hourse so some stuff I do may be crap ^^
kristofferR has joined #ruby
<fmartingr> I'm still getting used to some stuff about the language.
binaryplease has joined #ruby
certainty has quit [Ping timeout: 260 seconds]
bob_f has quit [Changing host]
bob_f has joined #ruby
esObe_ has joined #ruby
binaryplease1 has joined #ruby
<Burgestrand> fmartingr Don't worry, crap happens :)
maattdd has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
binaryplease has quit [Ping timeout: 264 seconds]
binaryplease1 is now known as binaryplease
govg has quit [Ping timeout: 268 seconds]
montanonic has joined #ruby
esObe__ has joined #ruby
nOwz has joined #ruby
yurikoles has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Burgestrand has quit [Ping timeout: 260 seconds]
certainty has joined #ruby
fivmo has joined #ruby
esObe_ has quit [Ping timeout: 240 seconds]
fivmo has left #ruby [#ruby]
ddffg has joined #ruby
Silthias has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
bronson has joined #ruby
hutch34 has joined #ruby
govg has joined #ruby
bronson has quit [Ping timeout: 258 seconds]
hutch34 has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
tomphp has joined #ruby
certainty has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
tau has joined #ruby
Rodya_ has joined #ruby
<ddffg> ll
<elomatreb> ls -la
ddffg has quit [Quit: Leaving]
Rodya_ has quit [Ping timeout: 246 seconds]
certainty has joined #ruby
blackmesa has joined #ruby
jenrzzz has joined #ruby
Burgestrand has joined #ruby
DaniG2k has joined #ruby
workmad3 has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jgnagy has joined #ruby
awc has joined #ruby
siovene has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 260 seconds]
ferr1 has joined #ruby
psychicist__ has joined #ruby
jgnagy has quit [Ping timeout: 240 seconds]
Kug3lis_ has joined #ruby
awc has quit [Quit: Mutter: www.mutterirc.com]
zeddan has joined #ruby
certainty has quit [Ping timeout: 256 seconds]
maattdd_ has joined #ruby
Kug3lis has quit [Ping timeout: 258 seconds]
DaniG2k has quit [Quit: leaving]
charliesome has joined #ruby
maattdd has quit [Ping timeout: 240 seconds]
stoffus has joined #ruby
govg has quit [Remote host closed the connection]
sylario has joined #ruby
zeddan has quit [Ping timeout: 258 seconds]
govg has joined #ruby
thadtheman has joined #ruby
jenrzzz has joined #ruby
ameliabot has joined #ruby
ameliabot has quit [Remote host closed the connection]
llaine has joined #ruby
thadtheman has quit [Ping timeout: 258 seconds]
ddffg has joined #ruby
montanonic has quit [Ping timeout: 258 seconds]
maattdd has joined #ruby
danielpclark has quit [Remote host closed the connection]
arquebus has joined #ruby
CloCkWeRX has joined #ruby
nobitanobi has joined #ruby
maattdd_ has quit [Ping timeout: 240 seconds]
thadtheman has joined #ruby
arquebus has quit [Quit: Leaving]
lyda has left #ruby [#ruby]
morfin has joined #ruby
<morfin> hello
<morfin> do you know ruby-build respects CC and CXX in /etc/make.conf(FreeBSD)?
jusa has quit [Ping timeout: 260 seconds]
muelleme_ has joined #ruby
jeyraof^mbpr has quit [Quit: This computer has gone to sleep]
doublemalt_ has quit [Ping timeout: 240 seconds]
CloCkWeRX has quit [Ping timeout: 258 seconds]
<darix> morfin: probably not
Rodya_ has joined #ruby
troulouliou_div2 has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
muelleme_ has quit [Ping timeout: 258 seconds]
thadtheman has quit [Ping timeout: 260 seconds]
llaine has quit [Quit: llaine]
mdw has joined #ruby
marr has joined #ruby
jaruga has joined #ruby
mdw has quit [Ping timeout: 260 seconds]
howdoi has joined #ruby
fivmo has joined #ruby
CloCkWeRX has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
certainty has joined #ruby
thadtheman has joined #ruby
hutch34 has joined #ruby
nowhere_man has quit [Ping timeout: 268 seconds]
Flonk has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
thadtheman has quit [Ping timeout: 260 seconds]
jameser has quit [Ping timeout: 260 seconds]
johnzorn has quit [Read error: Connection reset by peer]
johnzorn has joined #ruby
GodFather has joined #ruby
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
thadtheman has joined #ruby
rhyselsmore has joined #ruby
thadtheman has quit [Max SendQ exceeded]
jusa has joined #ruby
bronson has joined #ruby
Arpanet69 has joined #ruby
certainty has quit [Ping timeout: 260 seconds]
jusa has quit [Ping timeout: 260 seconds]
troulouliou_div2 has quit [Remote host closed the connection]
am55 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bronson has quit [Ping timeout: 264 seconds]
unshadow has joined #ruby
nOwz has quit [Ping timeout: 240 seconds]
ytrjkr has quit [Ping timeout: 258 seconds]
uwgiqq has joined #ruby
davorb has quit [Read error: Connection reset by peer]
davorb has joined #ruby
thadtheman has joined #ruby
rajat has joined #ruby
jameser has joined #ruby
ledestin has quit [Quit: Textual IRC Client: www.textualapp.com]
zeddan has joined #ruby
Fernando-Basso has joined #ruby
<morfin> env CC=clang38 CXX=clang++38 rbenv helped me
nobitanobi has quit [Remote host closed the connection]
nobitanobi has joined #ruby
jameser has quit [Ping timeout: 260 seconds]
johnny56_ has joined #ruby
johnny56 has quit [Ping timeout: 264 seconds]
maattdd has quit [Ping timeout: 260 seconds]
jonatin has quit [Remote host closed the connection]
zeddan has quit [Ping timeout: 240 seconds]
nobitanobi has quit [Ping timeout: 260 seconds]
jgnagy has joined #ruby
jonatin has joined #ruby
jgnagy has quit [Ping timeout: 240 seconds]
<Silthias> I've got a hash that I'd like to iterate over (.each) and then print the key,value pair out ot it, but maintaining the order of the key. using .each appears to be sorting it at the same time, is it possible to do 'neatly'?
<elomatreb> Ruby Hashes normally return their keys in the order they were inserted, it shouldn't sort anything by itself
<canton7> very old ruby versions (1.8-era?) don't keep hashes sorted by insertion order, iirc
<morfin> heh that's weird
jaruga has quit [Read error: Connection reset by peer]
<Silthias> hmm ok, this is going into an erb tempalte and puppet perhaps thats messing it up slightly
<morfin> because i expect to have unordered hashmap
jaruga has joined #ruby
<Silthias> so backtracking though, it looks like the input hash thats being used has already been sorted, hence the ordering being different from what I'd expect, cheers for the answers though
leito has quit [Ping timeout: 240 seconds]
rajat has quit [Ping timeout: 260 seconds]
thadtheman has quit [Ping timeout: 240 seconds]
nOwz has joined #ruby
jameser has joined #ruby
certainty has joined #ruby
pandaant has quit [Remote host closed the connection]
JeanCarloMachado has joined #ruby
nowhere_man has joined #ruby
leito has joined #ruby
mark_66 has quit [Read error: Connection reset by peer]
User458764 has joined #ruby
User458764 has quit [Max SendQ exceeded]
mark_66 has joined #ruby
User458764 has joined #ruby
psychicist__ has quit [Ping timeout: 256 seconds]
thadtheman has joined #ruby
thadtheman has quit [Max SendQ exceeded]
tvw has joined #ruby
hutch34 has joined #ruby
rajat has joined #ruby
Verity has joined #ruby
<Verity> key.bytes.each do |kb| msg_arr.map! {|mb| mb = mb^kb} end ---------------------- is there a better way to write this
Xeago has quit [Ping timeout: 256 seconds]
DaveTaboola has quit [Ping timeout: 240 seconds]
hutch34 has quit [Ping timeout: 260 seconds]
Rodya_ has joined #ruby
ldnunes has joined #ruby
Xeago has joined #ruby
Rodya_ has quit [Ping timeout: 268 seconds]
nobitanobi has joined #ruby
rhyselsmore has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cfec0b8d has quit [Remote host closed the connection]
cfec0b8d has joined #ruby
thadtheman has joined #ruby
<herwin> Verity: i believe ^ has the associative property, meaning (mb^k1)^k2 == mb^(k1^k2)
<herwin> in that case, you could pre-calculate the ^ of key
<herwin> and that removes the need for the outer loop
thadtheman has quit [Ping timeout: 268 seconds]
herbmillerjr has quit [Ping timeout: 240 seconds]
herbmillerjr has joined #ruby
ta_ has quit [Remote host closed the connection]
vali has quit [Remote host closed the connection]
vali has joined #ruby
doublemalt_ has joined #ruby
synthroid has joined #ruby
ahrs has quit [Read error: Connection reset by peer]
hutch34 has joined #ruby
rajat has quit [Quit: Leaving]
ahrs has joined #ruby
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
esObe__ has quit [Remote host closed the connection]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Pumukel has quit [Remote host closed the connection]
dionysus70 has quit [Ping timeout: 240 seconds]
ddffg has quit [Ping timeout: 260 seconds]
GodFather has quit [Ping timeout: 260 seconds]
leito has quit [Ping timeout: 264 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
eclecticjohny has joined #ruby
ddffg has joined #ruby
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
binaryplease has quit [Ping timeout: 240 seconds]
valentin has joined #ruby
valentin has quit [Remote host closed the connection]
jusa has joined #ruby
valentin has joined #ruby
hutch34 has quit [Ping timeout: 268 seconds]
vali has quit [Ping timeout: 256 seconds]
bronson has joined #ruby
psychicist__ has joined #ruby
aupadhye has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
valentinul has joined #ruby
jusa has quit [Ping timeout: 260 seconds]
leito has joined #ruby
valentin has quit [Ping timeout: 258 seconds]
User458764 has joined #ruby
vali has joined #ruby
bronson has quit [Ping timeout: 268 seconds]
User458764 has quit [Client Quit]
Rodya_ has joined #ruby
User458764 has joined #ruby
psychicist__ has quit [Ping timeout: 240 seconds]
zeddan has joined #ruby
Verity has quit [Ping timeout: 246 seconds]
cam27 has joined #ruby
User458764 has quit [Client Quit]
User458764 has joined #ruby
nOwz has quit [Ping timeout: 264 seconds]
duckpupp1 has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
iamayam has quit [Ping timeout: 276 seconds]
zeddan has quit [Ping timeout: 246 seconds]
nOwz has joined #ruby
nOwz has quit [Client Quit]
t-recx has joined #ruby
davorb has quit [Read error: Connection reset by peer]
cdg has joined #ruby
davorb has joined #ruby
ramortegui has joined #ruby
cdg has quit [Read error: Connection reset by peer]
pankaj has joined #ruby
last_staff has quit [Quit: last_staff]
cdg has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eclecticjohny has joined #ruby
vali has quit [Quit: vali]
chouhoulis has quit [Remote host closed the connection]
TomyWork has joined #ruby
jgnagy has joined #ruby
__Yiota has joined #ruby
jdm has quit [Remote host closed the connection]
Pumukel has joined #ruby
jgnagy has quit [Ping timeout: 246 seconds]
bmurt has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 240 seconds]
iamayam has joined #ruby
tvw has quit [Read error: Connection reset by peer]
shinnya has joined #ruby
oliv_____ has joined #ruby
Pumukel has quit [Remote host closed the connection]
millerti has joined #ruby
valentinul has quit [Remote host closed the connection]
valentinul has joined #ruby
hutch34 has joined #ruby
patarr has joined #ruby
Guest61791 is now known as silverdust
roshanavand has quit [Ping timeout: 246 seconds]
silverdust has quit [Changing host]
silverdust has joined #ruby
armyriad has quit [Ping timeout: 268 seconds]
armyriad has joined #ruby
lmc has joined #ruby
govg has quit [Ping timeout: 268 seconds]
erlend has quit [Remote host closed the connection]
jaruga has quit [Quit: jaruga]
jameser has joined #ruby
Pumukel has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
milardovich has joined #ruby
armyriad has quit [Ping timeout: 264 seconds]
nobitanobi has joined #ruby
armyriad has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
certainty has quit [Ping timeout: 240 seconds]
Rodya_ has joined #ruby
Rodya_ has quit [Ping timeout: 240 seconds]
t-recx has quit [Quit: t-recx]
joast has quit [Quit: Leaving.]
terens has quit [Remote host closed the connection]
gnufied has joined #ruby
centrx has joined #ruby
Snickers has quit [Ping timeout: 256 seconds]
davidt has joined #ruby
davidt has quit [Client Quit]
blackmesa has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
cdg_ has joined #ruby
gdonald has joined #ruby
cdg has quit [Read error: Connection reset by peer]
ddffg has quit [Quit: Leaving]
phoo1234567 has joined #ruby
joast has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
psychicist__ has joined #ruby
ivanacostarubio has joined #ruby
jdm has joined #ruby
ddffg has joined #ruby
binaryplease has joined #ruby
igniting has quit [Ping timeout: 240 seconds]
Pumukel has quit [Remote host closed the connection]
sepp2k has joined #ruby
ozcanesen has joined #ruby
unshadow has quit [Quit: leaving]
lubekpl has joined #ruby
zeddan has joined #ruby
User458764 has joined #ruby
Silthias has quit [Ping timeout: 268 seconds]
byte512 has quit [Quit: Bye.]
ferr1 has quit [Quit: WeeChat 1.7]
zeddan has quit [Ping timeout: 260 seconds]
chuff has joined #ruby
blackpajamas has joined #ruby
blackmesa has joined #ruby
Pumukel has joined #ruby
eclecticjohny has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
maloik has quit [Remote host closed the connection]
maloik has joined #ruby
yehowyada has joined #ruby
spicerack has quit [Remote host closed the connection]
bronson has joined #ruby
pankaj has quit [Remote host closed the connection]
Cohedrin has joined #ruby
Silthias has joined #ruby
lightheaded has quit [Remote host closed the connection]
lightheaded has joined #ruby
bronson has quit [Read error: Connection reset by peer]
chouhoulis has joined #ruby
bronson has joined #ruby
Rodya_ has joined #ruby
milardovich has quit [Remote host closed the connection]
tristanp has quit []
jameser has quit [Read error: Connection reset by peer]
lightheaded has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
polishdub has joined #ruby
milardovich has joined #ruby
tristanp has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
cpruitt has joined #ruby
spicerack has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
harfangk has quit [Quit: Textual IRC Client: www.textualapp.com]
__Yiota has joined #ruby
jameser has quit [Ping timeout: 260 seconds]
jameser has joined #ruby
jdm has quit [Remote host closed the connection]
mbertul has joined #ruby
fivmo has quit [Quit: Textual IRC Client: www.textualapp.com]
__Yiota has quit [Client Quit]
conta has quit [Ping timeout: 258 seconds]
haylon has joined #ruby
dionysus69 has joined #ruby
<LyndsySimon> I'm struggling this morning getting class variables and inheritance to work the way I want. Here's the syntax I want:
cam27 has quit [Quit: cam27]
jgnagy has joined #ruby
Burgestrand has quit [Quit: Closing time!]
mbertul has quit [Remote host closed the connection]
__Yiota has joined #ruby
zeddan has joined #ruby
jameser has quit [Ping timeout: 240 seconds]
zinggggg has joined #ruby
<LyndsySimon> I understand why class variables (e.g., @@members) work the way they do, and that's not what I want. I understand how class instance variables work, and that's not quite what I want either.
<LyndsySimon> Is there any way to make the syntax above work?
<elomatreb> You can achieve that behavior, but it would require doing some metaprogramming-y stuff. Not as simple as a syntax
<LyndsySimon> I'm fine with that.
mbertul has joined #ruby
__Yiota has quit [Client Quit]
pandaant has joined #ruby
jameser has joined #ruby
antoniobeyah has joined #ruby
<LyndsySimon> Well, I'm fine with doing magical stuff in `Base`, if I can make it clean in `Parent` and `Child`.
<elomatreb> I *think* that should be possible
jgnagy has quit [Ping timeout: 260 seconds]
blackmesa has quit [Ping timeout: 260 seconds]
<elomatreb> You know how you get methods to work on the class instead of on instances I assume?
bkxd has joined #ruby
<LyndsySimon> Yep.
zeddan has quit [Ping timeout: 260 seconds]
zeddan_ has joined #ruby
lightheaded has joined #ruby
jair has quit [Remote host closed the connection]
jameser has quit [Max SendQ exceeded]
bkxd has quit [Ping timeout: 260 seconds]
<elomatreb> LyndsySimon: https://eval.in/761991 -- Does this look like what you need?
jameser has joined #ruby
lightheaded has quit []
pandaant has quit [Remote host closed the connection]
<elomatreb> The interesting bit is just the inherited hook, that adds all members of the parent class to the child class
<LyndsySimon> elomatreb: Hmm... I think so. Thank you!
<LyndsySimon> I don't understand the self.inherited method yet, but I'm sure I'll figure it out shortly.
patarr_ has joined #ruby
tercenya has quit [Remote host closed the connection]
<elomatreb> When class A inherits from class B (A < B), that method will be called on B and A will be passed as an argument (other, in the example)
tercenya has joined #ruby
igniting has joined #ruby
spicerack has quit [Quit: Textual IRC Client: www.textualapp.com]
jgnagy has joined #ruby
<LyndsySimon> Huh.
<LyndsySimon> I think I'm grokking it.
gregf_ has joined #ruby
synthroid has quit [Remote host closed the connection]
<LyndsySimon> My background is predominately Python, and inheritance there is both more flexible (e.g., multiple inheritance is fine) and more structured (e.g., classes are themselves instances of a metaclass). It seems like Ruby's inheritance model is closer to that of smalltalk.
patarr has quit [Ping timeout: 264 seconds]
tercenya has quit [Client Quit]
* baweaver points at Module mixins
tercenya has joined #ruby
<elomatreb> Ruby classes are instances of the class `Class` too, we're taking advantage of that in the example with the instance variables
<LyndsySimon> baweaver: I'm very familiar with Module mixins :)
flying has quit []
brent__ has joined #ruby
brent__ has quit [Remote host closed the connection]
brent__ has joined #ruby
<LyndsySimon> elomatreb: Let me reiterate. In order to execute logic when class `A` is defined in Python, you write a class `M` and define it's `__new__` method, then explicitly set `M` to be the metaclass of `A`.
<LyndsySimon> That gets really fun when you're dealing with an inheritance hierarchy, and your metaclasses are descendants of the resultant classes' ancestors' metaclasses.
<elomatreb> I'm not familiar with Python, sorry. You can do weird stuff like that in Ruby too, having a lot of modules injected in method lookup paths sounds similar
__Yiota has joined #ruby
ResidentBiscuit has joined #ruby
tanukisofubi has joined #ruby
<LyndsySimon> It's cool. To be honest, I have a hard time talking about complex topics in two different languages at once anyhow.
tanukisofubi has quit [Client Quit]
Qchmqs has quit [Ping timeout: 240 seconds]
sofubi has joined #ruby
ta_ has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
montanonic has joined #ruby
aganov has quit [Remote host closed the connection]
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Arpanet69 has quit [Quit: Leaving]
mbertul has quit [Remote host closed the connection]
Cohedrin has joined #ruby
Cohedrin has quit [Client Quit]
[Butch] has joined #ruby
certainty has joined #ruby
yasu_ has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amclain has joined #ruby
Uranio has joined #ruby
cam27 has joined #ruby
doublemalt_ has quit [Ping timeout: 260 seconds]
User458764 has joined #ruby
certainty has quit [Ping timeout: 240 seconds]
synthroid has joined #ruby
Uranio has quit [Client Quit]
synthroi_ has joined #ruby
vimto has quit [Ping timeout: 260 seconds]
grrrkit has joined #ruby
nobitanobi has quit [Remote host closed the connection]
synthroid has quit [Ping timeout: 256 seconds]
TheMoonMaster_ is now known as TheMoonMaster
<LyndsySimon> elomatreb: Thoughts on this modification? https://eval.in/762044
<LyndsySimon> I was concerned that modifications made to the parent classes at runtime wouldn't be reflected.
Snickers has joined #ruby
marxarelli has joined #ruby
<LyndsySimon> Nevermind, I see the bug.
spicerack has joined #ruby
JeanCarloMachado has quit [Ping timeout: 256 seconds]
jsrn_ has quit [Quit: Leaving]
<elomatreb> I'm not sure how I feel about even allowing runtime modifications on something like this. I think I'd expect values defined by a class method (if they're used like member here they're often called macros) not never change
chuff has quit [Quit: Textual IRC Client: www.textualapp.com]
<elomatreb> But if you need/want, something along those lines should work
<elomatreb> If it should be dynamic we could probably leave the inherited hook completely, and just chain up until we reach Base
mark_66 has quit [Remote host closed the connection]
DLSteve has joined #ruby
haylon has quit [Quit: Leaving]
Kug3lis_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<LyndsySimon> elomatreb: Here we go: https://eval.in/762062
marcdel has quit [Ping timeout: 240 seconds]
<LyndsySimon> I don't know if it will happen in my use case - but I would feel better either accounting for it, or explicitly disallowing it.
<elomatreb> << mutates the Array, no need to assign it after </nitpick>
ozcanesen has quit [Quit: Textual IRC Client: www.textualapp.com]
<LyndsySimon> Yeah there is - `(@members || [])` could have returned an empty array.
<LyndsySimon> I guess I could have done `(@members ||= [])`...
synthroid has joined #ruby
<elomatreb> ^ that's how it's usually done, to the point where I didn't notice it wasn't ||=
* LyndsySimon nods
<LyndsySimon> OK.
hxegon has joined #ruby
roamingdog has joined #ruby
<elomatreb> One difference between the solution is that yours only allows declaring one member per method call, mine allowed any number (`member 1, 2, 3, ...`), but that was just a side effect
rmosolgo has joined #ruby
<LyndsySimon> Right. I'm adapting back and forth between my actual use case and the exemplar.
rmosolgo has left #ruby [#ruby]
spicerack has quit [Quit: Textual IRC Client: www.textualapp.com]
<LyndsySimon> In my use case, `self.member` is `self.column`, and is instantiating a class that contains information about a single column in a table of data.
montanonic has quit [Ping timeout: 260 seconds]
synthroi_ has quit [Ping timeout: 268 seconds]
jottr has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roamingdog has quit [Ping timeout: 240 seconds]
nowhere_man has quit [Ping timeout: 240 seconds]
sofubi has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
dcluna has quit [Ping timeout: 246 seconds]
yehowyada has quit [Quit: Textual IRC Client: www.textualapp.com]
gusrub has joined #ruby
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
dcluna has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
hutch34 has quit [Quit: WeeChat 1.5]
nowhere_man has joined #ruby
aufi has quit [Quit: Leaving]
pulkit4tech has joined #ruby
Rodya_ has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Pumukel has quit [Remote host closed the connection]
uwgiqq has quit [Remote host closed the connection]
McSoFake has quit []
yehowyada has joined #ruby
JeanCarloMachado has joined #ruby
raspado has joined #ruby
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
govg has joined #ruby
Xiti has joined #ruby
sofubi has joined #ruby
Pumukel has joined #ruby
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
esObe_ has joined #ruby
Pumukel has quit [Remote host closed the connection]
Pumukel has joined #ruby
djbkd has joined #ruby
zeddan_ has quit [Ping timeout: 240 seconds]
djbkd has quit [Client Quit]
jottr has quit [Ping timeout: 246 seconds]
gusrub has quit [Remote host closed the connection]
thatkid has joined #ruby
gusrub has joined #ruby
Pumukel has quit [Ping timeout: 268 seconds]
jottr has joined #ruby
andikr has quit [Remote host closed the connection]
Cohedrin has joined #ruby
enterprisey has joined #ruby
gusrub has quit [Remote host closed the connection]
gusrub has joined #ruby
agent_white has joined #ruby
pilne has joined #ruby
hxegon has quit [Quit: Lost terminal]
<agent_white> Mornin' folks
mooser has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
doublemalt_ has joined #ruby
esObe_ has quit [Remote host closed the connection]
muelleme_ has joined #ruby
<thatkid> I'm trying to write into a file inside a loop
tilaioe has joined #ruby
<tilaioe> Can I do multiple precision in ruby?
<thatkid> but the file created new version by removing the existing lines. How can I keep the old lines?
roamingdog has joined #ruby
<tilaioe> Is there something like the mpmath library or the
<tilaioe> are there some other external libraries too for the mature complex math stuff, like symbolic math, and numericals/
<tilaioe> If so I'd learn ruby, I like it, but I'd like to enquire more about the libraries beforhand
<tilaioe> Is anyone here?
<tilaioe> Lots of people are not here ?
<tilaioe> thatkid: ?hi
<havenwood> tilaioe: yup
<hanmac> thatkid: hm seems you want 'a' instead of 'w' ?
<thatkid> yup, exactly,
<thatkid> I got it, thanks
montanonic has joined #ruby
<tilaioe> havenwood: What about the other libs for math? or science stuff/
<havenwood> tilaioe: Some are in the stdlib, it's a large stdlib.
<havenwood> tilaioe: https://github.com/SciRuby
lxsameer has quit [Quit: WeeChat 1.5]
roamingdog has quit [Ping timeout: 240 seconds]
bocaneri has quit [Read error: Connection reset by peer]
<tilaioe> wow, really, I didn't expect ruby to have libs like python? Is it true then,?
<tilaioe> that it has really good libraries like the numpy,sympy,scipy in python?
antgel has quit [Ping timeout: 246 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
enterprisey has quit [Remote host closed the connection]
Renich__ has joined #ruby
<havenwood> tilaioe: :P https://github.com/rcqls/jl4rb
<havenwood> tilaioe: embed Julia in Ruby, problem solved?
Guest96 has joined #ruby
<tilaioe> No, I hate julia.
__Yiota has joined #ruby
<tilaioe> I don't even know Julia at all.
<havenwood> tilaioe: Well, Ruby doesn't have as many math and science libs as Python but it has quite a few and some surprising stuff in stdlib.
[Butch]_ has joined #ruby
Lord_of_Life has joined #ruby
Renich has quit [Ping timeout: 256 seconds]
ramortegui has quit [Quit: Ex-Chat]
[Butch] has quit [Ping timeout: 240 seconds]
[Butch]_ is now known as [Butch]
Renich__ is now known as Renich
<baweaver> "I hate X" "I don't even know X at all" - that's not a very wise way to approach things.
Renich has quit [Quit: Renich]
ramortegui has joined #ruby
byte512 has joined #ruby
renchan has quit [Quit: Leaving...]
Synthead has quit [Read error: Connection reset by peer]
mooser has quit [Remote host closed the connection]
mooser has joined #ruby
mensvaga has joined #ruby
<mensvaga> If I have a string that represents an ERB template, and I have a data structure, how do I get ERB to process the template and return the string?
SeepingN has joined #ruby
<mensvaga> It seems like there's no way to do something like this: data = {'name' => 'mensvaga'} ; template="Hello, <%= data['name'] %>!"; puts ERB.render(template, { 'data' => 'data' })
<mensvaga> I mean, I haven'
<mensvaga> I haven't tried what I just wrote; but it looks like all of the ERB examples I've found use some sort of class binding or something.
hahuang61 has joined #ruby
nofxx has joined #ruby
thatkid has quit [Quit: Page closed]
TomyWork has quit [Ping timeout: 240 seconds]
binaryplease has quit [Quit: binaryplease]
binaryplease has joined #ruby
jonjoe has joined #ruby
certainty has joined #ruby
nadir has joined #ruby
jonjoe has quit [Client Quit]
Jayson_Virissimo has joined #ruby
certainty has quit [Ping timeout: 258 seconds]
snguyen has joined #ruby
Rodya_ has quit [Remote host closed the connection]
marsjaninzmarsa has joined #ruby
renchan has joined #ruby
sofubi has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
nobitanobi has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ahrs has quit [Remote host closed the connection]
<mensvaga> Is there a way to automatically define nested structures in a hash as hashes?
<mensvaga> a = {} ; a['b']['c']='d'
<mensvaga> Instead of: a['b']={} ; a['b']['c']='d'
g0d355__ has joined #ruby
<baweaver> yep
<baweaver> auto-vivification
nobitanobi has quit [Ping timeout: 240 seconds]
<baweaver> >> vivified_hash = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }; vivified_hash[1][2][3][4][5][6][7] = 8; vivified_hash
<ruby[bot]> baweaver: # => {1=>{2=>{3=>{4=>{5=>{6=>{7=>8}}}}}}} (https://eval.in/762105)
<baweaver> &ri Hash#new
<`derpy> No results
<baweaver> &ri Hash#initialize
<`derpy> No results
cam27 has quit [Quit: cam27]
<baweaver> ...
<baweaver> &ri Hash
<baweaver> Anyways
<baweaver> Hash takes a block to new that defines the default value of an unknown key
<mensvaga> I see.
<baweaver> in this case it passes the hash and the unknown key, and you're getting the default_proc (the function you passed to Hash.new) and throwing that to a new Hash inside that one
<baweaver> trippy, no?
snguyen has quit [Quit: Textual IRC Client: www.textualapp.com]
<mensvaga> Eh; it makes sense.
<mensvaga> Thanks for showing me it.
sofubi has joined #ruby
ahrs has joined #ruby
montanonic has quit [Ping timeout: 260 seconds]
blackmesa has joined #ruby
Rodya_ has joined #ruby
dionysus69 has joined #ruby
wizard2011 has joined #ruby
centrx has quit [Remote host closed the connection]
<wizard2011> hey whats up room o
<adam12> wizard2011: o/
zeddan has joined #ruby
<wizard2011> whats up adam
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
<adam12> wizard2011: same old. what you saying?
cajone has quit [Ping timeout: 246 seconds]
Cohedrin has joined #ruby
blackmesa has quit [Ping timeout: 256 seconds]
sofubi has quit [Quit: Textual IRC Client: www.textualapp.com]
sofubi has joined #ruby
<wizard2011> @adam12 nothing just here bored just another day
<adam12> I don't think I could ever be bored. Build all the things!
zeddan has quit [Ping timeout: 240 seconds]
<wizard2011> @adam12 whats that mean "buiild all the things"?
<adam12> wizard2011: I like building things / writing code. I could probably find something to build every minute of every day.
<wizard2011> @adam12 what type of applications you build?
jusa has joined #ruby
<adam12> wizard2011: I dunno - whatever catches my fancy. Just 10 minutes ago I was humouring myself with a Geminabox-as-a-Service
workmad3 has quit [Ping timeout: 260 seconds]
User458764 has joined #ruby
ebernhardson has joined #ruby
<wizard2011> @adam12 Im not that great with coding please explain what exactly is a Geminabox?
<ebernhardson> when building a gem, is there a way to either: A) Specify the directory the build gem should be put in or B) Report the name of the gem file that was created so a script can move it to an output diretory?
<ebernhardson> i couldn't find anything relevant in the `gem build` docs
cdg_ has quit [Ping timeout: 258 seconds]
centrx has joined #ruby
centrx has quit [Changing host]
centrx has joined #ruby
<wizard2011> @adam12 whats that github link for?
<adam12> wizard2011: It answers your question about what Geminabox is.
elifoster has joined #ruby
Snickers has quit [Quit: Snickers]
<wizard2011> ok thanks adam
Snickers has joined #ruby
tomphp has joined #ruby
User458764 has quit [Quit: Textual IRC Client: www.textualapp.com]
Snickers has quit [Client Quit]
AgentVenom has joined #ruby
TomyLobo2 has joined #ruby
User458764 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has quit [Client Quit]
montanonic has joined #ruby
cajone has joined #ruby
marxarelli is now known as marxarelli|afk
Renich has joined #ruby
tilaioe has left #ruby ["WeeChat 1.7"]
JeanCarloMachado has quit [Ping timeout: 240 seconds]
<adaedra> &ri Hash.new baweaver
sofubi has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
ebernhardson has left #ruby [#ruby]
aupadhye has quit [Ping timeout: 240 seconds]
psychicist__ has quit [Ping timeout: 258 seconds]
zeddan has joined #ruby
pandaant has joined #ruby
tvw has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<wizard2011> @adam12 so this geminabox is a server , whats being hosted from it?
leito has quit [Read error: No route to host]
bmurt has joined #ruby
rippa has joined #ruby
zeddan has quit [Ping timeout: 260 seconds]
<wizard2011> whos in here with me that can help me with coding
morfin has quit []
BSaboia has joined #ruby
gusrub has quit [Remote host closed the connection]
lmc has quit [Read error: Connection reset by peer]
s2013 has joined #ruby
lmc has joined #ruby
tomphp has joined #ruby
<Jayson_Virissimo> wizard2011: It's usually better to just ask a question, and if someone has something relevant to say, they'll respond. Otherwise it sounds like you are asking someone to agree to help without them even knowing what they are going to help with and what kind of time commitment that would entail.
dionysus69 has quit [Ping timeout: 260 seconds]
aupadhye has joined #ruby
thadtheman has joined #ruby
Arpanet69 has joined #ruby
Pumukel has joined #ruby
jusa has quit [Ping timeout: 240 seconds]
leito has joined #ruby
<havenwood> wizard2011: What's your Ruby question? Ask away!
j0n3 has joined #ruby
davorb has quit [Read error: Connection reset by peer]
<wizard2011> @Jayson_Virissimo thanks thats very true I didnt really think about it like that
aupadhye has quit [Ping timeout: 260 seconds]
gchristensen has joined #ruby
davorb has joined #ruby
blackmesa has joined #ruby
Jackneill has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
cagomez has joined #ruby
<gchristensen> Hi, how do I control how pry pretty-prints objects? I have a few special objects that pretty-print very nicely, and I can't for the life of me figure out how.
skord has joined #ruby
cam27 has joined #ruby
tenderlove has quit [Read error: Connection reset by peer]
tenderlove has joined #ruby
fmartingr has quit [Quit: Connection closed for inactivity]
oliv_____ has quit [Remote host closed the connection]
mooser has quit [Remote host closed the connection]
ozcanesen has joined #ruby
blackmesa has quit [Ping timeout: 246 seconds]
olivi____ has joined #ruby
raspado has quit [Quit: Leaving...]
valentinul has quit [Ping timeout: 258 seconds]
<hanmac> gchristensen: i found this methods in Object which seems to control that:
<hanmac> >> require "pp"; Object.instance_methods.grep(/pretty/)
<ruby[bot]> hanmac: # => [:pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :prett ...check link for more (https://eval.in/762122)
aupadhye has joined #ruby
HoierM has joined #ruby
mooser has joined #ruby
JeanCarloMachado has joined #ruby
Lord_of_Life has quit [Excess Flood]
<gchristensen> hanmac: hrmm bizarre. I don't have any of those :/ I'll dig around for related looking things.
Lord_of_Life has joined #ruby
username1 has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wizard2011 has quit [Quit: Leaving]
<hanmac> gchristensen: did you require pp yet? this functions only appear after requiring pp
Arpanet69 has quit [Ping timeout: 260 seconds]
Xiti has quit [Quit: Xiti]
dionysus69 has joined #ruby
Heero has quit [Ping timeout: 255 seconds]
cagomez has quit []
Heero_ has joined #ruby
RushPL has quit [Ping timeout: 255 seconds]
leito has quit [Ping timeout: 258 seconds]
cagomez has joined #ruby
RushPL has joined #ruby
<gchristensen> ah, sorry, so I do have them but they're not formatted how I'd expect
heftig has quit [Ping timeout: 255 seconds]
<gchristensen> they're returning regular strings whereas the formatting from pry is colored in elaborate ways
jwheare has quit [Ping timeout: 254 seconds]
heftig has joined #ruby
<baweaver> adaedra: derp. Monday hits hard.
Miah_ has quit [Ping timeout: 255 seconds]
Miah_ has joined #ruby
jwheare has joined #ruby
renchan has quit [Remote host closed the connection]
duckpupp1 has quit [Ping timeout: 240 seconds]
yehowyada has quit [Quit: Textual IRC Client: www.textualapp.com]
montanonic has quit [Ping timeout: 240 seconds]
gusrub has joined #ruby
gchristensen has left #ruby ["WeeChat 0.4.2"]
sirecote has quit [Ping timeout: 255 seconds]
postmodern has joined #ruby
sirecote has joined #ruby
gdonald has quit [Read error: Connection reset by peer]
manveru has quit [Ping timeout: 255 seconds]
gdonald has joined #ruby
leito has joined #ruby
peteretep has quit [Ping timeout: 255 seconds]
manveru has joined #ruby
Verity has joined #ruby
peteretep has joined #ruby
<Verity> https://github.com/postmodern/digest-crc could someone help me out?
Rush has quit [Ping timeout: 255 seconds]
<Verity> under defining your own CRC class
<Verity> the method we used in school had a generator polynomial
Rush has joined #ruby
<Verity> and didnt use a table
ResidentBiscuit has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
username1 has quit [Ping timeout: 240 seconds]
Suslov has joined #ruby
<Verity> how can I derive my own CRC class from digest-crc that will generate the proper 8 bit crc (using the same generator poly)
<Verity> if I dont use the same, my crcs wont match those of the other students
skord has quit [Quit: skord]
marxarelli|afk is now known as marxarelli
milardovich has quit [Remote host closed the connection]
blackmesa has joined #ruby
sjums_ has joined #ruby
milardovich has joined #ruby
<postmodern> Verity, inherit from CRC8 and override the update method
<postmodern> Verity, update(data) must process a String, updating @crc accordingly, and return self, anything else in there is up to you
<Verity> can you tell me what part of that is the generator polynomial
sjums has quit [Remote host closed the connection]
<Verity> I have one, ie 0x156
<Verity> line 54
tolerablyjake has joined #ruby
<Verity> 0xFF?
milardovich has quit [Remote host closed the connection]
<Verity> that cant be right
<Verity> or can it
ekinmur has joined #ruby
milardovich has joined #ruby
<Verity> mine has a 1 for "the carry"
chrisgopher has joined #ruby
<Verity> having trouble understanding all of this
pandaant has quit [Remote host closed the connection]
AndBobsYourUncle has joined #ruby
<postmodern> Verity, & 0xff isolates the lower 8 bits (aka byte)
montanonic has joined #ruby
HalcyonicStorm has quit [Ping timeout: 255 seconds]
zeddan has joined #ruby
moogumbo has quit [Ping timeout: 255 seconds]
zzak has quit [Ping timeout: 255 seconds]
HalcyonicStorm has joined #ruby
zzak has joined #ruby
workmad3 has joined #ruby
wsmoak has quit [Ping timeout: 255 seconds]
moogumbo has joined #ruby
rprimus has quit [Ping timeout: 255 seconds]
rprimus has joined #ruby
ggherdov has quit [Ping timeout: 255 seconds]
rprimus is now known as Guest18348
synthroid has quit []
mrsolo has quit [Ping timeout: 255 seconds]
wsmoak has joined #ruby
<Verity> postmodern, and the "generator polynomial" ?
bcavileer has quit [Ping timeout: 255 seconds]
avdi has quit [Ping timeout: 255 seconds]
mrsolo has joined #ruby
avdi has joined #ruby
centrx has quit []
certainty has joined #ruby
bcavileer has joined #ruby
centrx has joined #ruby
ggherdov has joined #ruby
<postmodern> Verity, read up on enumerators. each_byte iterates over each byte. you can do each_byte.each_with_index { |b,i| ... } to get the index (starting at 0) of each byte
<postmodern> Verity, you'll need to convert the polynomial equation into an iterative or inductive one
mooser has quit []
<allisio> That can just be #with_index these days, for reference.
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Rodya_ has quit [Remote host closed the connection]
<Verity> thats I needed
<postmodern> oh much easier to read +1
milardovich has quit [Remote host closed the connection]
<Verity> oh
<Verity> a char has an index
workmad3 has quit [Ping timeout: 246 seconds]
hahuang61 has quit [Quit: WeeChat 1.7]
certainty has quit [Ping timeout: 258 seconds]
<Verity> nvm
patarr_ has quit [Ping timeout: 260 seconds]
<postmodern> Verity, also remember chars don't always equal bytes, aka UTF-8 and UTF-16 you can have multi-byte chars
maattdd has joined #ruby
<Verity> for me they will be bytes, luckily
<Verity> I think>?
<Verity> for this protocol we will be using ascii only
thadtheman has quit [Ping timeout: 240 seconds]
cagomez has quit [Remote host closed the connection]
ekinmur has quit [Quit: Textual IRC Client: www.textualapp.com]
<postmodern> Verity, most each_* methods will return an Enumerator if you don't give it a block (ex: each_byte.with_index { |b,i| ... }) http://www.rubydoc.info/stdlib/core/Enumerator
cagomez has joined #ruby
gusrub has quit [Remote host closed the connection]
<Verity> I don't understand enumerators and map
<Verity> =\
<Verity> I'm using htem, but not fully understanding
<Verity> I'm using irb for guess + check sometimes
<Verity> not good.
<Verity> when I get the result I needed, I've found my code
<Verity> or perhaps thats how its intended
Lord_of_Life has quit [Excess Flood]
nobitanobi has joined #ruby
hahuang65 has quit [Quit: WeeChat 1.7]
cagomez has quit [Remote host closed the connection]
lxsameer has joined #ruby
cagomez has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
<postmodern> Verity, also i'd ignore the polynomial part of that video. focus on implementing the algorithm using xor (^) and shift (<< >>) operators
hahuang65 has joined #ruby
<Verity> well I have a generator polynomial from my professor
<Verity> in the form of 0x156 (hex)
<Verity> and the 1 is "the carry"
<Verity> but I'm afraid I don't understand
milardovich has joined #ruby
<Verity> he said I could just copy paste his C++ code if I can call it in ruby
nobitanobi has quit [Remote host closed the connection]
<Verity> but I'd rather understand this algorithm and how to implement it in ruby
nobitanobi has joined #ruby
Lord_of_Life has joined #ruby
Lord_of_Life has quit [Excess Flood]
patarr has joined #ruby
<matthewd> It may be more pedagogically expedient to implement as a stand-alone class, without digest-crc as a base
<matthewd> Both because you can then start with a 1-to-1 translation of the C++ code, and because it's your first ruby class
GodFather has joined #ruby
cdg has joined #ruby
nobitanobi has quit [Remote host closed the connection]
<Verity> alright
milardovich has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
<Verity> then it may not be possible to easily change the generator polynomial in the derived digest-crc8 class
<Verity> ?
cagomez has joined #ruby
username1 has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
<postmodern> Verity, i think matthewd means, it would be simpler to just focus on the algorithm first, and not worry about fitting it into digest-crc's API
g0d355__ has quit [Remote host closed the connection]
chouhoulis has quit []
__Yiota has quit [Quit: Textual IRC Client: www.textualapp.com]
cagomez has quit [Remote host closed the connection]
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
cagomez has joined #ruby
milardovich has joined #ruby
fearoffish has joined #ruby
fearoffish has left #ruby [#ruby]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby
cagomez has quit [Remote host closed the connection]
bkxd has joined #ruby
blackmesa has joined #ruby
milardovich has quit [Remote host closed the connection]
ineb has joined #ruby
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
cagomez has joined #ruby
Rodya_ has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
milardovich has joined #ruby
cam27 has quit [Quit: cam27]
blackmesa has quit [Ping timeout: 264 seconds]
centrx has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
milardovich has quit [Ping timeout: 246 seconds]
Rodya__ has joined #ruby
Rodya_ has quit [Ping timeout: 246 seconds]
thadtheman has joined #ruby
yurikoles has quit [Remote host closed the connection]
centrx has joined #ruby
centrx has joined #ruby
centrx has quit [Changing host]
brent__ has quit [Remote host closed the connection]
Arpanet69 has joined #ruby
j0n3 has quit [Quit: Leaving]
sagax has joined #ruby
centrx has quit [Remote host closed the connection]
centrx has joined #ruby
marxarelli is now known as marxarelli|afk
webopsx has joined #ruby
brent__ has joined #ruby
dar123 has joined #ruby
thadtheman has quit [Ping timeout: 258 seconds]
webopsx has quit [Ping timeout: 268 seconds]
bmurt has joined #ruby
kies has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Ping timeout: 256 seconds]
pulkit4tech has quit [Quit: Connection closed for inactivity]
centrx has quit [Remote host closed the connection]
centrx has joined #ruby
gloscombe has joined #ruby
marxarelli|afk is now known as marxarelli
gusrub has joined #ruby
thadtheman has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
davorb has quit [Read error: Connection reset by peer]
davorb has joined #ruby
Pumukel has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
gusrub has quit [Remote host closed the connection]
rhyselsmore has joined #ruby
thadtheman has quit [Ping timeout: 240 seconds]
willardg has joined #ruby
tvw has quit []
renatosilva has joined #ruby
enterprisey has joined #ruby
esObe_ has joined #ruby
kies has joined #ruby
ghoti has quit [Ping timeout: 264 seconds]
ghoti has joined #ruby
<Verity> >> "hello".each_byte.map {|b| puts << b.to_s(2).rjust(8, "0")}
<ruby[bot]> Verity: # => ...check link for more (https://eval.in/762176)
Suslov has quit [Remote host closed the connection]
<Verity> >> bit_array = []; "hello".each_byte.map {|b| bit_array << b.to_s(2).rjust(8, "0")}
<ruby[bot]> Verity: # => [["01101000", "01100101", "01101100", "01101100", "01101111"], ["01101000", "01100101", "01101100", ...check link for more (https://eval.in/762177)
<Verity> huh???
Suslov has joined #ruby
esObe__ has joined #ruby
willardg has left #ruby ["Textual IRC Client: www.textualapp.com"]
jobewan has joined #ruby
<Verity> >> bit_array = ""; "hello".each_byte.map {|b| bit_array << b.to_s(2).rjust(8, "0")}
<ruby[bot]> Verity: # => ["0110100001100101011011000110110001101111", "0110100001100101011011000110110001101111", "0110100001 ...check link for more (https://eval.in/762178)
<Verity> why it it putting all into each one
Suslov has quit [Remote host closed the connection]
Suslov has joined #ruby
ldnunes has quit [Quit: Leaving]
<havenwood> Verity: bit_array.class #=> String
<havenwood> Verity: String#<<
esObe_ has quit [Ping timeout: 240 seconds]
<havenwood> Verity: Note the different output if: bit_array = []
<allisio> Verity: `b.to_s(2).rjust(8, "0")` should just be `'%08b' % b`.
<Verity> I'm not sure what that is or how to use it, and I can't find any reference to it with a google search
<Jayson_Virissimo> Why is it called bit_array, when it is a string?
<Verity> turning it into an array comes next
<Verity> or maybe not
<Verity> I need to access all of the bits of a msg to run a crc calculation on it
<Verity> I really don't know the best way
<Verity> this doesnt seem like a common ruby task so examples are sparse
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<allisio> The answer is String#unpack.
<allisio> >> 'Verity'.unpack 'B*'
<ruby[bot]> allisio: # => ["010101100110010101110010011010010111010001111001"] (https://eval.in/762189)
choke has joined #ruby
<Verity> oh.
<matthewd> I doubt it
hahuang65 has quit [Read error: Connection reset by peer]
polishdub has quit [Quit: Leaving]
<matthewd> Those all end up with 1 and 0 characters, which isn't what your function's going to need
<Verity> I'm supposed to shift bits into an 8 bit register and then when the first 1 bit goes into the "carry" to the left of this register, I xor the register with the generator polynomial, then I need to do this for all msg
Arpanet69 has quit [Ping timeout: 268 seconds]
<Verity> in C I would need to use a mask to get at the bits
<matthewd> You have a C++ implementation, right? Just translate that directly.
<Verity> yeah he showed me the exact code today
<Verity> and said I could use it, even
<Verity> but its probably better to reimplement than to create a C lib and call it
ramortegui has quit [Quit: Ex-Chat]
hahuang65 has joined #ruby
<Verity> I also doubted if I could do it
<Verity> as ruby would be so different than how its done in C, I would think
<allisio> In Ruby, you can index into an Integer to get its bits.
<Verity> my first step is probably to convert the entire message into an actual array of bits
<Verity> I'll try that now
<Verity> I think I was almost there
<Verity> it must be easy, actually
<Verity> >> "hello".unpack('B*').to_a
<ruby[bot]> Verity: # => ["0110100001100101011011000110110001101111"] (https://eval.in/762190)
<Verity> =S
<allisio> You're not learning at all. :<
* havenwood gives a shoutout to Ruby 2.4's String#unpack1
gusrub has joined #ruby
<Verity> I wouldn't say I'm "not learning at all"
<Verity> I'm just as caught up as anyone else
<Verity> aside from the crc issue
<Verity> which they didnt have to learn a new language for
enterprisey has quit [Ping timeout: 240 seconds]
<Verity> just a small obstacle I will overcome
linoespinoza has joined #ruby
<Verity> we already did the crc in a previous lab
<matthewd> Verity: allisio didn't say you weren't progressing through the problem
enterprisey has joined #ruby
Pumukel has quit [Ping timeout: 240 seconds]
<Verity> right, he said I "wasn't learning at all". Simply not a true statement
<Verity> I could write a multitude of simple ruby programs now
<Verity> I couldn't a few days ago
<Verity> I've learned something.
cagomez has joined #ruby
<Verity> It just doesnt come as easily to me as some, no need to insult
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
tercenya has quit [Remote host closed the connection]
tercenya has joined #ruby
<allisio> havenwood: We Erlang yet?
<Verity> oh it already is an array, why is it in quotes
<Verity> thats confusing
<Verity> with no []
<allisio> &ri String#unpack
<Verity> I would have expected to see [0,1,1,0] etc
<allisio> Why?
cagomez has quit [Ping timeout: 260 seconds]
<Verity> thats how I'm used to seeing an array of numbers
<allisio> It's not an array of numbers.
<Verity> NoMethodError: undefined method `bytes' for ["01100001"]:Array
<Verity> that was why I thought that
gdonald has quit [Read error: Connection reset by peer]
gdonald has joined #ruby
willardg has joined #ruby
Jayson_Virissimo has quit []
willardg has left #ruby [#ruby]
AgentVenom has quit [Quit: Textual IRC Client: www.textualapp.com]
aupadhye has quit [Ping timeout: 240 seconds]
cagomez has joined #ruby
cagomez_ has joined #ruby
certainty has joined #ruby
Suslov has quit [Quit: Leaving...]
cagomez has quit [Ping timeout: 240 seconds]
<Verity> >> "a".unpack('B*').each {|b| bit_array << b}
<ruby[bot]> Verity: # => undefined local variable or method `bit_array' for main:Object (NameError) ...check link for more (https://eval.in/762200)
<Verity> why is this so difficult
dar123 has quit [Read error: Network is unreachable]
cagomez_ has quit [Ping timeout: 260 seconds]
<baweaver> where are you defining bit array?
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Verity> bit_array = [] line before
certainty has quit [Ping timeout: 246 seconds]
<baweaver> might that be why it's not working there?
<baweaver> Error messages are quite informative.
<allisio> Error: computers aren't magic.
<Verity> >> i = 0; "a".unpack('B*').each do |bit| bit_array[i] = bit; i+=1; end
<ruby[bot]> Verity: # => undefined local variable or method `bit_array' for main:Object (NameError) ...check link for more (https://eval.in/762201)
<Verity> >> bit_array = []; i = 0; "a".unpack('B*').each do |bit| bit_array[i] = bit; i+=1; end
<ruby[bot]> Verity: # => ["01100001"] (https://eval.in/762202)
hahuang65 has quit [Quit: WeeChat 1.7]
hahuang65 has joined #ruby
<matthewd> Verity: What does the C++ code look like?
br0d1n has joined #ruby
<Verity> I'll have to go get it
<Verity> It's quite different than what I would expect the ruby code to be
<Verity> what is going on here!!!!
<Verity> >> bit_array = "a".unpack('B*').to_a; bit_array.class; bit_array[1];
<ruby[bot]> Verity: # => nil (https://eval.in/762203)
<Verity> nil!?!
<allisio> Please stop.
<Verity> => ["01100001"]
<Verity> how is that nil
<Verity> allisio you're just trolling again
<Verity> especially if you know what the problem is
<Verity> its not helpful the last several things you've said to me
centrx has quit []
<Verity> they serve only to feed your own sadistic pleasures
<allisio> Calm down.
<allisio> And use your local REPL.
<Verity> I am
<Verity> I could send the log of it
<Verity> its not pretty
<allisio> Your signal-to-noise ratio is through the floor, man.
<Verity> it's not
<Verity> I stand by my statement
<Verity> the trolling continues
dar123 has joined #ruby
<Verity> use my local REPL? As if I haven't tried 100s of variations
<Verity> nothing is resulting in the array I require
<allisio> Who are you blaming?
nobitanobi has joined #ruby
hahuang65 has quit [Quit: WeeChat 1.7]
hahuang65 has joined #ruby
<Verity> I'm blaming you for your trolling. For my difficulties figuring this out I blame God, the system, and myself
<allisio> In that order?
<Verity> for example, your last 4 messages have had nothing to do with my question about it claiming to be an array but not containing the data I would expect
<Verity> and yes, that order
cam27 has joined #ruby
Arvik_ has joined #ruby
<allisio> You're deliberately failing to recall that I pointed you at precisely the documentation you'd need to read in order to solve the problem God has burdened you with on this blessed day.
<allisio> Let's try that again.
<allisio> &ri String#unpack
nobitanobi has quit [Ping timeout: 240 seconds]
lubekpl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Verity> irb(main):033:0> "a".unpack('B*').class
<Verity> => Array ???
<Verity> string or array, which is it
<Verity> I cant .split I just found on stack exchange
<Verity> because it says its an array
<Verity> but I also cant access its elements
<allisio> It's not lying to you.
<Verity> >> ary = "a".unpack('B*').class
<Verity> => Array; ary[1]
<ruby[bot]> Verity: # => Array (https://eval.in/762204)
<Verity> a = 01100001
<Verity> [1] shold be 1, not nil
<allisio> Okay.
<allisio> File a bug report.
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikecmpbll has joined #ruby
<havenwood> Verity: [Array][1] #=> ?
<havenwood> Verity: You're setting `ary` to `Array` above.
<Verity> oh right, that was just a typo
<Verity> "a".unpack('B*').each {|bit| printf("Bit:%d | Type:%s", bit, bit.class)}
<Verity> this was my latest attempt, just now
<Verity> let me make sure I wasnt somehow setting it to 'Array'
<Verity> Bit:294913 | Type:String=> ["01100001"]
bkxd has joined #ruby
<Verity> havenwood, it says array
<Verity> thats the real point here
<Verity> and its not
<Verity> its not an array
<Verity> of if it is, its an array of 1 string
gloscombe has quit [Quit: gloscombe]
<Verity> and what would the point of that be
<havenwood> Verity: it's an Array with one String
<Verity> >> "a".unpack('B*')[0].split("")
<ruby[bot]> Verity: # => ["0", "1", "1", "0", "0", "0", "0", "1"] (https://eval.in/762205)
<matthewd> The point would be that this is not the right approach, as I said an hour ago.
milardovich has joined #ruby
<Verity> how is it not? I just finally got it
<Verity> it was a nightmare
<Verity> and devastated my psyche, but I'm here there
<Verity> there now*
<allisio> String#unpack returns an Array because you can specify that you want to unpack more than one datum.
<allisio> >> 'ab'.unpack 'CC'
<ruby[bot]> allisio: # => [97, 98] (https://eval.in/762206)
<Verity> you mean unpack each character as a different type?
<allisio> #unpack can do all sorts of things, but sure, that's one potential use case.
<ivanacostarubio> topic softwarecriollo ⚡️💻
bkxd has quit [Ping timeout: 240 seconds]
willardg has joined #ruby
ivanacostarubio has left #ruby [#ruby]
<havenwood> Verity: A good place to start is showing example input values and the corresponding desired output values.
<allisio> matthewd: What's wrong with `unpack1('B*').chars.map &:to_i`?
<baweaver> the 1
<allisio> It's 2017.
* baweaver ducks
<eam> ruby needs vec()
CloCkWeRX has quit [Ping timeout: 256 seconds]
marxarelli is now known as marxarelli|afk
<Verity> why is that any better than bit_array = "a".unpack('B*')[0].split("")
<matthewd> allisio: As I still haven't seen the code it's going to get fed into, I remain dubious that an array of bits (and especially one in that order) is what's actually needed
<Verity> I could reverse the order no problem now
<allisio> matthewd: Yeah, fair enough.
<Verity> I need an array of bits
<allisio> Does your approach give you an array of bits?
<Verity> let me take a look
<havenwood> Verity: We can give you random Arrays of bits all day long. Do you have example input values and corresponding output values for your spec?
<Verity> havenwood, no
linoespinoza has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Verity> I'll need to shift the bits into an 8 bit register next
<havenwood> Verity: Then we can't help you unless random bits suffice.
<Verity> and then to the left of that is a carry bit, when it goes 1 I xor the register with the polynomial
<Verity> 0x156
<baweaver> ?xy
<ruby[bot]> 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
<havenwood> Verity: Like `"hi" => ["0110", "0110"]` or `"bye" => ["0110", "0111", "0110"]`. A gist is ideal if it's complex enough to warrant multiple examples.
willardg has quit [Quit: Textual IRC Client: www.textualapp.com]
<havenwood> Verity: You can update a gist to perfect your query.
jottr has quit [Ping timeout: 260 seconds]
<havenwood> Verity: It's easy that way for folk dropping by the channel to look at your best effort at giving realistic data and requirements.
<havenwood> Verity: gist.github.com
<Verity> well that would have been, "hello" => [0, 1, 1, 0, 0, 0, 0, 1]
esObe__ has quit [Ping timeout: 268 seconds]
<Verity> I just realized I'm still not quite there, I have an array of strings of length 1!!!!
<havenwood> Verity: Are you sure?
<havenwood> >.>
phoo1234567 has quit [Quit: Gotta go]
User458764 has joined #ruby
<Verity> yes
<Verity> no
lmc has quit [Read error: Connection reset by peer]
<Verity> "a" => [0, 1, 1, 0, 0, 0, 0, 1]
<Verity> there
lmc has joined #ruby
<Verity> "a".ord is the number I need to convert to a binary array, thats when the doc stopped helping
Pumukel has joined #ruby
<havenwood> >> 'a'.ord.to_s(2).each_char.map(&:to_i)
<ruby[bot]> havenwood: # => [1, 1, 0, 0, 0, 0, 1] (https://eval.in/762207)
<havenwood> ah MSB
<Verity> plus I need to add the padding
<allisio> 18>> ('%08b' % ?a).bytes.map { |b| b - 48 }
<ruby[bot]> allisio: # => [0, 1, 1, 0, 0, 0, 0, 1] (https://eval.in/762208)
<havenwood> Verity: So give us real examples of what you want, in a Gist.
<havenwood> Verity: https://gist.github.com/
<allisio> Verity: https://gist.github.com/
<havenwood> Verity: Maybe preparing examples will help you with clarity around the problem domain.
zeddan has quit [Ping timeout: 240 seconds]
<Verity> I'll try to understand allisio solution to it
<havenwood> Verity: What version of Ruby?
<Verity> current
muelleme_ has quit [Ping timeout: 258 seconds]
<havenwood> Verity: 'a'.unpack1('B*').each_char.map(&:to_i)
dar123 has joined #ruby
<allisio> I'm trying to make sense of your preference for #each_char.
Bob8989|2 has joined #ruby
<Verity> why is it b-48 and wha os 18>>
<allisio> Don't take the bait.
<Verity> also % and ?a ---? hard code to understand
<Verity> how could I ever have put that together from the docs
<havenwood> allisio: The intermediary Enumerator seems preferable to the intermediary Array.
<Verity> I dont even understand it looking at it
<Verity> I google "ruby %" and guess what comes up
Guest96 has quit [Remote host closed the connection]
<Verity> a hopless approach
<Verity> e
<nofxx> Verity, isn't pack/unpack better for that kinda of bit stuff
<havenwood> allisio: Since `str.chars` is shorthand for `str.each_char.to_a`, there's no reason to have the `.to_a` when you're about to map to an Array.
<Verity> nofxx, yeah I'm using unpack
<Verity> it just doesnt unpack to an array of ints
olivi____ has quit [Remote host closed the connection]
<nofxx> Verity, doesn't make a sense, 1 bit can be at most a boolean, it's up to you to group'em
olivi____ has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Guest96 has joined #ruby
xnxq has joined #ruby
<nofxx> Verity, eg the numbers you provide to unpack.... check the docs, don't remember...
dar123 has quit [Read error: Connection reset by peer]
<allisio> havenwood: Yeah, makes sense.
charliesome has joined #ruby
esObe_ has joined #ruby
chrisgopher has quit [Remote host closed the connection]
lmc has quit [Remote host closed the connection]
blackmesa has joined #ruby
am55 has joined #ruby
cam27 has quit [Read error: Connection reset by peer]
Pumukel has quit [Read error: Connection reset by peer]
ddffg has quit [Quit: Leaving]
Pumukel has joined #ruby
cam27 has joined #ruby
jusa has joined #ruby
elifoster has quit [Ping timeout: 240 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Verity> >> bit_array = []; 'a'.unpack('B*')[0].each_char {|bit| bit_array += bit.to_i}
<ruby[bot]> Verity: # => no implicit conversion of Fixnum into Array (TypeError) ...check link for more (https://eval.in/762210)
jobewan has quit [Ping timeout: 240 seconds]
<Verity> <havenwood> Verity: 'a'.unpack1('B*').each_char.map(&:to_i) gives me errr
<havenwood> Verity: What's the error?
<havenwood> Verity: (Latest stable Ruby is 2.4.1.)
<Verity> NoMethodError: undefined method `unpack1' for "a":String
<Verity> I'm on 2.3
jusa has quit [Ping timeout: 246 seconds]
<havenwood> Verity: So the method doesn't exist yet.
<Verity> why didnt my method work
<allisio> You tried to add a Fixnum to an Array.
<Verity> is that not what goes into an arrya
davorb has quit [Read error: Connection reset by peer]
davorb has joined #ruby
Pumukel has quit [Ping timeout: 240 seconds]
xnxq has quit [Quit: WeeChat 1.7]
elifoster has joined #ruby
xnxq has joined #ruby
<Verity> is that not what goes into an array
olivi____ has quit [Remote host closed the connection]
enterprisey has quit [Remote host closed the connection]
marxarelli|afk is now known as marxarelli
<SeepingN> not that way
oliv_____ has joined #ruby
<havenwood> Verity: See the docs: https://ruby-doc.org/core/Array.html#method-i-2B
jamesaxl has quit [Quit: Leaving]
choke has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
esObe_ has quit [Remote host closed the connection]
esObe_ has joined #ruby
Fernando-Basso has quit [Quit: WeeChat 1.5]
choke has joined #ruby
esObe_ has quit [Remote host closed the connection]
choke has quit [Client Quit]
oliv_____ has quit [Ping timeout: 240 seconds]
be_______ has joined #ruby
czerasz has joined #ruby
czerasz has quit [Read error: Connection reset by peer]
czerasz has joined #ruby
choke has joined #ruby
renatosilva has quit [Quit: http://renatosilva.net]
roamingdog has joined #ruby
bkxd has joined #ruby
choke has quit [Client Quit]
<havenwood> >> [] << 'Verity'
<ruby[bot]> havenwood: # => ["Verity"] (https://eval.in/762231)
cdg has quit [Remote host closed the connection]
<Verity> >> 'a'.unpack('B*')[0].split("").map{|bit| puts bit}
<ruby[bot]> Verity: # => 0 ...check link for more (https://eval.in/762234)
chrisgopher has joined #ruby
grillon has quit [Quit: Connection closed for inactivity]
<Verity> I'm not quite sure why this isnt working
<Verity> tried a new operator
<Verity> >> bit_array = []; 'a'.unpack('B*')[0].split("").map{|bit| bit_array += bit.to_i}
<ruby[bot]> Verity: # => no implicit conversion of Fixnum into Array (TypeError) ...check link for more (https://eval.in/762238)
<havenwood> Verity: Did you look at the Array#+ docs I linked above?
<havenwood> Verity: What argument does that method expect?
bkxd has quit [Ping timeout: 260 seconds]
<Verity> yes but I never know which part to read
<Verity> or am I suppose dto just read it all, and then how do I know which part I need to use
<havenwood> Verity: "Returns a new array built by concatenating the two arrays together to produce a third array."
<Verity> oh
<havenwood> Verity: So the method you chose to use, Array#+, adds two Arrays together.
Bob8989|2 has quit [Quit: KVIrc 4.0.4 Insomnia http://www.kvirc.net/]
rakm has joined #ruby
<Verity> >> bit_array = []; 'a'.unpack('B*')[0].split("").map{|bit| bit_array.insert(-1, bit.to_i)}
<ruby[bot]> Verity: # => [[0, 1, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 0, 1], [0, 1, 1, 0, 0, 0, 0, ...check link for more (https://eval.in/762239)
<Verity> I'm close
<Verity> its an array of arrays though
<Verity> naybe thats not so bad
<Verity> wait no
<Verity> this is all wrong
<Verity> its the SAME array repeatedly
<Verity> where did I go wrong?
choke has joined #ruby
<matthewd> Can we please see the code this is going to be fed into? Please?
<Verity> it doesnt exist yet, I need to write it
<Verity> let me type up the c++ code and I'll send that
<Verity> give me a bit
IRCFrEAK has joined #ruby
IRCFrEAK has quit [K-Lined]
<Verity> all I know is that I need to calculate the crc using ruby or a ruby gem. It really doesnt matter which. The most important part is that the generator polynomial has to match
<Verity> or my program will have crc errors when it communicates with the others
choke has quit [Client Quit]
<ytti_> standard library has crc32
thadtheman has joined #ruby
<Verity> ytti_, I need to use 8 bit w/ custom generator polynomial
<Verity> believe me if I could do that I would. I'd rather learn ruby writing my state machine and processing bytes
<Verity> not working with all of the bits and struggling like this
<matthewd> Verity: My concern is that until we know how the processing function is implemented, it's dangerous to fuss over the exact format of the intermediate data.. otherwise you're going to spend hours on getting one particular array format, then potentially find the function is better implemented with some other arrangement
choke has joined #ruby
dar123 has joined #ruby
chouhoulis has quit [Ping timeout: 264 seconds]
xnxq has quit [Quit: WeeChat 1.7]
xnxq has joined #ruby
thadtheman has quit [Ping timeout: 240 seconds]
gnufied has quit [Ping timeout: 246 seconds]
choke has quit [Client Quit]
<Verity> is there a generator polynomial in there?
<Verity> my algorithm has no table
ozcanesen has quit [Quit: Textual IRC Client: www.textualapp.com]
roamingdog has quit [Ping timeout: 240 seconds]
<matthewd> I don't know, but assume it's used to generate the table
<allisio> Verity: Line 54 is the "generator polynomial".
<matthewd> But that's [part of] the reason we're talking about just implementing the existing algorithm, without digest-crc
xnxq has quit [Client Quit]
dviola has joined #ruby
BabyMario has joined #ruby
BabyMario has left #ruby [#ruby]
binaryplease has quit [Ping timeout: 260 seconds]
blackmesa has quit [Ping timeout: 240 seconds]
certainty has joined #ruby
maattdd has quit [Ping timeout: 268 seconds]
<Verity> <ChaiTRex> h0wlevd: That one over part is important.
<Verity> huh???
<Verity> where did that come from, https://www.youtube.com/watch?v=4wyvyZGcZw0&t=3m30s
<Verity> this is why I need the bits
thadtheman has joined #ruby
<matthewd> I understand that you need the data in the bits. I'm waiting to see the code to confirm that means we want an actual array of ones and zeros.
certainty has quit [Ping timeout: 240 seconds]
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Verity> well my professor said I will need to shift bits into a register