#ruby - 14 June 2016
« Back 1 day Forward 1 day »
[00:00:58] ruby-lang342: I'm about to push the limits on my system with a 0.5G element array of BigDecimal -- wish me luck! :)
[00:31:52] mwlang: what’s the easiest way to get my public IP address with Ruby. Not my local NAT address.
[00:33:50] mwlang: nvm. Found it on SO: http://stackoverflow.com/questions/13270042/get-public-remote-ip-address
[00:39:18] fowlduck: as in, I've forked a child process and want to Process.wait but only for so long?
[00:41:22] fowlduck: and I'm concerned I'll lose the exitstatus of the reaped process if that's incorrect
[03:46:06] highbass: hey guys.. i am trying to daemonize process using "daemon" gem... there is an issue where daemon changes directory to '/' after it executes a process.. this is a problem as i need it to be run relative to the directory of execution
[03:46:36] highbass: anyone know a way (outside of me harcoding chdir "/x/y/z" where i can make it change to the appropriate directory?
[03:54:45] acidchild: hello I am struggling to get SSL forwarding working with fluentd (i've googled and asked in fluentd channel) I am getting this error message. 2016-06-14 03:53:30 +0000 [trace]: plugin/output_node.rb:347:rescue in block in connect: SSLError error_class=OpenSSL::SSL::SSLErrorWaitReadable error=#<OpenSSL::SSL::SSLErrorWaitReadable: read would block> mtime=2016-06-14 03:51:47 +0000 host="1.logs.rs.int" port=24
[03:55:02] acidchild: any advice on what OpenSSL::SSL::SSLErrorWaitReadable means would be greatful.
[05:31:35] yesthatallen: Due to circumstances beyond my control, i have ubuntu 14 servers which need to compile ruby from source on boot.
[05:32:31] yesthatallen: but, don't know what kinds of options I could add to the make configure file which might help?
[06:23:51] havenwood: yesthatallen: If you have multiple cores you could use multiple jobs for the make step: -j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
[06:25:49] havenwood: yesthatallen: It sounds like this isn't an option for you, but Brightbox maintains up-to-date Ruby packages for Ubuntu: https://www.brightbox.com/docs/ruby/ubuntu/
[08:19:05] chipotle: i am hoping my ipad air 2 is defective. i am lucky if it lasts more than 5 hours of reading in a web browser and/or dropbox and/or ibooks. i lose about 20-25% battery a day on idle. wtf gives?
[08:19:22] chipotle: i had the first retina version of the ipad and the battery life was SO much better
[08:19:43] chipotle: i have almost all background services turned off and rarely allow notificatiosn
[10:59:01] john9218: Two white convicts escape from their prison, only to find that a nigger has followed them out and is running along with them. The three of them see a few tree in the distance and they each climb up one to avoid the bloodhounds that are tracking them. When the police and dogs get to the first tree the dogs go crazy, barking and jumping. The White co
[10:59:02] john9218: nvict goes, "Meeeow," and the cops just think it is a cat stuck in a tree. So they go to the next tree where the other White convict says, "Hoo Hoo hoo Hoooo." The police figure it is just an owl in the tree. The nigger, hearing how the 2 White guys avoided capture, figures he will do the same, and when the dogs get to his tree, he lets out a loud,
[10:59:02] john9218: "Moooooooooo." So anyway, they all three get captured, and now they face the firing squad. The first White guy is standing there and as the warden says, "Ready.....Aim...." the prisoner points behind the cops and yells, "Tornado!" As the firing squad turns to look for the twister, the convict jumps over the wall and escapes. Now they have the seco
[10:59:02] john9218: nd White convict standing there. "Ready.....Aim...." He points over their shoulders and yells, "Flash flood!", and escapes as they turn to look. Now the nigger has his turn. "Ready.Aim....." Just then the nigger jumps up and points and yells, "Fire!"
[11:05:35] ruby[bot]: +bbb $a:john9218$#ruby-banned john9218!*@*$#ruby-banned *!*@gateway/web/cgi-irc/kiwiirc.com/ip.188.8.131.52$#ruby-banned
[13:09:35] mensvaga: I'm using ERB, and the 'pp' module inside of my template. There are no other external dependencies. When I run erb as root I get different output than if I run it as a regular user.
[13:14:55] mensvaga: Yeah. The only thing I can think of is the behavior of Marshal might be different.
[13:18:18] mensvaga: It's literally many data structures hard coded into a file. Copied using Marshal, and outputted.
[13:21:35] shevy: you can try hexchat, it is the inofficial successor to xchat https://hexchat.github.io/downloads.html
[13:22:37] mensvaga: apeiros: It's something that generates many nagios service checks, host definitions, and service dependencies In certain cases, it looks like information is "leaking".
[13:23:00] mensvaga: I thought I isolated all of the data structures by marshalling and unmarshalling.
[13:23:22] mensvaga: buuut, something might not be working there. I didn't check beyond 2 depths to see if the copies were true copies.
[13:28:59] mensvaga: Back when Oracle bought MySQL it wasn't hard to get yourself banned from #mysql.
[13:30:06] mensvaga: One time I said, "Just select * , and get the column names from your database driver. Your language probably has the equivalent methods to fetch the column names into an array."
[13:30:59] suchness: If I have a class with an initialize method that takes a block and instance evals it to create an instance, how can I do something like this: http://pastie.org/private/n3n8f4qzp4okrybrlvglw Right now @alpha is complaining it doesn't know what 'variables' are.
[13:35:40] apeiros: romistrub: oh, you may have *registered* your nick, you did not *authorize* your current connection, though
[13:37:27] apeiros: better yet - set up sasl-auth, that'll ensure you're identified before your client tries to join channels which require registration. (how depends on your client)
[13:41:21] romistrub: okay, I got the verification email, but when I do a /msg NickServ Info I get "romistrub has NOT COMPLETED registration verification"
[13:42:50] mensvaga: *sigh* it's my fault. But, different versions of ERB are giving me different results.
[13:44:41] mensvaga: There's the version of ERB that puppet uses on my puppet server. Then there's the version of ERB that regular users use. Then, there's the version of ERB I'm using to develop things with.
[14:05:23] raz: is there an easy way to add custom rules to rubocop? i'd like to ban ENV from our code-base (force people to use ENV.fetch)
[14:20:01] romistrub: whoo... so I'm having trouble installing mysql2 using 'sudo gem install mysql2'
[14:20:34] romistrub: here's the terminal output https://gist.github.com/anonymous/a705dd0f08879493f0856b3ffbd63382
[14:27:21] shevy: romistrub back when I used debian, one alias I used was: "aptitude install ruby1.9.1-dev; apt-get install ruby-all-dev"
[15:05:06] mensvaga: I'm using a variable inside of a loop that's "leaking" outside of the loop; and I'm using the same variable in one of the outer loops.
[15:06:48] mensvaga: I (sadly) am 4 levels deep in a loop for this one. It's a short bit of code inside the 3rd loop though.
[15:09:11] mensvaga: erb on my puppet server: erb.rb [2.1.0 2009-02-24] ; erb on my desktop: [2.1.0 2013-01-26]
[15:11:10] mensvaga: Everything is pretty modularized as it is. It's really only one step away from being thrown into classes and everything.
[15:12:24] mensvaga: I dunno. The observed behavior is definitely different though. One treated the variable with the same name in the inner loop as a variable with local scope to that loop
[15:13:05] apeiros: given that you use an erb executable, it may even be that they're not even running on the same ruby version… I have no idea whether that 2.1.0 in that version string denotes the ruby version or not…
[15:17:12] romistrub: off-topic question: how many hours a day do you spend coding or doing something related to coding?
[15:18:57] mensvaga: Yes. I have some drab in the middle about being wrong about the versions matching.
[15:22:33] mensvaga: major scoping change from one major version to the next. I might have even read about it in the past.
[15:29:57] highbass: in ruby i got something as such to get path to root of the project "pwd = File.expand_path("../..", __FILE__)"
[15:30:21] highbass: for one of my rb.. what i want to know is if its possible to capture the path from where the command is actually executing...
[15:30:40] highbass: instead of capture the path of the file being executed and hacking to get the root of the project
[15:32:14] highbass: hmm actually Dir.pwd gives the directory where the script is ... so forexample ... if i am at the root of my director say '/' and i run the following command ... ruby /test/xx.rb; .. Dir.pwd will return /test
[16:16:14] romistrub: is python more popular than Ruby? I've been looking for good Ruby books at my local bookstore and there are a dozen Python books but literally no Ruby books
[16:17:03] wrkrcoop: romistrub: ppl will disagree but it seems older people like python, python is also used at google, and its used in colleges to teach programming
[16:17:53] alfiemax: python is most widely used in scientific computing and places where ruby slows down
[16:19:09] elomatreb: Programming languages naturally evolve into their niches. Python has a lot of good statistics libraries/toolsets, ruby not so much
[16:20:13] elomatreb: fiifi: this. Also blocks feel so nice to use, even compared to languages like JS that also use something similar
[16:21:09] wrkrcoop: alfiemax: i dont mind that but it should do it for you like in Go where they use go format
[16:23:28] King_DuckZ: hi, I already know some ruby from a few years ago, and I recently learned postgresql and redis - now I'd like to try and write some simple website where you have a textbox for example and the server will store data submitted by the user, can somebody point me to some tutorial?
[17:13:25] smccarthy: I am running some tests that are written in ruby, and I noticed the logs are not getting printed to the console until AFTER the test finishes. Is there something I can look for to have it print out the logs as they come in?
[17:20:06] smccarthy: I have a Rakefile, and running the tests via a rake task. Inside of my tests, there are a lot of log.info, and I see "Logging.logger.root.appenders = Logging.appenders.stdout" as well. I just read , http://stackoverflow.com/questions/11631951/jenkins-console-output-not-in-realtime , and maybe its related
[17:20:53] norc_: smccarthy, gist some code for us to see. Also tell us which Logger class you are using, and which test suite (minitest, rspec)
[17:22:08] norc_: smccarthy, though you could try setting STDOUT.sync to true, which will force flushes each time its written to.
[18:05:40] spudowiar: I've basically got a method (which I don't control) that tries to access the instance variable `content` by `content`
[18:06:50] spudowiar: toretore: but basically, the `transform` method has the line ` converters.reduce(content) do |output, converter|`
[18:07:22] spudowiar: toretore: but the dilemma is that `content` will call `transform` which will call `content`, etc.
[18:08:32] toretore: code is many times easier to read than human language; you are making it much harder for me by not sharing code
[18:09:31] toretore: spudowiar: case in point: i have no idea without context what any of the code you're showing me here is supposed to do
[18:10:24] norc_: spudowiar, content could be a method that just happens to provide you with the object inside @content
[18:12:12] spudowiar: basically, can I have a getter that reacts differently externally from the class to internally?
[18:12:13] norc_: spudowiar, great. That is just a short cut for def a(); @a; end; def a=(o); @a = o; end
[18:13:42] norc_: spudowiar, couple it with method visibility (make it private) and you have a nice internal function.
[18:15:21] toretore: i'm not going to look through the entire jekyll repo for something i don't know where is
[18:15:42] iceden: has left #ruby: ("Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is")
[18:16:26] toretore: spudowiar: ok, so now after 100 lines of rambling i can see that part of the code. now i need to see your own code that uses this
[18:17:53] toretore: i have no context whatsoever here, and i have no idea what it is you want to do
[18:17:58] spudowiar: Because Jekyll doesn't transform layouts by default, I need the layouts transformed at a certain point (e.g. the initializer is too early)
[18:24:55] c_nick: I was looking at the old colleage notes .. and i saw the famous Star Problem __* _** *** when length given is 3 .. How i know how to get this done in C++ i am a bit confused in Ruby what do we use to set teh size in ruby
[18:32:23] toretore: spudowiar: if you want to monkeypatch Jekyll::Layout#content you just do module Jekyll; class Layout; def content; transform(@content); end; end; end
[18:33:51] toretore: so you just return from content whatever you want, and transform will take that
[18:34:38] spudowiar: toretore: and it's fine, I'll solve it by taking the method content is used from and patching that
[18:37:23] spudowiar: toretore: it's place_in_layouts in renderer.rb and I need to patch the middle of the method
[18:51:00] norc_: suchness, in Ruby a class is basically just a container for methods (and some other stuff that is not relevant for this)
[18:52:41] suchness: norc_: Haha, I am well aware. Here is my issue. I am building an extension for Prawn to detect when content is split between pages, the extention basically adds a method to the pdf class which takes a block, I am trying to figure out a way to detect what pdf class I am in without expressly passing it, given the nature of how this detection needs to be made the original class is essential.
[18:55:53] suchness: I have been to far into a metaprogramming rabbit hole today to remember the basics of just normal programming.
[19:23:12] norc_: Somehow segfaults when trying to call initialize, but who needs initialized objects anyway.
[21:38:21] ruby[bot]: ksu: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
[21:55:36] MarcWeber: No, just had old ruby in path, everytihng is fine: Even works with 2.3 :) Thanks
[22:55:06] Synthead: is there a way to call a proc with different params? proc.call(1, 2, 3) doesn't seem to work
[22:58:34] Synthead: the first param to around_perform is the job, the second is the proc that you'd supposedly call somewhere in the block
[22:59:59] Synthead: jhass: I expect the proc to be called with the param 1 if I run that_proc.call(1)
[23:00:27] Synthead: but I'm beginning to think that "perform" is called from somewhere else with other arguments and that it's actually a RoR framework question
[23:01:16] Synthead: like there's an *args in whatever is getting called from the proc, and those args aren't used in calling perform
[23:06:18] jhass: Synthead: https://github.com/rails/rails/blob/77c0256409d48c23b0b208f95191973e8c1dfd7f/activejob/lib/active_job/execution.rb#L31
[23:09:26] jhass: Synthead: https://github.com/rails/rails/blob/77c0256409d48c23b0b208f95191973e8c1dfd7f/activejob/lib/active_job/core.rb#L7
[23:10:00] Synthead: jhass: yeah I could ... starting to encroach into code smell territory though, I think