bsamorim

Activity Graph

Page 1 of 1

2018-12-11

[23:19:25] bsamorim: has joined #ruby
[23:21:04] bsamorim: How can a ruby process silently die?
[23:21:17] bsamorim: Aside from simply returning with status code 0
[23:21:28] bsamorim: nine_milli: ok
[23:22:34] bsamorim: Actually, it prolly runs on ruby so that it can easily eval ruby code
[23:22:45] bsamorim: #foo's bot runs in foo
[23:41:24] bsamorim: Ping timeout: 252 seconds

2018-09-13

[03:27:25] bsamorim: has joined #ruby
[03:40:02] bsamorim: Guys, I have a nested module Foo::Bar in my code. If I load my app, calling Foo::Bar.constants doesn't show me Foo::Bar's classes, but I can successfully invoke all its classes in the same scope
[03:42:21] bsamorim: What could be causing it? The app is loaded by invoking "irb -r /path/to/base_file.rb"
[03:49:49] bsamorim: ventures: rewriting the whole thing in python
[03:52:01] bsamorim: i guess that Ruby is one of those languages that can yield very bad code if abused
[03:52:47] bsamorim: what do you mean by "integrating"?
[03:52:58] bsamorim: How would their interaction go about?
[04:08:21] bsamorim: Ping timeout: 252 seconds

2018-09-11

[20:40:49] bsamorim: has joined #ruby
[20:41:14] bsamorim: Guys, is there any solid ruby lib to manage forever-running background jobs?
[20:42:02] bsamorim: Resque-schedule doesn't seem to offer that feature
[22:05:00] bsamorim: Ping timeout: 252 seconds

2018-08-18

[17:55:16] bsamorim: has joined #ruby
[17:59:08] bsamorim: Hi! I'm having trouble installing ruby from source: I followed the instructions from the ruby website. The installation itself succeded but, when I tried running `gem install bundler`, I got the error "Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources"
[17:59:18] bsamorim: Is this a known issue?
[18:00:01] bsamorim: The only oddity about my installation is that I'm running every command as the root user.
[18:00:21] bsamorim: Could this be the cause of the issue?
[18:01:00] bsamorim: I have openssl installed, by the way
[18:12:00] bsamorim: But I'm installing it before ruby
[18:12:45] bsamorim: apeiros: thanks a lot for the tip! Is it thinner than rvm?
[18:13:12] bsamorim: ok, thanks!
[21:51:42] bsamorim: Ping timeout: 256 seconds

2018-08-15

