Page 1 of 1
[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:52:01] bsamorim: i guess that Ruby is one of those languages that can yield very bad code if abused
[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"
[18:00:01] bsamorim: The only oddity about my installation is that I'm running every command as the root user.
[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:52:18] bsamorim: If I fire up the method once again, the memory eventually goes down, and then back up again
[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
[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:35:55] bsamorim: apeiros: it doesn't, but it certainly helps to enable these operations to be thread-safe by default
[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
[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"'?
[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'?
[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: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: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
[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:12:31] bsamorim: yep, worked like a charm! thanks, man! I've never used instance_eval, though. How hacky is it?
[15:22:58] bsamorim: Hi, guys! Could anyone tell me which unit is used in ObjectSpace.memsize_of(obj) 's return value?
[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`
[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:44:00] bsamorim: I am opening the file with `open(file_path)` and yielding its chunks with `read(chunk_size)`
[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: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:57:14] bsamorim: yegortimoshenko: that's exactly what my genius brother recommended...but my Haskell/monads knowledge is non-existent
[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?
[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:44:11] bsamorim: zenspider: Yes... actually, not exactly its bnf, but rather the yacc code defined in 'parse.y'
[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 :)