havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.0, 3.0.3, 2.7.5: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
Liexei has quit [Quit: Bye...]
ur5us_ has quit [Ping timeout: 240 seconds]
shokohsc has quit [Quit: The Lounge - https://thelounge.chat]
Rounin has quit [Ping timeout: 260 seconds]
Liexei has joined #ruby
<John_Ivan> weaksauce, not rubyzip. just 'zip'
<John_Ivan> havenwood, the lib loads correctly.
<weaksauce> John_Ivan which gem did you install?
<weaksauce> because require 'zip' is rubyzip
<John_Ivan> weaksauce, `gem install zip` - this one here - https://rubygems.org/gems/zip/versions/2.0.2
<John_Ivan> "
<John_Ivan> "
<John_Ivan> zip is a Ruby library for reading and writing Zip files. Unlike the official rubyzip, zip is compatible with Ruby 1.9.1.
<John_Ivan> sorry. that \r\n went out of wack.
<weaksauce> that project maintainer bailed on it
<John_Ivan> oh
<weaksauce> is this greenfield or are you trying to get something to work?
<John_Ivan> who is greenfield
<weaksauce> like... a new project
<John_Ivan> oh. well. I'm not new to software engineering. I am new to ruby. as a little test, I am writing a script that's meant to read .rar files.
<weaksauce> ah
<John_Ivan> and print out to console it's contents.
<weaksauce> yeah greenfield stuff... i'd probably use rubyzip
<John_Ivan> I'll do that then.
<John_Ivan> not familiar with the term greenfield. I know greenhorn though :)
<weaksauce> they call it greenfield because the project is on an open green field and there is nothing in the way already built
<weaksauce> :)
<John_Ivan> weaksauce, neat.
<John_Ivan> "Zip end of central directory signature not found (Zip::Error)"
<John_Ivan> I'm guessing rubyzip doesn't handle .rar files.
<weaksauce> oh rar hmm
<John_Ivan> though I could've sworn the last stackoverflow question mentioned that any zip gem should handle rar as well
<John_Ivan> last so question I've read*
<John_Ivan> "ffi-libarchive provides a gem-based solution. It works for rar files even though they don't specifically mention it (see issue #151). Add this to your application's Gemfile:"
<John_Ivan> time to test that.
<weaksauce> i don't know if there is a general un-raring thing
<John_Ivan> weaksauce, if worst comes to worst, I'll just call the rar-cli directly as a new process.
<weaksauce> yeah that's simple enough
<John_Ivan> weaksauce, it seems ffi-libarchive has the same issue as Zip. "uninitialized constant Archive (NameError)" for Archive::EXTRACT_PERM
* John_Ivan dissapoint
reset has quit [Quit: reset]
<weaksauce> do you have libarchive installed
<John_Ivan> the binary? nope. just installed the gem. I'm not running a *nix machine.
<weaksauce> it's a FFI to that binary
<John_Ivan> ah
<weaksauce> which is "foreign function interface"
<weaksauce> so it calls stuff from ruby into the C/etc world
<John_Ivan> Understood. *slaps his own face*
<John_Ivan> yeah. makes sense.
<John_Ivan> weaksauce, but that aside, I'd expect it to throw a runtime error as opposed to a syntax/interpreter error, no?
<John_Ivan> what is an uninitialized constant?
<weaksauce> post the full stack trace in a gist or something
<weaksauce> and i can tell you more
<weaksauce> just means that something is not defined
<weaksauce> could be that it failed to bind correctly and thus didn't create that constant (uppercase things in ruby that are generally classes or values)
<John_Ivan> weaksauce, https://pastebin.com/dCR48Egw
<weaksauce> maybe gist your code too
<John_Ivan> weaksauce, it's the one in the github repo I like here - https://github.com/chef/ffi-libarchive
<John_Ivan> the one for extraction. those 3-4 lines.
<John_Ivan> well. more like 6.
<weaksauce> you need to require that gem
<weaksauce> but yeah
<weaksauce> if it wasn't required then it can't initialize itself
<John_Ivan> weaksauce, ok. yeah. that did it.
<John_Ivan> and of course, can't open archive.dll, because we spoke about that.
<John_Ivan> awesome.
<John_Ivan> at least now I know what's wrong.
<weaksauce> yeah, windows is a gong show wrt ruby
<weaksauce> i'd think you would want to install WSL
<weaksauce> or whatever it is
<John_Ivan> I have a linux vm with seamless integration so I have access.
<John_Ivan> but I need this running on windows.
<John_Ivan> weaksauce, anyway, so an uninitialized constant means something isn't defined. ok. got it. that was.... confusing.
<John_Ivan> I'll keep that in mind next time I forget to require something.
<weaksauce> you can try https://github.com/aileron/unrar
<weaksauce> that's just a simple rb file
<weaksauce> just require "./unrar.rb" or whatever it is named in the same directory your script is on
<John_Ivan> weaksauce, I will try that. my concern right now is however less to achieve my archiving goals, as much as it is to understand ruby.
michigan has joined #ruby
<John_Ivan> I don't come from an scripted/interpreted/VHLL background
<weaksauce> ah
<John_Ivan> C.
<weaksauce> well fileutils are useful
<John_Ivan> I've noted that class, yeah. also, I've noticed there's no socket class. but `File` has a socket? method which means, I assume, that files will be treated as sockets, alongside the Io class.
<John_Ivan> very unixy
<John_Ivan> anyway, I'd like to make a list if you don't mind
<John_Ivan> weaksauce, popular gems people use or have that "fill/complement" the std-lib
<weaksauce> socket is part of the stdlib
<John_Ivan> weaksauce, *slaps his own face* - I forgot to mention I'm with the ruby 2.5 docs
huma has joined #ruby
<John_Ivan> it doesn't have these classes there.
<weaksauce> i'm sure it's been in ruby for eons :)
<weaksauce> they have core and stdlib
<weaksauce> split apart
<weaksauce> net/http is more high level than socket
<John_Ivan> eh? what's the difference
<John_Ivan> between core and stdlib
<weaksauce> core is the essentials like enumerable, array, hash
<John_Ivan> ah. ok. I see. damn. I missed this completely. the stdlib page.
<John_Ivan> I was looking only at core
<weaksauce> i guess stuff that you'd need to make any program
<weaksauce> the extra stuff like csv is out that way
<John_Ivan> ok this makes a lot of sense now
<John_Ivan> weaksauce, thanks for that, saved me a lot of trouble. now then, as I said, I'm trying to make a list of popular gems to complement the core/stdlib. anything that comes to mind?
<weaksauce> the stdlib is still very used but not always
<weaksauce> rake/minitest or rspec/bundler
<weaksauce> rails/thor
<weaksauce> set is useful sometimes
<weaksauce> time is generally the one you want to use instead of Date or datetime
<weaksauce> open3
<weaksauce> net/http
<John_Ivan> cheers
<weaksauce> there's a ton really
<weaksauce> Dir and File are useful
<weaksauce> as are fileutils for copy/rename/remove etc
<weaksauce> spend some time learning enumerable as that is hands down the most important thing in ruby
<weaksauce> map/reduce/select/reject/etc
<John_Ivan> weaksauce, sounds like iterator in C++.
<John_Ivan> weaksauce, yeah, these are in stdlib. I was thinking, more like, external gems.
<John_Ivan> stdlib/core*
<weaksauce> ah
<weaksauce> awesomeruby is something worth a browse
<John_Ivan> sweet
<weaksauce> one of the newer ones is async with ruby 3
<John_Ivan> holy
<John_Ivan> weaksauce, that is huge :D
* John_Ivan tips hat
<weaksauce> :)
<weaksauce> metasploit is fun
<John_Ivan> weaksauce, I'm sure it is (grins)
<John_Ivan> weaksauce, ok. nice. now to start actually understanding the syntax.
<John_Ivan> by the way
<weaksauce> hands down the best book on breaking you from your C chains is eloquent ruby
<weaksauce> great book
<weaksauce> teaches the ruby way
<John_Ivan> weaksauce, before ending up in ruby from C, I was guided to python. I left after 2 days.
<weaksauce> haha i don't care for python
<John_Ivan> I can't stand python. ruby on the other hand, I thought had a more sane syntax
<weaksauce> oh the syntax can get ugly sometimes but it's wonderful
<weaksauce> fun to program in
<John_Ivan> that's what I like to hear :D
<John_Ivan> this/
<weaksauce> yeah that one
<weaksauce> probably the only programming book i have read cover to cover
<John_Ivan> I take it you came from a C background before too huh?
<weaksauce> yeah
<weaksauce> way before the internet i read teach yourself c in 24 hours
<weaksauce> actually paid for a compiler too
<weaksauce> i think it was borland c++
<John_Ivan> ah. that's a lot longer before than me
<John_Ivan> I started with MSVC 6.0 - writing winAPI code
<weaksauce> ah fun
<weaksauce> i started on an apple iie doing basic
<John_Ivan> after much `bliss` (though now it kinda is), I was then introduced to C++, and later C++.net with the CLR
<weaksauce> typing from magazines
<John_Ivan> oh cool
<weaksauce> .net is nice
<weaksauce> i did some c# in it
<John_Ivan> .NET in any other language that isn't C++ is indeed nice.
<John_Ivan> the syntax is wack and the managed/unmanaged conversions is a bit of an ugly procedure
<weaksauce> yeah i bet
<John_Ivan> weaksauce, a little over 40 I presume? I'm just entering my 30s.
<John_Ivan> you're getting graybeard. neat position to be in. just sucks age wise.
<John_Ivan> I have a decade until I reach that level
<weaksauce> hah yeah
<weaksauce> a few gray hairs but i look pretty young
<John_Ivan> weaksauce, graymatter ;)
<John_Ivan> thanks for the book btw. I'll see to reading it.
<weaksauce> np enjoy :)
<John_Ivan> I hope ruby will be the language I'll settle for when it comes to VHLL
<John_Ivan> because I really. really dislike python or javascript hehe
<weaksauce> yeah those are not my favorites
John_Ivan has quit [Ping timeout: 268 seconds]
Al2O3 has joined #ruby
huma has quit [Ping timeout: 268 seconds]
bluedust has joined #ruby
bandithijo has joined #ruby
bandithijo has quit [Client Quit]
bluedust_ has joined #ruby
bluedust has quit [Ping timeout: 240 seconds]
teclator has joined #ruby
bluedust has joined #ruby
Rounin has joined #ruby
bluedust_ has quit [Ping timeout: 256 seconds]
fef has joined #ruby
bluedust_ has joined #ruby
bluedust_ has quit [Read error: Connection reset by peer]
bluedus__ has joined #ruby
bluedust has quit [Ping timeout: 240 seconds]
michigan has quit [Quit: Connection closed for inactivity]
bluedust has joined #ruby
bluedus__ has quit [Ping timeout: 256 seconds]
michigan has joined #ruby
bluedust has quit [Remote host closed the connection]
bluedust has joined #ruby
splud has quit [Ping timeout: 240 seconds]
_ht has joined #ruby
huma has joined #ruby
shokohsc has joined #ruby
reset has joined #ruby
bluedust has quit []
foxxx0 has quit [Quit: foxxx0]
huma has quit [Ping timeout: 240 seconds]
foxxx0 has joined #ruby
huma has joined #ruby
foxxx0 has quit [Client Quit]
foxxx0 has joined #ruby
<ox1eef> I'm grateful for JavaScript because it trained me to think different, and to solve problems differently.
xyhuvud has joined #ruby
yxhuvud has quit [Ping timeout: 268 seconds]
lim has joined #ruby
lim has quit [Remote host closed the connection]
<leah2> different than?
huma has quit [Ping timeout: 240 seconds]
michigan has quit [Quit: Connection closed for inactivity]
splud has joined #ruby
hanzo has quit [Quit: Connection closed for inactivity]
phryk has quit [Quit: ZNC 1.8.2 - https://znc.in]
phryk has joined #ruby
michigan has joined #ruby
taupiqueur has joined #ruby
lim has joined #ruby
huma has joined #ruby
cornduck has quit [Remote host closed the connection]
cornduck has joined #ruby
lim has quit [Remote host closed the connection]
Guest74 has joined #ruby
perrierjouet has joined #ruby
<Guest74> Hi everyone! Anyone here that could help me with finding the memory location of a ruby object? Before 2.7, this was easy with object_id, but this changed
<Guest74> `FFI::Pointer.new(object_id * 2)` works for ruby 2.6 but not for 2.7+
roadie has joined #ruby
huma has quit [Ping timeout: 240 seconds]
Guest74 has quit [Quit: Client closed]
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
Al2O3 has quit [Remote host closed the connection]
bit4bit has joined #ruby
whysthatso12 has quit [Remote host closed the connection]
whysthatso12 has joined #ruby
huma has joined #ruby
sagax has quit [Quit: Konversation terminated!]
sagax has joined #ruby
fef has quit [Quit: Leaving]
tsujp has joined #ruby
RawFiend has joined #ruby
John_Ivan has joined #ruby
taupiqueur has quit [Quit: taupiqueur]
michigan has quit [Quit: Connection closed for inactivity]
AEtherC0r3 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
AEtherC0r3 has joined #ruby
fef has joined #ruby
aeris has quit [Remote host closed the connection]
fef has quit [Remote host closed the connection]
fef has joined #ruby
aeris has joined #ruby
RawFiend has quit [Quit: Gone away...]
RawFiend has joined #ruby
fef has quit [Remote host closed the connection]
fef has joined #ruby
hanzo has joined #ruby
hanzo is now known as Guest3257
Guest3257 has joined #ruby
Guest3257 has quit [Changing host]
huma has quit [Quit: Leaving]
Guest3257 is now known as hanzo
entropie has joined #ruby
<entropie> Hey. My gentoo machines updated ssh to openssh-8.8_p1-r4 and now capistrano asks for a passwords when doing remote stuff. Any ideas?
<adam12> entropie: It doesnt' ask for a password when not using capistrano? ie. just `ssh`?
<entropie> adam12: yes, it works fine without capistrano. I have set every host I use in my ~/.ssh/config
<entropie> It worked fine before the update
<adam12> entropie: which version of net-ssh?
<leah2> does capistrano force some old ciphers or something so the key doesnt get accepted?
<adam12> entropie: and the gentoo machines are the client or the remote?
<entropie> adam12: net-ssh (6.1.0)
<leah2> no release yet :^)
<entropie> leah2: A i have looked at the changelog of openssh mentioning this but wasnt sure if this applies.
<leah2> perhaps you can enable sha2 on the server again
<entropie> yeah, need to to this. Thanks
hellstabber has joined #ruby
hellstabber_ has joined #ruby
michigan has joined #ruby
hellstabber_ has quit [Remote host closed the connection]
hellstabber_ has joined #ruby
hellstabber_ has quit [Remote host closed the connection]
hellstabber has quit [Remote host closed the connection]
RawFiend has quit [Quit: Gone away...]
RawFiend has joined #ruby
slothby has joined #ruby
Fridtjof has quit [Quit: ZNC - http://znc.in]
fef has quit [Quit: Leaving]
Fridtjof has joined #ruby
hellstabber has joined #ruby
michigan has quit [Quit: Connection closed for inactivity]
<John_Ivan> weaksauce, Eloquent_Ruby; Document class; word.size
<John_Ivan> I sure hope I can do word().size(), right?
<John_Ivan> nevermind. "Ruby tries hard not to require any syntax it can do without and a great example of this
<John_Ivan> or omit the parentheses around the arguments. "
<John_Ivan> is its treatment of parentheses. When you define or call a method, you are free to add
<John_Ivan> thank god
<John_Ivan> I mean
<John_Ivan> thank Allah.
<John_Ivan> and Anubis
<John_Ivan> anyway. Chapter 2.
* John_Ivan frowns
<John_Ivan> right. not something I consider useful, or rather, not something I am willing to change.
<John_Ivan> Chapter 3.
<adam12> John_Ivan: IMHO, leave parenthesis off if there are no arguments, but use them if there are.
<adam12> They are optional in most cases, but while you're learning, it's not worth determining when they can be left off. Or which arguments belong to which.
<adam12> Or the worse, when a hash is passed as a block argument.
<John_Ivan> adam12, I heed the advice. But I know what practice is objectively right or wrong when it comes to syntax choices.
<John_Ivan> parentheses should not be optional. with or without arguments. that is my belief.
bit4bit has quit [Ping timeout: 256 seconds]
TCZ has joined #ruby
<John_Ivan> ---
bit4bit has joined #ruby
<John_Ivan> "collection.each() do | arg | { }"
<John_Ivan> to be used instead of for? eh. a bit of a meh. but sure. it's fair enough.
<adam12> John_Ivan: `for` is there but it's not used that much. It has different semantics than the blocks, and you can't use it with Enumerable.
<adam12> John_Ivan: Once you start using Enumerable methods you'll see why.
hololeap has joined #ruby
<John_Ivan> adam12, I get the idea. just another <Iteration> API
<adam12> John_Ivan: Sure. Many methods in Enumerable are chainable too, so you can compose operations.
<John_Ivan> and is `while` as well less frequent as a result of `unless/until`?
hololeap has quit [Ping timeout: 276 seconds]
<weaksauce> don't use for John_Ivan
<weaksauce> it will mess you up
<weaksauce> and omitting parens on methods that don't have arguments is common. reads easier
<weaksauce> but, adding parens when there are arguments is what should be done
michigan has joined #ruby
<John_Ivan> fair
<John_Ivan> weaksauce, right, well, so far, aside from some of the conventions, things look good.
<John_Ivan> it's not python or js.
<John_Ivan> :P
<weaksauce> for i in [*1..10] { puts(i) }
<weaksauce> doesn't create a new scope for i
<weaksauce> i is equal to 10 now
<weaksauce> vs [*1..10].each { |i| puts(i) }
<weaksauce> i is undefined
<John_Ivan> so `i` is left dangling around the scope, taking up namespace
<John_Ivan> that's..... meh.
<weaksauce> nah it will clobber too
<weaksauce> so if you have say i = 42 it would be overwritten
<weaksauce> at the end of the for loop
<John_Ivan> makes sense.
TCZ has quit [Quit: Leaving]
<John_Ivan> weaksauce, nice, there's also no need to artificially create accessors/mutators for each variable you add to your class
<weaksauce> there's attr_accessor, attr_reader and attr_writer if you want to make the basic cases easily
<weaksauce> rw, r and w
<weaksauce> just pass in a symbol in your class
<John_Ivan> yup. saw that in the book
<John_Ivan> it's neat
_ht has quit [Remote host closed the connection]
<nakilon> 05:11:13 <John_Ivan> but I need this running on windows.
<nakilon> the last time I had such demand I convinced them to make it a web app and use via browser
<nakilon> depends on your use case of course
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
RawFiend has quit [Quit: Gone away...]
<John_Ivan> my main data I process on is on NTFS drivers, used mainly by Windows.
<leftylink> ugh I forget the flags every time... maybe I should just use awk
<leftylink> pandabot: what's ruby flags
<pandabot> rubyflags is: ruby -ple '$_.upcase!' < input.txt; ruby -nle 'BEGIN { i = c = 0 }; c += $_.size; puts "#{i += 1} #$_"; END { p c }' < input.txt
<nakilon> use bash ctrl+R
<weaksauce> or ... make an alias
<weaksauce> also, what are you doing with that monstrosity
<leftylink> at first I thought I wanted a sum, but I decided min/max were sufficient, and since min/max is all I want, I went with sort -n instead of Ruby
<leftylink> a sum over all the lines provided on standard input
bit4bit has quit [Remote host closed the connection]
<leftylink> okay so if I want the sum it's awk '{s+=$1} END {print s}'
<nakilon> is BEGIN END a thing from awk?
<leftylink> I guess that seems likely
geewiz has quit [Ping timeout: 250 seconds]
michigan has quit [Quit: Connection closed for inactivity]