[20:49:08] bsamorim: has joined #ruby
[20:49:47] bsamorim: Hi, folks! I'm having a tough time understanding YARV's garbage collection dynamics
[20:51:07] bsamorim: If I start up a irb session and fire up a method that takes ~1 min to complete and consumes ~4.5% of my memory, at the end of it, the memory consumption from the method persists
[20:51:58] bsamorim: havenwood: I tried that, but it didn't have any effect
[20:52:18] bsamorim: If I fire up the method once again, the memory eventually goes down, and then back up again
[20:53:03] bsamorim: havenwood: k, wait a minute
[20:53:23] bsamorim: before and after the first method invocation, or the second?
[20:54:18] bsamorim: k, just a sec
[20:55:25] bsamorim: havenwood: sure, I'll share
[20:55:59] bsamorim: zenspider: because the code is really just performing a 'rest-client' request
[20:57:16] bsamorim: zenspider: You're absolutely right - I haven't done a thorough investigation. I just assumed that ruby's most popular http client wouldn't have such weird memory cost
[20:58:27] bsamorim: havenwood: there's the pastebin https://dpaste.de/8cPU
[20:58:42] bsamorim: I'll paste the method definition as well
[20:59:39] bsamorim: havenwood: wish I met you 2000 lines of code ago :(
[21:00:31] bsamorim: havenwood: so this most likely has nothing to do with GC? haha thank god!
[21:02:38] bsamorim: havenwood, zenspider: thank you guys very much for the help!
[21:43:49] bsamorim: Ping timeout: 244 seconds

2018-08-13

[18:24:51] bsamorim: has joined #ruby
[18:28:10] bsamorim: Hi, given MRI's GIL, do I have to use synchronization mechanisms such as locks for sharing an array between two threads? My case is a bit more specific: the threads would just push/pop to/from the array, respectively. The order in which the push and pops would actually be executed would be irrelevant - I just wanted to know if they could be considered atomic.
[18:29:37] bsamorim: Please interpret "MRI" as "Most popular ruby interpreter for > 2.0 rubies"
[18:34:57] bsamorim: apeiros: k, thx
[18:35:55] bsamorim: apeiros: it doesn't, but it certainly helps to enable these operations to be thread-safe by default
[18:36:01] bsamorim: they are in python, for instance
[18:36:07] bsamorim: *in CPython
[18:36:56] bsamorim: apeiros: it isn't really a formal concept ;)
[18:37:33] bsamorim: I explained what I meant by thread-safe in the first message's last sentence
[18:38:58] bsamorim: apeiros: that's fine by me...thanks!
[18:40:42] bsamorim: apeiros: k, thanks!
[22:02:21] bsamorim: Ping timeout: 240 seconds

2018-07-31

[14:02:31] bsamorim: has joined #ruby
[14:03:39] bsamorim: Hello! Is running `bundle install` as root user and executing the app as another one a bad practice in ruby?
[14:10:48] bsamorim: ineb: I haven't tried specifing a --path. Without the arg, I get a EACCESS error. I realize that this is fixable by setting up appropriate group membership to my app-running user but, since after root-bundle-installing the app's dependencies, I could exec the app just fine as another user, I wanted to know what exactly was behind this "no-bundler-as-root" rule
[14:12:54] bsamorim: ineb: this exposure only happens during the actual bundle install, right?
[14:13:14] bsamorim: I can't exec arbitrary code as root just by running the app, right?
[14:14:38] bsamorim: ineb: haha ok, thanks for the help!
[14:14:50] bsamorim: ineb: k, thx!
[15:08:54] bsamorim: Ping timeout: 256 seconds

2018-07-18

[13:15:43] bsamorim: has joined #ruby
[15:14:23] bsamorim: Quit: Ex-Chat

2018-07-17

[16:11:48] bsamorim: has joined #ruby
[16:13:41] bsamorim: Hi, folks! Does ruby have macros? I mean, can I code in ruby something like "assign(hash[:key], "val")" so that, before the expression is evaluated, it gets substituted for 'hash[:key] = "val"'?
[16:20:46] bsamorim: Alec: yeah, sure, that'd be great...like C's preprocessor
[16:21:05] bsamorim: that's a great idea
[16:22:27] bsamorim: Yeah, of course, you can just let "make" manage that for u
[16:25:16] bsamorim: elomatreb: that use case is quite plausible, i think
[16:25:26] bsamorim: Basically, side-stepping the lack of pointers in ruby
[16:25:38] bsamorim: I can't have a reference to hash[:key]
[19:16:29] bsamorim: Ping timeout: 276 seconds
[20:41:09] bsamorim: has joined #ruby
[20:50:45] bsamorim: Ping timeout: 264 seconds

2018-07-14

[12:13:07] bsamorim: has joined #ruby
[14:54:27] bsamorim: Ping timeout: 240 seconds

2018-07-13

[19:53:12] bsamorim: has joined #ruby
[21:02:09] bsamorim: Ping timeout: 260 seconds

2018-07-07

[16:10:07] bsamorim: has joined #ruby
[16:26:49] bsamorim: Quit: Ex-Chat

2018-07-06

[13:37:48] bsamorim: has joined #ruby
[17:19:27] bsamorim: Ping timeout: 240 seconds
[17:51:56] bsamorim: has joined #ruby
[23:26:57] bsamorim: Ping timeout: 240 seconds

2018-07-05

[01:10:27] bsamorim: Ping timeout: 240 seconds
[02:58:48] bsamorim: has joined #ruby
[03:58:57] bsamorim: Ping timeout: 240 seconds
[04:08:13] bsamorim: has joined #ruby
[04:52:57] bsamorim: Ping timeout: 240 seconds
[13:11:58] bsamorim: has joined #ruby
[16:15:27] bsamorim: Ping timeout: 240 seconds
[17:05:39] bsamorim: has joined #ruby
[17:11:27] bsamorim: Ping timeout: 240 seconds
[17:20:21] bsamorim: has joined #ruby
[19:36:36] bsamorim: Is Ruby 2.5.1 stable?
[19:39:39] bsamorim: miah, NL3limin4t0r: thanks!
[19:42:27] bsamorim: is it common to implicitly use dependencies in Ruby code? I mean, if I require 'baz' and 'bar' in 'foo' (in that oreder) and I use 'baz' in 'bar', should I do "require 'baz'" in 'bar'?
[19:47:00] bsamorim: ineb: and requiring the same code twice is a gotcha-free situation?
[19:47:12] bsamorim: or should I be aware of something?
[19:53:03] bsamorim: ineb: ok, thanks!
[19:53:41] bsamorim: got it, thanks!
[19:58:13] bsamorim: ineb: Yeah, that seemed rather arbitrary...thanks for the update!
[21:52:27] bsamorim: Ping timeout: 240 seconds

2018-07-04

[16:22:56] bsamorim: has joined #ruby
[16:26:51] bsamorim: Hello! I'm using a lib that has a "foo(bar, &block)" method in one of its classes. If I subclass that class, and write as method to that subclass "def ext_foo(bar, &block);foo(bar, &block);end", it behaves perfectly
[16:27:34] bsamorim: But, if I do "def ext_foo(bar, &block);foo(bar) do block.call end;end", the scope in which "block" gets executed is completely messed up
[16:28:44] bsamorim: What's happening? How can I extend block and forward it too "foo" so that it behaves the same as if it was passed untouched?
[16:42:49] bsamorim: elomatreb: if the place where I put in "block.call" is irrelevant, how is the behaviour from both definitions of "ext_foo" different?
[16:45:30] bsamorim: that's pretty much it, as far as my extensions go
[16:45:38] bsamorim: Would the code for "foo" help?
[16:54:42] bsamorim: apeiros: I wanted to run some operations before the block is executed
[16:55:16] bsamorim: I mean, the block isn't executed when "foo" is called - it is registered as a class method for one of the lib's classes
[16:55:45] bsamorim: I wanted that dynamically created method to include these operations that I want to perform
[16:56:48] bsamorim: I'll look into it and get back to you.
[16:57:09] bsamorim: It can't be the arguments thing, though, because that's not the issue with the block call
[16:58:00] bsamorim: Basically, the class has a method that's found normally when I do "foo(bar, &block)", but now when the block is passed the other way
[16:58:05] bsamorim: I get a "MethodNotFound" exception
[17:00:23] bsamorim: apeiros: sure, no problem..do you guys have a pastebin for the channel?
[17:04:07] bsamorim: https://gist.github.com/bernardo-amorim/3cbcff63f1ca6fd97113873a29749117
[17:04:13] bsamorim: there it is
[17:04:22] bsamorim: It's a sinatra app, so I included the "config.ru" also
[17:04:36] bsamorim: but I think it's irrelevant for the discussion, though
[17:05:30] bsamorim: The project, I think, is in a instance scope/class scope conflict
[17:06:21] bsamorim: elomatreb: I get a "undefined local variable or method `print_request' for FooController:Class" exception
[17:08:03] bsamorim: elomatreb: it'd work in that particular example, but I actually want to use instance variables in those helper functions :(
[17:08:44] bsamorim: so, should I do "get(route) do instance_eval(&block) end" ?
[17:12:31] bsamorim: yep, worked like a charm! thanks, man! I've never used instance_eval, though. How hacky is it?
[17:15:51] bsamorim: elomatreb: ok, thanks a lot for the explanation!
[17:31:03] bsamorim: Man, Ruby certainly has its share of magic
[17:31:26] bsamorim: It's just one surprise after the other
[20:05:34] bsamorim: Ping timeout: 256 seconds
[20:54:31] bsamorim: has joined #ruby
[21:51:57] bsamorim: Ping timeout: 240 seconds
[23:13:02] bsamorim: has joined #ruby

2018-03-28

[15:21:31] bsamorim: has joined #ruby
[15:22:58] bsamorim: Hi, guys! Could anyone tell me which unit is used in ObjectSpace.memsize_of(obj) 's return value?
[15:23:49] bsamorim: I couldn't find such info in the docs
[15:37:24] bsamorim: havenwood: thanks!
[17:44:35] bsamorim: icarus: why would you need a timeout?
[17:46:14] bsamorim: I think the problem is with running `exec` in this case
[17:48:15] bsamorim: if you want to exec a bash statement and return to the caller program, yielding the command's output, your best choice would be using backticks
[17:48:43] bsamorim: so, your code would be `get '/:action' do |a| \n response = `ssh ...` \n puts response \n end`
[18:38:36] bsamorim: Ping timeout: 256 seconds
[18:44:15] bsamorim: has joined #ruby
[19:12:21] bsamorim: Read error: Connection reset by peer

2018-03-22

[03:17:17] bsamorim: has joined #ruby
[04:23:17] bsamorim: Ping timeout: 268 seconds
[05:35:33] bsamorim: has joined #ruby
[07:31:45] bsamorim: Ping timeout: 248 seconds

2018-03-21

[05:40:13] bsamorim: has joined #ruby
[05:42:19] bsamorim: Hello, guys! I have made a quick sinatra app that, in one of its endpoints, reads a video file in chunks and sends it over the net.
[05:42:51] bsamorim: The problem is that the amount of memory that the app consumes seems to be independent of the chunk size
[05:43:23] bsamorim: Is this something due to ruby or sinatra?
[05:44:00] bsamorim: I am opening the file with `open(file_path)` and yielding its chunks with `read(chunk_size)`
[06:11:59] bsamorim: Ping timeout: 256 seconds
[12:07:53] bsamorim: has joined #ruby
[12:41:58] bsamorim: Ping timeout: 240 seconds

2017-06-20

[00:38:55] bsamorim: has joined #ruby
[01:24:25] bsamorim: Remote host closed the connection

2017-06-19

[14:14:25] bsamorim: has joined #ruby
[14:14:50] bsamorim: Hello, guys! Do blank spaces have semantic value in ruby?
[15:32:20] bsamorim: Ping timeout: 258 seconds
[23:05:41] bsamorim: has joined #ruby
[23:15:02] bsamorim: Ping timeout: 240 seconds

2017-06-17

[21:24:38] bsamorim: has joined #ruby
[21:25:00] bsamorim: Hello, ruby community! Is anyone here a racc ninja?
[21:30:53] bsamorim: is this a dead channel, like ruby itself?
[21:41:45] bsamorim: havenwood: sorry...programming binge!
[21:41:57] bsamorim: won't happen again (:
[21:43:58] bsamorim: havenwood: basically, what I have so far is a parser that yields '4' for the expression '2+2'...and my goal is to build an AST for ruby code...so, as you can see, I'm really helpless
[21:45:07] bsamorim: I suppose my first question in this overflowed stack of mine, would be: how do I employ recursive rules?
[21:47:38] bsamorim: havenwood: Yeah, I imagine there's an AST builder implemented for ruby, but my goal is actually greater...I am working on a project that extracts information from code in arbitrary languages
[21:50:55] bsamorim: havenwood: I'm a complete noob to ruby and I was shocked to see how abandoned every project in the 'pure ruby' (ruby - rails) world is
[21:51:00] bsamorim: (no troll intended)
[21:51:18] bsamorim: Take racc itself
[21:51:41] bsamorim: The docs seem to be there just as a reminder of how lonesome existence can be
[21:53:54] bsamorim: havenwood: actually, I was impressed at how LALR parser generators are impopular in general..... I mean, for some dumb fella like me, it would be really great to just see one whose interface's input would just be a .bnf grammar
[21:54:47] bsamorim: I ain't no computer scientist! I'm just a simple country boy from texas
[21:57:14] bsamorim: yegortimoshenko: that's exactly what my genius brother recommended...but my Haskell/monads knowledge is non-existent
[21:57:51] bsamorim: do you think it can be learned without diving into category theory?
[21:58:23] bsamorim: yegortimoshenko: OK, i'll take your word for it and try some! thanks for the tip!
[22:00:38] bsamorim: yegortimoshenko: I just don't understand how you would manipulate the input stream's "head" in a stateless language like haskell
[22:01:23] bsamorim: did you learn to use parsec with its manuals, or do you have some good tutorial you could recommend?
[22:02:32] bsamorim: yegortimoshenko: Thanks very much, i'll check it out!
[22:41:43] bsamorim: Quit: Ex-Chat

2017-06-13

[01:39:41] bsamorim: has joined #ruby
[01:41:16] bsamorim: Hi guys! I've been trying to mess around a bit with ruby's bnf grammar. From the grammar file, it seems to me that the parsing is preceded by a tokenizing stage
[01:41:30] bsamorim: Does anyone know about this tokenizer?
[01:41:45] bsamorim: Does it use lex? Where is the file that defines it?
[01:44:11] bsamorim: zenspider: Yes... actually, not exactly its bnf, but rather the yacc code defined in 'parse.y'
[01:44:52] bsamorim: zenspider: :D
[01:45:16] bsamorim: do you anything about the lexer tho?
[01:46:28] bsamorim: zenspider: you know, that's the amazing thing about computers: they save you a lot of trouble, if you know how to use them :)
[01:47:38] bsamorim: Remote host closed the connection