plujon

Activity Graph

Page 1 of 1

2019-08-02

[05:06:42] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2019-08-01

[20:32:12] plujon: has joined #ruby
[20:47:22] plujon: I notice that `gem install jekyll -P HighSecurity` doesn't do much because jekyll is unsigned.
[20:47:30] plujon: Are there any extant efforts to provide security for [popular] ruby gems?
[21:12:16] plujon: https://github.com/rubygems/rubygems.org/issues/2058 is rather concerning.
[21:12:33] plujon: "oh no! I typoed while installing rails and later discovered my machine has been rooted for a while"
[21:19:53] plujon: qbrd[m]: What do you mean by a "production system"?
[21:26:20] plujon: I can't tell if rials is really a rootkit;
[21:30:41] plujon: Does anybody review gems posted to rubygems.org?
[21:31:19] plujon: Isn't that kinda ...risky...?
[21:36:05] plujon: How do I know what code has been reviewed?
[21:36:28] plujon: Seriously? Don't use a gem unless you've read its source?
[21:45:14] plujon: Granted, the problem is not specific to ruby. I'm not terribly familiar with how this is handled in other places. I know in some places electronic signatures tied to physical human beings is the main "assurance", and others where all code is reviewed.
[22:01:50] plujon: Supposedly, Debian maintainers do [some?] code review when importing from upstream. I'm not sure how consistent or what the details are.
[22:17:05] plujon: havenwood: Interesting, thanks for the links.
[22:19:44] plujon: "Trust should not be granted forever. Trust should expire if it is not renewed." (Ah, so that's why armagadd-on occurred ...)

2019-07-26

[20:35:12] plujon: Ping timeout: 268 seconds
[20:38:13] plujon: has joined #ruby
[20:38:50] plujon: has left #ruby: ()

2019-07-24

[19:07:11] plujon: has joined #ruby
[19:07:51] plujon: def foo(x = (return @x; nil)); end # what does this mean?
[19:16:32] plujon: It appears to be an idiom for setting default arguments. But I don't know what the = (return @x; nil) does. Is that a way to use a default argument from the including class?
[19:17:41] plujon: def foo(x = (return @x; nil)); @x = x; end # what does this mean?
[19:22:24] plujon: havenwood: Thanks; fascinating. I didn't know you could return from a default argument section.
[19:23:24] plujon: So, it's actually an idiom for a getter/setter.
[19:29:07] plujon: Got it. Thanks for the interpretation.
[22:25:27] plujon: The 'geoip-c' gem fails to load my GeoLite2-Country database; anybody know of a reliable geoip gem that works with MaxMind 2 databases?

2019-07-23

[16:58:11] plujon: has joined #ruby
[16:58:39] plujon: Is there a ruby idiom for recursively sorting a nested hash by key, then value?
[17:00:03] plujon: { 'b' => ['c', 'a'], 'a' => { 'c' => 1, 'b' => 2 }, } # to sort something like this
[18:49:11] plujon: { 'a' => { 'b' => 2, 'c' => 1 }, 'b' => ['a', 'c'] }
[18:49:43] plujon: havenwood: sort by keys, and [maybe?] sort any arrays?
[19:12:49] plujon: havenwood: Wowza. Thanks I wouldn't have thought of the public_send approach..
[20:31:53] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2019-07-21

[06:27:00] plujon: Remote host closed the connection

2019-07-16

[19:21:35] plujon: has joined #ruby
[19:39:23] plujon: I'm interested in embedding ruby in a C program. Where can I find good documentation for rb_* such as rb_load ?
[19:41:34] plujon: I'm looking for rb_eval or something similar, that would allow me to evaluate a script that is embedded in the executable as a plain old C string.
[19:42:09] plujon: Oh! I see rb_eval_string in ruby.h; I'll give that a try.
[19:47:28] plujon: It works! Now, to figure out how to compile the thing on Windows...

2019-07-05

[05:13:22] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2019-07-04

[13:46:00] plujon: has joined #ruby

2019-06-29

[06:39:05] plujon: Remote host closed the connection

2019-06-28

[20:34:55] plujon: has joined #ruby

2019-05-31

[05:39:48] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2019-05-30

[19:16:31] plujon: has joined #ruby

2019-05-08

[03:38:12] plujon: Remote host closed the connection

2019-05-07

[17:28:15] plujon: has joined #ruby

2019-05-06

[20:31:14] plujon: Quit: ERC (IRC client for Emacs 25.2.2)
[21:23:53] plujon: has joined #ruby
[21:38:38] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2019-05-04

[16:13:56] plujon: has joined #ruby
[16:17:57] plujon: for i in a b; do echo $i>$i; done; ruby -e 'ARGF.each_line do puts "#{ARGF.filename} #{ARGF.lineno}"; end' a b
[16:18:19] plujon: What is the expected output of that? 'a 1 b 1' or 'a 1 b 2' ?
[16:19:03] plujon: I expected the former, but I got the latter.
[16:20:37] plujon: Doesn't that contradict http://ruby-doc.org/core-2.5.0/ARGF.html#method-i-each ?
[16:25:03] plujon: phaul: Hmm. Thanks. I guess it is the example that is confusing.
[16:25:19] plujon: "For example, the following code prints out each line of each named file ..."
[16:25:58] plujon: "... displaying the filename once per file"
[16:27:00] plujon: I previously thought $. would yield the global line, and ARGF.lineno would return the line inside the current ARGF element.
[16:27:55] plujon: In fact, I vaguely recall seeing this behavior once upon a time (ruby 2.4?). But I'm not sure.
[16:30:18] plujon: It looks like either a ruby bug or a documentation bug. I'm using ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
[16:33:24] plujon: I'll file a bug.
[16:34:15] plujon: It is hard to believe ARGF.lineno isn't tested in the ruby build/release process. Perhaps I am mistaken.
[16:41:20] plujon: Hmm: ARGF.file.lineno !
[16:56:07] plujon: https://bugs.ruby-lang.org/issues/15823
[16:56:17] plujon: We'll see what the devs say.
[16:57:22] plujon: Quit: ERC (IRC client for Emacs 25.2.2)
[17:18:40] plujon: has joined #ruby

2018-07-21

[03:29:18] plujon: Remote host closed the connection

2018-07-20

[17:11:23] plujon: has joined #ruby
[17:11:53] plujon: Is there an idiom for: y = x.to_s.empty? || 'blah'
[17:15:23] plujon: Sorry, unclear: I want to set y to x iff (x is not nil and x is not '')
[17:16:10] plujon: Is there an idiom for that?
[17:16:37] plujon: y = x || blah # like this, but avoid the empty string
[17:17:52] plujon: x is nil or a string, possibly the empty string
[17:18:05] plujon: Another, maybe easier to see case:
[17:18:10] plujon: s = ''; s ||= 'something'
[17:18:45] plujon: s = ''; s = 'something' if s.to_s.empty? # this works, but is long-winded
[17:27:07] plujon: http://ix.io/1hRj # perhaps this is more clear

2018-06-28

[04:23:37] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2018-06-27

[16:28:30] plujon: has joined #ruby
[16:56:52] plujon: Has the status of gem trust changed since 2013?
[16:57:19] plujon: https://guides.rubygems.org/security/ references a "conversation" about gem trust that seems to have fizzled out in 2013.
[17:38:09] plujon: I wonder how rubygems compares to apt, npm, pip, cabal, pear, and others.
[17:39:02] plujon: In terms of vulnerability to a malicious actor.

2018-06-23

[04:58:38] plujon: Remote host closed the connection

2018-06-22

[14:08:28] plujon: has joined #ruby
[14:09:17] plujon: I'm on linux, somewhere near gem hell. How do I get out?
[14:25:12] plujon: sudo apt-get uninstall ruby libapache2-mod-passenger; rm -rf ~/.gem; find /var/lib/gems/2.3.0 /usr/share/rubygems-integration/all/specifications -type f -print0 | xargs rm # clean slate..?
[14:35:27] plujon: rackup # fails
[14:36:19] plujon: Because rackup fails on a simple roda app, I blew away all gems on my machine, uninstall ruby, and decided to start from scratch.
[14:37:07] plujon: Ugh, I wish I saved the output.
[14:37:15] plujon: No bundling, no Gemfile.
[14:37:26] plujon: sudo apt-get install ruby # fresh start
[14:37:42] plujon: I have yet to install it again. I'm unsure whether to do:
[14:38:06] plujon: sudo apt-get install bundler || sudo gem install bundler || gem install bundler # ??
[14:39:15] plujon: bundler is an example in this case, for every ruby thing I am about to install.
[14:44:45] plujon: sudo gem install bundler # worked, I now have bundler 1.15.1. It prints a warning athat I should run `gem install bundler` when I run it.
[14:45:36] plujon: echo "gem 'roda'" >Gemfile && gem i -g # cool, no bundler, installed roda and rack to system gems location
[14:45:44] plujon: echo "gem 'roda'" >Gemfile && sudo gem i -g # cool, no bundler, installed roda and rack to system gems location
[14:45:56] plujon: rackup now works
[14:46:34] plujon: $ rackup # works without `bundler exec` in front
[14:47:01] plujon: rm Gemfile* # rackup still works
[14:48:22] plujon: I understand for a production app I'd commit Gemfile and Gemfile.lock. But I simply want to write a 10 line roda app without relying on a friggin' Gemfile.
[14:49:33] plujon: # apt-get install bundler # seems pointless since it immediately tells me to use `gem install bundler`
[14:49:46] plujon: # sudo gem install bundler # methinks I'll do this too
[14:50:56] plujon: I think the lesson I'm learning is:
[14:51:38] plujon: prefer `sudo gem install <thing>` over `sudo apt-get install <ruby-thing>`
[14:52:28] plujon: I guessed that my former rackup woes were some sort of rack version conflict.
[14:53:46] plujon: But that's a guess. I didn't understand why 'rackup' on a near empty project should fail.
[14:54:23] plujon: The error included: ... rackup uninitialized constant Rack::Session::Abstract::Persisted::RACK_SESSION ...
[14:56:12] plujon: ACTION eyes /usr/lib/ruby/vendor_ruby suspiciously
[15:05:09] plujon: havenwood: Thanks for the sans-bundler `gem i -g` tip.
[15:08:53] plujon: Does rackup (or other ruby code) pay attention to Gemfile.lock? Or does it only have an effect for `bundler exec ...` or 'require "bundler"' code?
[17:48:07] plujon: http://ix.io/1eo2 # RUBYGEMS_GEMDEPS=- rackup # permissions error messages
[17:50:40] plujon: I guess I'll go back to `bundle exec rackup`

2018-06-08

[04:25:38] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2018-06-07

[18:04:41] plujon: has joined #ruby

2018-05-08

[00:29:21] plujon: Quit: ERC (IRC client for Emacs 25.2.2)

2018-05-07

[19:57:38] plujon: has joined #ruby

2017-09-16

[00:53:27] plujon: has joined #ruby
[01:01:29] plujon: Remote host closed the connection

2017-09-15

[00:54:56] plujon: Quit: ERC (IRC client for Emacs 25.2.1)

2017-09-13

[17:41:02] plujon: has joined #ruby

2017-07-28

[00:00:02] plujon: And inside a module definition, the lookup rules are as for the instances of Module object? currentMod.methods, currentMod.class.ancestors.each { |x| x.instance_methods }
[00:00:05] plujon: Is that right?
[00:02:34] plujon: Oh, interesting.
[00:08:15] plujon: o.y # try o.methods, then o.class.ancestors.each { |x| x.methods } ?
[00:11:55] plujon: All objects have ancestor chains? Not just instances of Class?
[00:18:47] plujon: So, practically speaking, anything within Object.constants or Object.methods is basically "global" for ruby code. And anything within Module or Class is "global" within module or class definitions?
[00:19:17] plujon: And anything else needs to be included from a Module (or otherwise in one's ancestor chain)...
[00:20:10] plujon: And, to bring things full circle, classes do not inherit lookup from the module in which they reside.
[00:20:41] plujon: Okay, thanks for the explanations. I'll try to chew on this awhile.
[00:25:45] plujon: ACTION rushes off
[00:25:51] plujon: Quit: ERC (IRC client for Emacs 25.2.1)

2017-07-27

[19:05:16] plujon: has joined #ruby
[19:05:53] plujon: Can one define a method in a module that is available without qualification to classes in that module?
[19:05:59] plujon: as in http://ix.io/yJJ
[19:08:02] plujon: Yes because the module has many classes.
[19:09:19] plujon: I notice that I define foo outside M, that seems to work. But I was aiming to avoid polluting the namespace outside of M.
[19:10:43] plujon: module M; FOO=40; end # works for constants
[19:10:58] plujon: Kernel module? Interesting.
[22:31:02] plujon: zenspider: I want to put the code for a web app in a common namespace (i.e. module) so that I can put another web app in the same process without name collision. I also want to make some methods callable from anywhere in the namespace (i.e. module, or any class therein).
[22:33:08] plujon: Mainly, I think I have yet to well understand the ruby-way of names, scope, and lookup.
[22:42:46] plujon: For example, I have a method named 'pretty_time' that takes a time and returns a humanized relative-to-now string for it. Where should I stick this method? Do I need to create a class for it? Should I monkey patch Time? I wouldn't, if I could simply do "#{pretty_time(t)}" wherever I wanted.
[23:34:45] plujon: I think my scoping question boils down to: Array.wrap vs array_wrap.
[23:50:59] plujon: Is Array "global" because (1) Object.constants contains [..., Array, ...], (2), most (all?) ruby objects are instances of a Class, (3) most (all except BasicObject?) Class objects are subclasses of Object?
[23:56:24] plujon: Is the lookup chain: obj.methods, then, obj.class.ancestors.each { |x| x.instance_methods } ?
[23:57:24] plujon: It is interesting that ancestors include modules and not just superclasses.
[23:58:41] plujon: Interesting.

2017-07-21

[00:01:31] plujon: Remote host closed the connection

2017-07-20

[15:52:14] plujon: has joined #ruby

2017-06-30

[20:23:09] plujon: has joined #ruby
[21:43:21] plujon: Remote host closed the connection

2017-06-29

[19:42:12] plujon: has joined #ruby
[23:07:33] plujon: Remote host closed the connection

2017-06-27

[05:02:29] plujon: Remote host closed the connection

2017-06-26

[15:39:47] plujon: has joined #ruby
[15:47:53] plujon: I'm curious why a particular ruby process is using 140MB of memory. Is it possible for me to inspect the object state of this already-running process?
[15:50:02] plujon: The machine is linux, so I can find some things in /proc . But the more I can learn, the better.
[15:52:49] plujon: I guess I should collect what information I can now to see if there are any clues as to where most of the memory is used, then add some debugging hooks for the future.
[15:53:10] plujon: How do you execute ruby from within gdb?
[15:53:28] plujon: (and/or get a heap dump)
[15:55:47] plujon: ACTION nods
[20:01:56] plujon: To answer my own question: rbtrace -p PID -e '...' is the easiest way to get a heap dump of a running ruby process.

2017-06-16

[00:27:52] plujon: Remote host closed the connection

2017-06-15

[02:52:02] plujon: Remote host closed the connection
[16:34:58] plujon: has joined #ruby
[19:01:22] plujon: Read error: Connection reset by peer
[19:24:38] plujon: has joined #ruby

2017-06-14

[15:42:08] plujon: has joined #ruby
[15:43:59] plujon: What's the inverse of klass.name?
[15:44:55] plujon: matthewd: Object.const_get(Integer.name) # cool, thanks!
[15:51:19] plujon: Integer.name.constantize == Object.const_get(Integer.name) # good to know

2017-06-09

[15:55:25] plujon: has joined #ruby
[16:56:21] plujon: Remote host closed the connection

2017-06-06

[00:47:58] plujon: Quit: ERC (IRC client for Emacs 25.2.1)

2017-06-05

[20:25:04] plujon: has joined #ruby
[20:53:12] plujon: [].include? # <- is the performance for this defined? E.g. O(n), O(log n), O(1) ?
[21:00:15] plujon: elomatreb: Thanks; I was going to convert array to a hash for guaranteed O(1). But I didn't think (or know) about Set.
[21:04:06] plujon: ACTION confirmed [].include? has O(n) performance using my ruby

2017-06-03

[00:36:45] plujon: Quit: ERC (IRC client for Emacs 25.2.1)

2017-06-02

[19:22:08] plujon: has joined #ruby

2017-04-19

[03:35:32] plujon: has joined #ruby
[05:37:48] plujon: Quit: ERC (IRC client for Emacs 25.1.1)

2017-04-18

[00:06:10] plujon: Remote host closed the connection

2017-04-17

[23:04:54] plujon: has joined #ruby

2016-07-13

[00:00:40] plujon: Quit: ERC (IRC client for Emacs 24.5.1)

2016-07-12

[14:44:54] plujon: has joined #ruby

2016-04-29

[16:06:20] plujon: has joined #ruby
[23:33:47] plujon: Quit: ERC (IRC client for Emacs 24.5.1)