« Back to channel list

#ruby - 15 December 2015

« Back 1 day Forward 1 day »
[00:00:24] whiteline: has joined #ruby
[00:00:52] jgt3: has joined #ruby
[00:03:42] jdelaney: has joined #ruby
[00:06:24] Ropeney: has joined #ruby
[00:07:51] devbug: has joined #ruby
[00:08:20] shevy: hmm if you build commandline apps in ruby
[00:08:29] shevy: how many help-options would you want to display at maximum?
[00:09:02] shevy: for instance, "gem help" has split things up a lot
[00:09:19] shevy: http://pastie.org/pastes/10632980/text
[00:09:46] shevy: "gem help commands" shows more information
[00:10:08] shevy: http://pastie.org/pastes/10632981/text
[00:10:45] shevy: hmm first time I am noticing "gem stale"
[00:11:01] tulak: has joined #ruby
[00:11:42] arescorpio: has joined #ruby
[00:14:11] ellisTAA: when i define a new tree and call look_for_word it says ???10:in `block (2 levels) in create_first_children': wrong number of arguments (1 for 0) (ArgumentError)??? but i can???t figure out what???s wrong ??? https://gist.github.com/ellismarte/02687f16f0565da6ad02#file-trie-rb-L62-L64
[00:14:32] claw: has joined #ruby
[00:16:11] dlitvak: has joined #ruby
[00:17:34] Yzguy: has joined #ruby
[00:18:49] shevy: you must have omitted information
[00:18:56] ascarter: has joined #ruby
[00:19:10] shevy: self.class.send(:define_method, character) { return Node.new(:value => character) }
[00:19:40] shevy: so this method accepts zero arguments
[00:20:26] jpfuentes2: has joined #ruby
[00:22:03] shevy: you can use .instance_eval or .class_eval rather than .send there
[00:22:06] zeroDivisible: has joined #ruby
[00:22:53] rikai: has joined #ruby
[00:23:27] ellisTAA: shevy: thanks ??? that???s weird bc i thought that method was working ???
[00:23:53] TomPeed: has joined #ruby
[00:24:41] shanemcd: has joined #ruby
[00:24:52] DavidDudson: has joined #ruby
[00:24:57] ellisTAA: shevy: on line ten i???m trying to define a new method called whatever character corresponds to e.g. g or h
[00:25:29] shevy: ellistaa http://stackoverflow.com/questions/89650/how-do-you-pass-arguments-to-define-method
[00:26:17] ellisTAA: shevy: i dont want to pass any arguments to the method though
[00:26:18] kmckelvin: has joined #ruby
[00:27:07] ellisTAA: this returns an instance of Node https://gist.github.com/ellismarte/02687f16f0565da6ad02#file-trie-rb-L64 so i think that line is working ???
[00:27:21] shevy: wrong number of arguments (1 for 0)
[00:27:27] shevy: you say you don't want to pass any arguments to the method
[00:27:31] shevy: but your code says otherwise
[00:28:15] shevy: does that code error?
[00:28:25] shevy: I get this output
[00:28:27] shevy: "the word hello does not exist in our dictionary"
[00:28:27] shevy: #<Node:0x8ae542c @value="h", @word=nil>
[00:28:29] ablemike: has joined #ruby
[00:28:31] davedev24: has joined #ruby
[00:28:42] ablemike: has left #ruby: ()
[00:28:48] ellisTAA: yeah that???s what i get, so doesn???t that mean the line is working
[00:29:01] shevy: in the code you showed above yes
[00:29:08] shevy: so how can you get the error with the same code ;)
[00:30:34] ellisTAA: calling that line from somewhere where i pass an argument??? i???m wondering if line 19 is causing problems
[00:31:14] duckpuppy: has joined #ruby
[00:32:09] ElFerna: has joined #ruby
[00:34:07] ornerymoose: has joined #ruby
[00:34:14] shevy: so will you upload the full code that has the error too
[00:34:41] f00bar-32: has joined #ruby
[00:35:42] mclong: has joined #ruby
[00:36:35] ellisTAA: shevy: that is the whole thing. https://gist.github.com/ellismarte/02687f16f0565da6ad02 im thinking maybe the error is caused by calling self.send(character) on line 34
[00:37:04] pwnd_nsfw: has joined #ruby
[00:37:43] ellisTAA: yeah i???m pretty sure the problem is with self.send(character)
[00:37:58] claw: has joined #ruby
[00:40:16] shevy: why do you even use .send there
[00:41:52] shevy: what argument do you send to define_method
[00:42:16] shevy: you use .send
[00:42:16] ellisTAA: one line 10 or 34?
[00:42:23] shevy: your code confuses me :)
[00:42:30] ellisTAA: i know its ugly : \
[00:42:47] ellisTAA: i need to write better code
[00:43:10] baweaver: learn and use hash
[00:43:18] shevy: ellistaa get rid of "p" and try again
[00:43:19] baweaver: define_method and send do not exist
[00:43:45] baweaver: metaprogramming is a bad idea until you have basics down better.
[00:43:50] baweaver: it adds to confusion
[00:44:00] shevy: ellistaa this code works: http://pastie.org/pastes/10633012/text you invoke the wrong .p() method; there also exists Kernel#p
[00:44:35] ellisTAA: shevy: invoke it where?
[00:44:50] shevy: when you call create_first_children
[00:45:02] shevy: just copy the code in the link I gave above into your editor, run it
[00:45:07] shevy: then you see that the only letter missing is p
[00:45:15] shevy: so it's the method p() that confuses there
[00:45:41] akem: has joined #ruby
[00:46:12] ellisTAA: shevy: so u turned the character into a symbol?
[00:46:52] shevy: no ellistaa
[00:47:01] shock_one: has joined #ruby
[00:47:02] baweaver: >> h = Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) }; h[1][2][3][4] = 5; h
[00:47:03] ruboto: baweaver # => {1=>{2=>{3=>{4=>5}}}} (https://eval.in/485151)
[00:47:03] shevy: I just played around with it, ignore the .to_sym
[00:47:15] shevy: ellistaa did you not read what I wrote the last 20 times :P
[00:47:26] ellisTAA: shevy: i did
[00:47:34] shevy: did you run that code!
[00:47:46] DLSteve: has joined #ruby
[00:48:03] AnoHito: has joined #ruby
[00:48:28] ellisTAA: yeah it worked
[00:49:52] ellisTAA: wait but it looks like its creating symbols instead of nodes?
[00:50:28] shevy: you need to learn how to walk before you learn how to run
[00:52:04] baweaver: ellistaa: metaprogramming does not exist for you, don't use it. It's insidiously complicated to debug at times and not something someone learning should be using. You'll notice it's exceptionally rare in most pro production code as well.
[00:52:36] Feyn: has joined #ruby
[00:52:42] pawnbox: has joined #ruby
[00:52:59] ellisTAA: baweaver: doesn???t seem that hard
[00:53:29] armel1: has joined #ruby
[00:53:31] neanderslob: has joined #ruby
[00:54:25] ur5us: has joined #ruby
[00:54:26] ElFerna: has joined #ruby
[00:54:43] baweaver: you're making things unnecessarily complicated for the sake of using it instead of learning the basics. That's what insidiously complicated means
[00:54:51] baweaver: it appears deceptively easy
[00:55:03] dlitvak_: has joined #ruby
[00:55:19] baweaver: which it is, assuming you have a grasp of the basics
[00:55:30] baweaver: and its tested thoroughly.
[00:55:42] synthroid: has joined #ruby
[00:55:43] ellisTAA: so why won???t the code work
[00:55:57] baweaver: you said it doesn't seem hard
[00:56:31] ellisTAA: it doesn???t, that doesn???t mean there???s something i dont understand
[00:56:52] ElFerna: has joined #ruby
[00:56:59] ellisTAA: i might not know how to make bread but i wouldn???t say its hard
[00:57:40] baweaver: look into path explosion and implosion
[00:57:51] baweaver: it's dramatically simpler, cleaner, and easier to understand
[00:58:08] kerframil: has joined #ruby
[00:58:38] ellisTAA: err thanks ill check it out
[00:58:41] baweaver: the only difference is this has no delimiter whereas typical explosion/implosion problems use '.'
[01:02:17] jhooker: has joined #ruby
[01:07:08] devoldmx: has joined #ruby
[01:07:57] claw: has joined #ruby
[01:10:11] akem: has joined #ruby
[01:11:37] jbrhbr: has joined #ruby
[01:14:20] Mojo_Nixon: has joined #ruby
[01:15:43] seitensei: has joined #ruby
[01:16:35] mchu: has joined #ruby
[01:16:40] s00pcan: has joined #ruby
[01:17:10] rdavila: has joined #ruby
[01:17:27] rakm: has joined #ruby
[01:19:33] rakm_: has joined #ruby
[01:20:23] rkazak__: has joined #ruby
[01:21:53] graffix222: has joined #ruby
[01:22:29] Yzguy: has joined #ruby
[01:24:43] akem2: has joined #ruby
[01:24:57] sucks: has joined #ruby
[01:27:01] kmckelvin: has joined #ruby
[01:27:17] houhoulis: has joined #ruby
[01:28:29] Mirry: has joined #ruby
[01:32:00] duckpuppy: has joined #ruby
[01:32:18] hxegon: has joined #ruby
[01:32:27] domoremath: has joined #ruby
[01:36:02] claw: has joined #ruby
[01:37:06] CrazyEddy: has joined #ruby
[01:37:21] mclong: has joined #ruby
[01:37:44] ellisTAA: does anyone know why line 27 is giving me ???undefined method `create_new_child' for :e:Symbol (NoMethodError)??? https://gist.github.com/ellismarte/02687f16f0565da6ad02
[01:38:43] havenwood: ellistaa: Because the last element of `path` is the Symbol `:e`, which doesn't respond to #create_new_child.
[01:40:12] ellisTAA: havenwood: thanks i really appreciate that .. thought that couldn???t be it
[01:40:42] baweaver: it says it is
[01:41:42] colegatron: has joined #ruby
[01:41:45] DrCode: has joined #ruby
[01:42:10] ellisTAA: baweaver: thanks
[01:42:28] jessemcgilallen: has joined #ruby
[01:42:39] gusTester: has joined #ruby
[01:43:37] snguyen: has joined #ruby
[01:45:44] jessemcgilallen: has joined #ruby
[01:45:46] howdoicomputer: has joined #ruby
[01:45:51] snguyen: has joined #ruby
[01:47:45] Yzguy: has joined #ruby
[01:48:05] pawnbox: has joined #ruby
[01:48:07] baweaver: ellistaa: http://stackoverflow.com/questions/7139471/transform-a-ruby-hash-into-a-dotted-path-key-string
[01:49:13] goodcodeguy: has joined #ruby
[01:49:40] ellisTAA: has joined #ruby
[01:49:55] bronson: has joined #ruby
[01:49:59] jhooker: has joined #ruby
[01:50:06] baweaver: anyways, off for the night I go.
[01:50:50] ellisTAA: aw didn???t get to say thanks
[01:53:04] Arnvald: has joined #ruby
[01:55:18] mclong: has joined #ruby
[01:55:57] colleenmcguckin: has joined #ruby
[01:56:09] Yzguy: has joined #ruby
[01:56:56] dimasg: has joined #ruby
[01:57:08] gregf: has joined #ruby
[02:00:21] workmad3: has joined #ruby
[02:00:33] icarus_: has joined #ruby
[02:02:47] dlitvak: has joined #ruby
[02:04:52] mclong: has joined #ruby
[02:06:07] nerium: has joined #ruby
[02:06:35] nerium: Any recommendations on alteritves to RestClient and the http gem?
[02:06:43] tokik: has joined #ruby
[02:07:19] havenwood: nerium: I'd generally recommend http.rb: https://github.com/httprb/http#readme
[02:07:47] nerium: havenwood: It tries to parse the response as json, which I can???t figure out how to turn off
[02:08:14] havenwood: nerium: What type of response do you want to accept?
[02:08:25] TomPeed: has joined #ruby
[02:09:08] hagabaka: has joined #ruby
[02:09:16] nerium: havenwood: Anything, but it should not be processed
[02:11:25] Sigma00: has joined #ruby
[02:12:00] havenwood: nerium: Err, are you sure you're talking the same gem I linked?
[02:12:37] nomadic: has joined #ruby
[02:12:41] havenwood: nerium: Oh, you mean RestClient? Nvm.
[02:15:24] minimalism: has joined #ruby
[02:15:52] lguardiola: has joined #ruby
[02:16:51] akem: has joined #ruby
[02:19:14] devoldmx: has joined #ruby
[02:19:33] livcd: has joined #ruby
[02:19:36] goodcodeguy: has joined #ruby
[02:20:06] chipotle: has joined #ruby
[02:20:10] havenwood: nerium: There are many other good options if you have anything specific you're looking for.
[02:21:02] nerium: havenwood: I think anything would work
[02:21:28] bithon: has joined #ruby
[02:22:30] havenwood: nerium: Give HTTP.rb a shot. :)
[02:22:53] nerium: havenwood: I???ll give it a try, thanks
[02:23:24] f00bar-32: has joined #ruby
[02:25:39] framling: has joined #ruby
[02:25:50] devoldmx_: has joined #ruby
[02:26:04] dlitvak: has joined #ruby
[02:26:28] Arnvald: has joined #ruby
[02:27:47] kmckelvin: has joined #ruby
[02:28:25] havenwood: nerium: (HTTParty is the only one I know with automatic parsing.)
[02:29:37] bithon: has joined #ruby
[02:29:40] ellisTAA: has joined #ruby
[02:30:03] B1n4r10: has joined #ruby
[02:31:27] bithon: has left #ruby: ("Frodo wait for me!")
[02:31:31] bithon: has joined #ruby
[02:32:50] duckpuppy: has joined #ruby
[02:33:26] xdc: has joined #ruby
[02:33:44] f00bar-32: has joined #ruby
[02:33:55] Arnvald: has joined #ruby
[02:34:19] hully: has joined #ruby
[02:34:23] bithon: has left #ruby: ("Frodo wait for me!")
[02:34:29] BlackCoyote: has joined #ruby
[02:34:30] bithon: has joined #ruby
[02:34:38] bithon: has left #ruby: ("Frodo wait for me!")
[02:34:47] s2013: has joined #ruby
[02:34:56] ElFerna: has joined #ruby
[02:39:03] rideh: has joined #ruby
[02:40:00] ascarter: has joined #ruby
[02:41:24] devoldmx: has joined #ruby
[02:45:47] goodcodeguy: has joined #ruby
[02:45:57] skcin7: has joined #ruby
[02:46:05] nocd: has joined #ruby
[02:47:09] Qantourisc: has joined #ruby
[02:49:48] goodcodeguy: has joined #ruby
[02:50:09] devoldmx: has joined #ruby
[02:50:49] celly: has joined #ruby
[02:52:14] snguyen: has joined #ruby
[02:52:20] auzty: has joined #ruby
[02:53:49] StevenXL: has joined #ruby
[02:53:50] StevenXL: has joined #ruby
[02:54:27] goodcodeguy: has joined #ruby
[02:54:31] snguyen: has joined #ruby
[02:55:25] celly: /msg NickServ SETPASS celly obkcuoywndig 4596valleyparkway
[02:55:34] devoldmx: has joined #ruby
[02:56:08] celly: /msg NickServ SETPASS celly obkcuoywndig 4596valleyparkway
[02:57:00] julian-delphiki: i'd recommend you not using that password now
[02:57:08] celly: am i failing over here?
[02:57:12] celly: it's not letting me use it anyway
[02:57:20] julian-delphiki: you had a space in front of your query.
[02:57:21] celly: this shit is so frustrating
[02:57:48] julian-delphiki: IRC is not frusturating... it's old and easy to use :)
[02:57:55] devoldmx_: has joined #ruby
[02:59:09] celly: i'm sure i'll forget this password (again) and need to reset it (again)
[02:59:36] celly: i don't sign on here enough, so i ALWAYS forget my password. tried to make it generic last time, but clearly, i couldn't remember it then
[02:59:48] howdoicomputer: has joined #ruby
[03:01:09] julian-delphiki: celly, you could always just set up your client to send it for you when you connect
[03:01:09] celly: by any chance, have you used or are using hstore with simple_form?
[03:01:40] celly: @julian-delphiki, i'll poke around and give that a shot. i'm using LimeChat
[03:08:16] ornerymoose: has joined #ruby
[03:08:53] htmldrum: has joined #ruby
[03:12:06] arescorpio: has joined #ruby
[03:13:00] skcin7: has joined #ruby
[03:13:39] Lildirt: has joined #ruby
[03:16:55] ElFerna: has joined #ruby
[03:18:45] shock_one: has joined #ruby
[03:19:03] devbug: has joined #ruby
[03:19:48] DiCablo: has joined #ruby
[03:20:06] rideh: has joined #ruby
[03:20:34] blackjid: has joined #ruby
[03:21:06] Bloomer: has joined #ruby
[03:22:59] StevenXL: has joined #ruby
[03:23:00] StevenXL: has joined #ruby
[03:23:02] nateberkopec: has joined #ruby
[03:23:16] rideh: has joined #ruby
[03:24:09] akem: has joined #ruby
[03:24:28] freerobby: has joined #ruby
[03:26:12] akem: has joined #ruby
[03:28:32] kmckelvin: has joined #ruby
[03:30:25] Lildirt: has joined #ruby
[03:32:47] goodcodeguy: has joined #ruby
[03:33:31] duckpuppy: has joined #ruby
[03:34:18] solenoids: has joined #ruby
[03:36:02] jbrhbr: has joined #ruby
[03:40:33] saddad: has joined #ruby
[03:41:55] wnd: has joined #ruby
[03:42:22] PaulCapestany: has joined #ruby
[03:43:16] Lildirt: has joined #ruby
[03:45:07] bronson: has joined #ruby
[03:46:28] houhoulis: has joined #ruby
[03:47:37] nocd: has left #ruby: ()
[03:48:34] RobertBirnie: has joined #ruby
[03:49:06] kfpratt: celly: unsolicited help: press command+u and you'll find the server settings for whatever server the channel that you're currently in. Once there you'll see the general tab where you can enter your nick and password. It will identify you on connection from then on.
[03:50:46] ornerymoose: has joined #ruby
[03:51:30] celly: @kfpratt: thanks man, you rock
[03:54:10] ascarter: has joined #ruby
[03:54:58] krz: has joined #ruby
[03:56:58] B1n4r10: has joined #ruby
[03:57:30] wolffles: has joined #ruby
[04:00:53] shanemcd: has joined #ruby
[04:02:52] djbkd: has joined #ruby
[04:04:06] tvon: has joined #ruby
[04:04:27] htmldrum: has joined #ruby
[04:05:48] dimasg: has joined #ruby
[04:07:12] cwong_on_irc: has joined #ruby
[04:07:36] cwong_on_irc: has joined #ruby
[04:08:02] devbug: has joined #ruby
[04:09:55] htmldrum: has joined #ruby
[04:11:27] zast: has joined #ruby
[04:12:44] rakm: has joined #ruby
[04:13:13] bronson: has joined #ruby
[04:16:23] mary5030: has joined #ruby
[04:16:36] braincrash: has joined #ruby
[04:17:51] ellisTAA: has joined #ruby
[04:18:50] synthroid: has joined #ruby
[04:21:10] shock_one: has joined #ruby
[04:22:50] DavidDudson: has joined #ruby
[04:24:08] RobertBirnie: has joined #ruby
[04:26:00] gix: has joined #ruby
[04:26:27] framling: has joined #ruby
[04:26:31] RickHull: has joined #ruby
[04:27:04] pawnbox: has joined #ruby
[04:27:09] sirecote_: has joined #ruby
[04:29:17] kmckelvin: has joined #ruby
[04:29:31] dlitvak: has joined #ruby
[04:29:43] araujo: has joined #ruby
[04:29:44] araujo: has joined #ruby
[04:30:27] nateberkopec: has joined #ruby
[04:30:28] epochwolf: has joined #ruby
[04:30:32] ornerymoose: has joined #ruby
[04:34:53] dlitvak: has joined #ruby
[04:35:57] iateadonut: has joined #ruby
[04:38:37] agent_white: has joined #ruby
[04:39:37] pulgolino: has joined #ruby
[04:41:36] ledestin: has joined #ruby
[04:44:42] devbug: has joined #ruby
[04:50:29] Lildirt: has joined #ruby
[04:53:38] dopie: has joined #ruby
[04:58:04] berserk_ren: has joined #ruby
[04:59:10] Lildirt: has joined #ruby
[05:02:19] TheBloke-: has joined #ruby
[05:03:46] Suntzu: has joined #ruby
[05:04:03] s00pcan: has joined #ruby
[05:04:59] bronson: has joined #ruby
[05:05:23] s00pcan: has joined #ruby
[05:05:44] bungoman: has joined #ruby
[05:05:46] i: has joined #ruby
[05:05:54] kiez0rd: has joined #ruby
[05:06:06] dopie: has joined #ruby
[05:07:00] pawnbox: has joined #ruby
[05:10:26] tenzan: has joined #ruby
[05:11:01] ascarter: has joined #ruby
[05:12:18] pdoherty: has joined #ruby
[05:16:49] edwinvdgraaf: has joined #ruby
[05:18:37] Yzguy: has joined #ruby
[05:22:25] shock_one: has joined #ruby
[05:23:24] colegatron: has joined #ruby
[05:26:24] dlitvak: has joined #ruby
[05:26:40] techsethi: has joined #ruby
[05:27:15] ascarter: has joined #ruby
[05:28:56] dmcp: has joined #ruby
[05:30:05] kmckelvin: has joined #ruby
[05:30:20] pawnbox: has joined #ruby
[05:31:13] nateberkopec: has joined #ruby
[05:31:58] tenderlove: has joined #ruby
[05:32:39] newdan: has joined #ruby
[05:34:02] newdan: Is there a method to match a regex only at a certain index? E.g. ideally /foo/.strict_match('ofoo', 0) => nil; /foo/.strict_match('ofoo', 1) => MatchData
[05:34:22] blackgoat: has joined #ruby
[05:37:05] krz: has joined #ruby
[05:37:59] celly: has joined #ruby
[05:38:41] astrobun_: has joined #ruby
[05:39:00] krz: has joined #ruby
[05:44:15] lkba: has joined #ruby
[05:46:10] bbert: has joined #ruby
[05:46:11] bbert: has joined #ruby
[05:48:33] lannonbr: has joined #ruby
[05:48:45] RickHull: newdan: probably better to restrict your input string ('ofoo') according to the index
[05:48:51] RickHull: that is, only send 'foo'
[05:49:02] RickHull: but i'm assuming this isn't helpful, and that your example was crafted around this
[05:49:11] lannonbr: Question, is there a simple algorithm that splits a single number into n numbers that add up to the initial number?
[05:49:23] dionysus69: has joined #ruby
[05:49:48] RickHull: lannonbr: there are an infinite number of ways to do that
[05:49:58] RickHull: e.g. 0 + 0 + 0 + number
[05:50:15] RickHull: 1 + 1 + 1 + number - 3
[05:51:23] lannonbr: Oh I forgot, is there a way to randomly do that?
[05:51:41] RickHull: in stdlib, probably not
[05:51:48] lannonbr: Wait, I think I might have an idea
[05:51:52] RickHull: you can write a fn to do it
[05:52:00] lannonbr: yea I'm going to do that now
[05:52:00] RickHull: with random numbers
[05:52:06] mary5030: has joined #ruby
[05:52:21] uglybandersnatch: has joined #ruby
[05:52:28] uglybandersnatch: has left #ruby: ()
[05:54:05] psye: has joined #ruby
[05:54:44] SylarRuby: has joined #ruby
[05:56:20] ascarter: has joined #ruby
[05:56:56] revengeofbigd: has joined #ruby
[05:56:58] lannonbr: I basically got it, I just have to fix a few kinks
[05:57:50] hagabaka: lannonbr: are you doing adventofcode by any chance?
[05:58:49] hagabaka: this one is such a leap in difficulty
[05:58:58] lannonbr: Is there a better way to do day 15 other than brute force the proportions?
[05:58:58] havenwood: which day is it?
[05:59:11] stannard: has joined #ruby
[05:59:17] hagabaka: I think it's "linear programming", but I don't really get it
[05:59:44] lannonbr: Well I got the back end of calculating the total, just finding the proportions it what I am stuck at right now
[06:00:46] hagabaka: I think there are 10s of millions of combinations to brute force, and just thinking of a algorithm to generate them hurts my head too
[06:00:47] B1n4r10: has joined #ruby
[06:01:05] lannonbr: 100 million different combinations
[06:01:13] lannonbr: Good thing computers are fast
[06:01:19] bronson: has joined #ruby
[06:02:12] ur5us: has joined #ruby
[06:02:24] lannonbr: 9 and 13 were also brute force, but this is much more difficult
[06:02:38] charliesome: has joined #ruby
[06:08:41] ur5us: has joined #ruby
[06:13:08] hagabaka: I think you could brute force like 0.upto(100) {|a| 0.upto(100 -a) {|b| ... d = 100 - a - b - c; score(a, b, c, d)
[06:13:11] lannonbr: Well I just wrote a 4-deep (0..100).each do |i|... thing
[06:14:56] leat: has joined #ruby
[06:17:08] darkf: has joined #ruby
[06:17:43] lannonbr: At first I had no idea how to do this, but I just finished part 2. It's challenging to understand
[06:17:59] msankhala: has joined #ruby
[06:19:30] hagabaka: yeah I guess it's still very brute-forceable
[06:21:25] A5101: has joined #ruby
[06:23:05] shock_one: has joined #ruby
[06:24:26] Arnvald: has joined #ruby
[06:24:43] EvilDMP: has joined #ruby
[06:25:02] SOLDIERz: has joined #ruby
[06:25:16] pawnbox: has joined #ruby
[06:28:54] techsethi: has joined #ruby
[06:28:54] arooni: has joined #ruby
[06:29:05] niatehiggers: has joined #ruby
[06:30:26] saddad: has joined #ruby
[06:30:29] charliesome: has joined #ruby
[06:30:54] kmckelvin: has joined #ruby
[06:31:58] nateberkopec: has joined #ruby
[06:32:59] aufi: has joined #ruby
[06:33:29] aganov: has joined #ruby
[06:34:17] tenzan: has joined #ruby
[06:34:22] phantummm: has joined #ruby
[06:34:53] pawnbox: has joined #ruby
[06:35:44] duckpuppy: has joined #ruby
[06:36:00] steffkes: has joined #ruby
[06:36:01] steffkes: has joined #ruby
[06:36:46] ja: is there a cleaner way to get `[:foo, :bar].map { |a| [a, nil] }.to_h`?
[06:37:26] csaunders: has joined #ruby
[06:38:45] havenwood: >> [:foo, :bar].each_with_object(nil).to_h
[06:38:46] ruboto: havenwood # => {:foo=>nil, :bar=>nil} (https://eval.in/485231)
[06:39:12] trautwein: has joined #ruby
[06:39:19] ja: nice! I don't think I've ever seen #each_with_object before
[06:39:22] ja: thanks a lot, havenwood
[06:39:30] ja: that's pretty amazing
[06:42:26] tagrudev: has joined #ruby
[06:43:49] niatehiggers: GOODBYE NIGGER =D
[06:44:51] techsethi: has joined #ruby
[06:46:02] hagabaka: >> [:foo, :bar].zip([]).to_h
[06:46:03] ruboto: hagabaka # => {:foo=>nil, :bar=>nil} (https://eval.in/485232)
[06:46:27] dlitvak: has joined #ruby
[06:47:36] ja: O_O oh! of course, `#zip`!
[06:47:49] ja: I kinda thinks `each_with_object(nil)` reads better though
[06:47:52] ja: but I dunno
[06:48:20] ja: `@remote_attributes = @resource.attribute_names.keys.each_with_object(nil).to_h` could use some shortening however >.>
[06:49:57] hagabaka: >> [:foo, :bar].product([nil]).to_h
[06:49:58] ruboto: hagabaka # => {:foo=>nil, :bar=>nil} (https://eval.in/485233)
[06:50:13] Polysics_: has joined #ruby
[06:51:06] trautwein: has joined #ruby
[06:51:29] ChanServ: +o havenwood
[06:54:13] lxsameer: has joined #ruby
[06:54:36] astrobun_: has joined #ruby
[06:55:26] ruboto: -o ruboto
[06:55:37] ChanServ: -o havenwood
[06:57:01] codecop: has joined #ruby
[06:57:10] ascarter: has joined #ruby
[06:57:38] zast: has joined #ruby
[06:58:28] newdan: has left #ruby: ()
[07:00:16] blub: hi flughafen
[07:00:34] havenwood: flughafen: g'morn
[07:00:36] celly: has joined #ruby
[07:01:03] ja: interesting, hagabaka
[07:01:09] ja: and thanks
[07:01:28] ja: now I have too many solutions to choose from ^_^
[07:01:38] deeprave_: has joined #ruby
[07:01:58] phantummm: has joined #ruby
[07:02:15] hagabaka: hope one day there will be something like Hash#map_values
[07:02:28] celly: has joined #ruby
[07:03:44] ja: yeah, as do I
[07:03:47] havenwood: hagabaka: In the meanwhile: class Hash; def map_value; each_with_object({}) { |(k, v), h| h[k] = yield(v) } end end
[07:03:53] ja: that was actually the first method name that popped into my mind
[07:04:18] celly: has joined #ruby
[07:04:47] flughafen: hey blub havenwood !
[07:06:00] howdoicomputer: has joined #ruby
[07:06:09] dlitvak: has joined #ruby
[07:06:13] celly: has joined #ruby
[07:07:15] Dimik: has joined #ruby
[07:07:18] ja: how niftily tight, havenwood
[07:07:32] hagabaka: oh, each_with_object is kind of like inject in how you use it
[07:08:05] celly: has joined #ruby
[07:08:42] ja: ACTION needs to think with higher-order functions more
[07:10:01] celly: has joined #ruby
[07:11:05] ja: is there a #ruby-code-review or something I can go to?
[07:11:42] havenwood: ja: This is a good place when folk are around.
[07:11:51] celly: has joined #ruby
[07:13:47] celly: has joined #ruby
[07:14:21] RickHull: has left #ruby: ()
[07:15:37] celly: has joined #ruby
[07:17:33] celly: has joined #ruby
[07:19:04] juddey: has joined #ruby
[07:19:27] celly: has joined #ruby
[07:19:29] Pupp3tm4st3r: has joined #ruby
[07:21:13] yardenbar: has joined #ruby
[07:21:18] celly: has joined #ruby
[07:21:24] ur5us: has joined #ruby
[07:21:41] InvGhost: has joined #ruby
[07:22:22] ja: havenwood: Nice. I???ll definitely try that at a later time where I???m more awake.
[07:23:08] celly: has joined #ruby
[07:23:52] shock_one: has joined #ruby
[07:24:39] ja: ACTION needs Hash#map_value again already ^_^
[07:24:43] djbkd: has joined #ruby
[07:25:03] celly: has joined #ruby
[07:26:58] celly: has joined #ruby
[07:28:49] celly: has joined #ruby
[07:30:30] troys: has joined #ruby
[07:30:41] celly: has joined #ruby
[07:31:38] kmckelvin: has joined #ruby
[07:32:33] celly: has joined #ruby
[07:32:43] nateberkopec: has joined #ruby
[07:34:29] scepticulous: has joined #ruby
[07:34:30] celly: has joined #ruby
[07:36:06] baweaver: has joined #ruby
[07:36:23] celly: has joined #ruby
[07:36:33] duckpuppy: has joined #ruby
[07:36:57] firstdayonthejob: has joined #ruby
[07:37:20] shock_one: has joined #ruby
[07:38:15] celly: has joined #ruby
[07:38:31] boxofrox: has joined #ruby
[07:40:08] solars: has joined #ruby
[07:40:10] celly: has joined #ruby
[07:40:46] krzkrz: has joined #ruby
[07:41:59] celly: has joined #ruby
[07:42:03] kmckelvin: has joined #ruby
[07:42:54] ibouvousaime: has joined #ruby
[07:43:55] celly: has joined #ruby
[07:45:05] kies: has joined #ruby
[07:45:45] celly: has joined #ruby
[07:45:59] iateadonut: has joined #ruby
[07:47:05] seitensei: has joined #ruby
[07:47:05] seitensei: has joined #ruby
[07:47:38] celly: has joined #ruby
[07:47:45] gaiada: has joined #ruby
[07:49:31] celly: has joined #ruby
[07:49:32] B1n4r10: has joined #ruby
[07:50:36] astrobun_: has joined #ruby
[07:51:27] celly: has joined #ruby
[07:53:19] celly: has joined #ruby
[07:55:12] celly: has joined #ruby
[07:56:42] steffkes: has joined #ruby
[07:56:43] steffkes: has joined #ruby
[07:57:06] celly: has joined #ruby
[07:58:56] celly: has joined #ruby
[08:00:51] celly: has joined #ruby
[08:01:06] edwinvdgraaf: has joined #ruby
[08:01:36] skade: has joined #ruby
[08:02:27] dlitvak: has joined #ruby
[08:02:45] celly: has joined #ruby
[08:03:26] rattatmatt: has joined #ruby
[08:03:36] anisha: has joined #ruby
[08:03:56] jas02: has joined #ruby
[08:04:36] celly: has joined #ruby
[08:04:56] M-prosodyContext: has joined #ruby
[08:04:57] M-mistake: has joined #ruby
[08:05:12] shock_one: has joined #ruby
[08:06:29] celly: has joined #ruby
[08:07:41] charliesome: has joined #ruby
[08:07:59] howdoicomputer: has joined #ruby
[08:08:21] celly: has joined #ruby
[08:09:54] Puffball: has joined #ruby
[08:10:17] celly: has joined #ruby
[08:12:08] celly: has joined #ruby
[08:13:41] TomyWork: has joined #ruby
[08:14:01] celly: has joined #ruby
[08:14:18] M-Kodo: has joined #ruby
[08:15:15] null__: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[08:15:34] ibouvousaime: has joined #ruby
[08:15:54] celly: has joined #ruby
[08:15:58] boxofrox: has joined #ruby
[08:17:46] celly: has joined #ruby
[08:18:44] M-shine: has joined #ruby
[08:19:21] devoldmx: has joined #ruby
[08:19:41] celly: has joined #ruby
[08:19:56] pbw: has joined #ruby
[08:20:55] calderonroberto: has joined #ruby
[08:21:35] celly: has joined #ruby
[08:22:08] Puffball: has joined #ruby
[08:25:51] DeXterbed: has joined #ruby
[08:26:29] Phage: has joined #ruby
[08:30:15] Munim: has joined #ruby
[08:31:24] Munim: Anyone here? I need some advise regarding setting up thin on my servers to handle live seamless reloads.
[08:33:30] nateberkopec: has joined #ruby
[08:34:01] monthy: has joined #ruby
[08:34:51] blackms: has joined #ruby
[08:35:27] dlitvak: has joined #ruby
[08:35:41] yfeldblum: has joined #ruby
[08:36:06] vasilakisFiL: has joined #ruby
[08:37:00] DavidDudson: has joined #ruby
[08:37:14] duckpuppy: has joined #ruby
[08:37:17] jbrhbr: has joined #ruby
[08:38:08] vasilakisfil_: has joined #ruby
[08:38:09] kmckelvin: has joined #ruby
[08:38:19] s2013: has joined #ruby
[08:39:26] Hounddog: has joined #ruby
[08:39:35] rdark: has joined #ruby
[08:40:03] chthon: has joined #ruby
[08:40:17] rdark: has joined #ruby
[08:40:45] dionysus69: has joined #ruby
[08:41:28] snowy: has joined #ruby
[08:44:05] chthon: has joined #ruby
[08:44:55] mark3: has joined #ruby
[08:52:00] flughafen: hey adaedra
[08:52:38] blaxter: has joined #ruby
[08:54:18] boxofrox: has joined #ruby
[08:56:12] techsethi: has joined #ruby
[08:56:51] wmdrossard: has joined #ruby
[08:58:05] passerine: has joined #ruby
[08:58:49] joonty: has joined #ruby
[08:59:10] mikecmpbll: has joined #ruby
[09:01:26] celly: has joined #ruby
[09:03:23] celly: has joined #ruby
[09:05:01] trampi: has joined #ruby
[09:05:11] celly: has joined #ruby
[09:05:15] howdoi: has joined #ruby
[09:06:21] solars: has joined #ruby
[09:06:25] Takumo: has joined #ruby
[09:06:25] Takumo: has joined #ruby
[09:07:07] celly: has joined #ruby
[09:07:49] Couch: has joined #ruby
[09:08:03] darkxploit: has joined #ruby
[09:08:13] Scripore: has joined #ruby
[09:08:47] howdoicomputer: has joined #ruby
[09:08:58] celly: has joined #ruby
[09:09:12] edwinvdgraaf: has joined #ruby
[09:10:53] celly: has joined #ruby
[09:11:36] InvGhost: has joined #ruby
[09:12:46] celly: has joined #ruby
[09:13:39] drptbl: has joined #ruby
[09:13:55] rsc___: has joined #ruby
[09:14:38] celly: has joined #ruby
[09:14:44] c0dedead: has joined #ruby
[09:15:04] garethrees: has joined #ruby
[09:15:43] c0dedead: I am working on a project using Ruby version 1.9.3 that may require me to update it. If I update to version 2.2.3 how likely am I to break things?
[09:16:33] celly: has joined #ruby
[09:18:17] tomphp: has joined #ruby
[09:18:23] celly: has joined #ruby
[09:20:18] celly: has joined #ruby
[09:20:46] rdark: c0dedead: Ruby 1.9.3 was closer to ruby 2.0.0 than 1.8.7, so shouldn't be too much of a jump. Hopefully you have decent test coverage to catch any breakage?
[09:21:00] PaulCapestany: has joined #ruby
[09:22:13] celly: has joined #ruby
[09:23:54] edwinvdgraaf: has joined #ruby
[09:23:57] alexjose: has joined #ruby
[09:24:04] celly_: has joined #ruby
[09:24:44] Scripore: has joined #ruby
[09:24:49] workmad3: has joined #ruby
[09:25:58] celly: has joined #ruby
[09:27:11] c0dedead: Rspec says 116 of 293 tests fail :/
[09:27:48] celly: has joined #ruby
[09:28:25] CloCkWeRX: has joined #ruby
[09:28:56] jayne: has joined #ruby
[09:29:22] Peg-leg: has joined #ruby
[09:29:37] sidoaight: has joined #ruby
[09:29:44] celly: has joined #ruby
[09:29:53] dmolina: has joined #ruby
[09:30:06] elaptics: what sort of failures are they?
[09:30:09] PaulCapestany: has joined #ruby
[09:30:33] BrunoSaboia: has joined #ruby
[09:31:23] Tempesta: has joined #ruby
[09:31:51] sidoaight: has left #ruby: ("We need to work as a team. Which means doing what I say.")
[09:32:10] c0dedead: It looks like a lot of them were from bcrypt saying it found an invalid salt. I'm still looking through them.
[09:32:23] tomphp: has joined #ruby
[09:32:56] c0dedead: Is that something that could render my existing data invalid if I update bcrypt?
[09:35:38] nateberkopec: has joined #ruby
[09:36:02] elaptics: not sure, but I wouldn't have thought so
[09:37:09] dionysus70: has joined #ruby
[09:38:00] duckpuppy: has joined #ruby
[09:38:19] B1n4r10: has joined #ruby
[09:40:32] jxs_: has joined #ruby
[09:41:29] krzkrz: has joined #ruby
[09:42:46] vasilakisFiL: has joined #ruby
[09:45:39] c0dedead: Updating bcrypt corrected all of the errors.
[09:46:30] c0dedead: I'm not sure if I should be, but I am worried about the data in our production database. I guess worst case I can just force all users to update their passwords.
[09:46:56] kaka: has joined #ruby
[09:47:38] c0m0: has joined #ruby
[09:47:54] seitensei: has joined #ruby
[09:47:54] seitensei: has joined #ruby
[09:50:09] stannard: has joined #ruby
[09:51:11] baweaver: has joined #ruby
[09:51:17] FooMunki: has joined #ruby
[09:58:43] phantummm: has joined #ruby
[10:00:12] SCHAAP137: has joined #ruby
[10:00:33] howdoicomputer: has joined #ruby
[10:00:50] rodfersou: has joined #ruby
[10:01:14] huyderman: has joined #ruby
[10:02:17] Ropeney: has joined #ruby
[10:07:20] DylanJ: anyone know how i can xor a bignum with a bignum?
[10:07:35] Xentil: has joined #ruby
[10:07:39] ur5us: has joined #ruby
[10:07:44] Arnvald: has joined #ruby
[10:07:49] dlitvak: has joined #ruby
[10:07:57] rdark: has joined #ruby
[10:08:35] Arnvald_: has joined #ruby
[10:09:09] calderonroberto: has joined #ruby
[10:09:37] Arnvald: has joined #ruby
[10:09:43] shock_one: has joined #ruby
[10:09:47] bithon: has joined #ruby
[10:10:01] bithon: has joined #ruby
[10:11:04] jhass: just do it? http://devdocs.io/ruby/bignum#method-i-5E
[10:11:45] Arnvald_: has joined #ruby
[10:16:23] KrzaQ: I'm doing advent of code. I want to enumerate all n-element array that have the same sum (say, k). I came up with this: http://melpon.org/wandbox/permlink/iiQUNAwVYibodegS and it works, but I'm wondering if it can be done in a better way
[10:18:49] Arnvald: has joined #ruby
[10:21:13] yfeldblum: has joined #ruby
[10:22:18] pawnbox: has joined #ruby
[10:25:24] Pumukel: has joined #ruby
[10:25:38] vasilakisFiL: I run this program: http://pastie.org/private/xeenoytephcapgtiq7u3gw but a some times (not always) I get Actor crashed! errors after the print of the results
[10:25:47] vasilakisFiL: should I terminate my script in a different way ?
[10:25:53] vasilakisFiL: monkey_patches file is this: http://stackoverflow.com/a/7749613
[10:27:22] ur5us: has joined #ruby
[10:27:25] toretore: has joined #ruby
[10:33:26] devbug: has joined #ruby
[10:33:57] chthon: has joined #ruby
[10:34:17] Arnvald: has joined #ruby
[10:34:54] Arnvald: has joined #ruby
[10:35:24] arup_r: has joined #ruby
[10:36:21] nateberkopec: has joined #ruby
[10:36:22] marr: has joined #ruby
[10:38:01] shock_one: has joined #ruby
[10:38:45] duckpuppy: has joined #ruby
[10:39:11] Arnvald: has joined #ruby
[10:40:10] aryaching: has joined #ruby
[10:41:00] kalopsian: has joined #ruby
[10:42:23] Arnvald_: has joined #ruby
[10:42:53] shevy: so we don't know why it crashes
[10:43:16] tulak: has joined #ruby
[10:45:06] chthon: has joined #ruby
[10:46:18] Mon_Ouie: has joined #ruby
[10:47:02] bithon: has joined #ruby
[10:47:53] platzhirsch: has joined #ruby
[10:48:23] ElFerna: has joined #ruby
[10:48:38] bithon: has joined #ruby
[10:48:58] nettoweb: has joined #ruby
[10:50:07] cassioscabral: has joined #ruby
[10:51:49] sepp2k: has joined #ruby
[10:52:11] KrzaQ: ACTION feels ignored
[10:52:18] KrzaQ: I take it it's not bad since noone yells at me
[10:52:46] jhass: or we think you're beyond any help :P
[10:53:12] shevy: I dunno, I feel it's much simpler to help when people got to work on code that is actually used for anything :D
[10:53:38] Arnvald: has joined #ruby
[10:53:44] Silex: KrzaQ: the name "permutations" looks wrong here
[10:54:25] Silex: also, http://ruby-doc.org/core-2.2.0/Array.html#method-i-permutation
[10:56:25] KrzaQ: Silex: what would be the correct word then? I want an enumerator of arrays such that the sum of their elements is n
[10:56:41] aryaching: has joined #ruby
[10:56:51] KrzaQ: shevy: aoc may be a game, but I still used it there :P
[10:57:42] FooMunki: has joined #ruby
[10:57:56] Silex: I think you want more like a generator
[10:58:15] blub: i would call it permutations_summing
[10:58:49] shevy: I call it madness!
[10:59:33] build22: has joined #ruby
[11:00:04] drys: has joined #ruby
[11:00:20] adaedra: THIS. IS. RUBY.
[11:00:23] adaedra: ACTION kicks shevy 
[11:01:13] KrzaQ: I'll investigate the name
[11:01:20] howdoicomputer: has joined #ruby
[11:01:25] KrzaQ: but I was more interested in implementation issues
[11:01:32] Silex: hum, actually it can be permutations, but you need to start with a bigger array of all possible elements then
[11:01:56] bithon: has joined #ruby
[11:02:03] nfk|laptop: has joined #ruby
[11:02:23] Silex: [0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3].permutation(4)
[11:02:53] KrzaQ: and then .select{|n| n.inject(:+) == desired} ?
[11:02:54] Silex: then each_with_object({}) h[arr.sum] etc
[11:03:19] Silex: basically what you said yeah
[11:03:28] Silex: but, it depends wether you focus on elegance or performance
[11:03:33] drys: has joined #ruby
[11:04:04] KrzaQ: The performance drop is so drastic I'd call it inelegant, tbh
[11:04:06] cassioscabral: has joined #ruby
[11:04:25] Silex: for an array of 16 elements I doubt you'd notice
[11:04:32] blub: that has less right to be called permutations
[11:05:00] KrzaQ: Silex: it's just a small example, the actual code needs to have the sum of 100
[11:05:07] KrzaQ: so it'd be 400 elements
[11:05:13] skade: has joined #ruby
[11:05:30] Silex: 400 elements is peanuts
[11:06:05] Silex: (or at least I'd believe it is, maybe I'm wrong)
[11:07:05] c355E3B: has joined #ruby
[11:07:54] ibouvousaime: has joined #ruby
[11:08:29] KrzaQ: I'll give it a try
[11:08:36] aibot: has joined #ruby
[11:09:38] sepp2k1: has joined #ruby
[11:09:39] spt0: has joined #ruby
[11:09:54] KrzaQ: ([*(0..100)]*4).permutation(4).count
[11:10:04] KrzaQ: several seconds now, still counting
[11:10:20] KrzaQ: ah, wait, I forgot to select
[11:11:02] charliesome: has joined #ruby
[11:11:39] Silex: hum, you're right it's rather slow
[11:12:00] KrzaQ: p ([*(0..100)]*4).permutation(4).select{|n| n == 100}.count
[11:12:06] KrzaQ: left that in sublime, I wonder how long it'll take
[11:12:17] KrzaQ: my solution does it in ~2 seconds on my vm
[11:14:10] Silex: interesting example of elegancy vs performance
[11:15:25] blub: ruby needs SERIES @_@
[11:16:32] krzkrz: has joined #ruby
[11:16:35] gagrio: has joined #ruby
[11:16:42] bithon: has joined #ruby
[11:17:52] celly: has joined #ruby
[11:18:23] bithon: has joined #ruby
[11:19:12] cassioscabral: has joined #ruby
[11:19:28] Macaveli: has joined #ruby
[11:20:02] mostlybadfly: has joined #ruby
[11:22:08] platzhirsch: has left #ruby: ()
[11:24:35] timonv: has joined #ruby
[11:24:49] joonty: has joined #ruby
[11:27:07] B1n4r10: has joined #ruby
[11:27:20] chthon: has joined #ruby
[11:27:32] emrox: has joined #ruby
[11:27:46] skade: has joined #ruby
[11:28:40] quazimodo: has joined #ruby
[11:30:18] wmdrossard: has joined #ruby
[11:31:53] KrzaQ: there's an anime
[11:31:58] KrzaQ: spelled rwby though
[11:33:03] ElFerna: has joined #ruby
[11:33:18] colegatron: has joined #ruby
[11:34:35] prestorium: has joined #ruby
[11:37:12] nateberkopec: has joined #ruby
[11:39:30] duckpuppy: has joined #ruby
[11:41:58] kaka: has joined #ruby
[11:43:14] Danielss89: has joined #ruby
[11:43:31] Danielss89: does rvm.io has anything to do with this channel?
[11:43:44] ElFerna: has joined #ruby
[11:44:25] Bish: Danielss89: well, it does install ruby, but that does every packagemanager of any linux distribution, too
[11:44:29] gagrio: has joined #ruby
[11:44:50] Danielss89: Bish ok, i'm asking because the website is down
[11:45:01] yfeldblum: has joined #ruby
[11:45:02] Danielss89: and just wanted to notify the right people
[11:45:18] KrzaQ: Silex: p ([*(0..100)]*4).permutation(4).select{|n| n == 100}.count still processing ;)
[11:45:35] Bish: i started that one in crystal on my 4g ram machine
[11:45:38] Bish: totally freezed it :D
[11:45:55] KrzaQ: so I guess my question would be if you can do recursive enumerators in a more elegant way than mine
[11:46:08] shock_one: has joined #ruby
[11:46:40] CloCkWeRX: has joined #ruby
[11:47:05] Bish: froze? i don't know
[11:47:42] Silex: KrzaQ: you can probably get rid of the if somehow
[11:47:46] jhass: Bish: I think master just added an iterator for it
[11:48:14] Bish: jhass: crystal you say?
[11:48:43] Bish: well, im only playing around with it, only having the version my package manager gives me
[11:49:39] Silex: hum... actually no
[11:50:14] krzkrz: has joined #ruby
[11:51:18] KrzaQ: I dunno how
[11:52:14] jhass: Bish: https://github.com/manastech/crystal/commit/813682d3c440cbf07db2465a0deba2e6631885ff
[11:56:40] ElFerna: has joined #ruby
[11:57:40] Bish: >> Array.new.methods.select{ |x| x.to_s =~ /each/ }
[11:57:41] ruboto: Bish # => [:each, :each_index, :reverse_each, :each_with_index, :each_entry, :each_slice, :each_cons, :each_wi ...check link for more (https://eval.in/485618)
[11:58:26] Bish: intradesting
[12:01:33] kaka: has joined #ruby
[12:02:06] howdoicomputer: has joined #ruby
[12:05:43] bmalum: has joined #ruby
[12:06:35] bmalum: has joined #ruby
[12:08:45] cornerma1: has joined #ruby
[12:12:21] aryaching: has joined #ruby
[12:12:36] dlitvak: has joined #ruby
[12:13:32] dlitvak: has joined #ruby
[12:13:39] dmolina: has joined #ruby
[12:15:57] kaka__: has joined #ruby
[12:17:35] madcodes: has joined #ruby
[12:18:05] madcodes: has joined #ruby
[12:18:10] idefine: has joined #ruby
[12:18:39] charliesome: has joined #ruby
[12:19:24] cassioscabral: has joined #ruby
[12:21:40] dlitvak: has joined #ruby
[12:21:57] moeabdol1: has joined #ruby
[12:23:11] xabcf: has joined #ruby
[12:23:25] xabcf: hi, i am doing
[12:23:27] xabcf: system('export Y=path')
[12:23:47] xabcf: but it returns nil instead of 'path'
[12:24:04] xabcf: how can i access the variables exported using system
[12:24:17] Bish: try Y=$PATH
[12:24:19] xabcf: or is there any other way to tun system command from ruby
[12:24:45] KrzaQ: I don't think ENV get's updated when parent's environment changes
[12:24:48] Bish: xabcf: try %x(echo 'path')
[12:24:49] shevy: xabcf I am not sure you can get the ENV value updated lateron
[12:25:00] xabcf: system('export Y=abcstring')
[12:25:01] Scripore: has joined #ruby
[12:25:07] jhass: xabcf: just use ENV["Y"] = "path"
[12:25:16] shevy: perhaps there is some manual way to get it synced lateron at runtime... hmm
[12:25:25] jhass: shevy: there isn't
[12:25:52] xabcf: so one has to have set all the exported values manually which is being in some shell script
[12:26:06] shevy: time for a pre-xmas PR!!!
[12:26:51] Bish: or you let them set with the shell script? xabcf
[12:27:32] shevy: yeah it's sorta a non-issue in this case because he already manually sets it via system
[12:27:35] johnzorn: has joined #ruby
[12:27:45] shevy: so he knows the value so he can manipulate ENV directly
[12:28:02] xabcf: yes i have a script.sh that exports some variables. And then i run that script from ruby using system('./script.sh') and now i want my variables in ruby
[12:28:07] adaedra: xabcf: when you do `system('export Y=path')`, you don't set the env in the parent. You create a subshell, set it there, and close the shell.
[12:28:19] ElFerna: has joined #ruby
[12:28:30] Bish: xabcf: why not let script.sh invoke your ruby script?
[12:29:07] adaedra: Or do like ssh-agent: print the variables to set in your script.sh, and then use this output in the parent to fix your own env.
[12:29:52] shevy: could add an ENV.sync() method or something
[12:29:58] adaedra: To sync with what?
[12:30:11] shevy: to how ENV normally gets populated
[12:30:18] adaedra: You don't have access to parent or children environment.
[12:30:24] shevy: ENV gets populated
[12:30:40] adaedra: Yes, using the environment passed by your system at startup.
[12:30:41] Bish: shevy: script.sh get's his own environment, then sets stuff there, and ends
[12:30:49] Bish: the env of the ruby script, doesn't get changed
[12:31:15] xabcf: hmm, but if we want to sync somehow the ENV
[12:31:24] adaedra: you can't.
[12:31:28] Bish: that's not what they are for
[12:31:40] adaedra: that's not how environment works.
[12:32:09] Bish: xabcf: can you be more specific in what you're trying to do
[12:32:20] Bish: like, whats inside those variables
[12:33:10] xabcf: but suppose in case of building native extension gem, you call a script.sh through extconf.rb and want to get the exported variables which were set in script.sh
[12:33:35] ElFerna_: has joined #ruby
[12:34:03] adaedra: You cannot make environment variables magically go up in processes. Use io or ipc to transmit the variables, xabcf.
[12:34:52] shevy: he can already manually update ENV syncing should be easily doable
[12:34:58] xabcf: is this the case with ruby, or is it same with python as well
[12:35:10] adaedra: It's the case even with C.
[12:35:55] charliesome_: has joined #ruby
[12:36:19] adaedra: Each process has its own environment; it is copied in new processes at the time of fork(2), and then is not shareable to other processes. The only way to have a process get your env is to be called by the program calling it.
[12:36:20] apeiros: xabcf: it's the case with your OS
[12:36:40] dlitvak: has joined #ruby
[12:36:55] adaedra: I think environment is not the storage you want.
[12:36:55] apeiros: and note that this is indeed a feature, not a bug. being able to override a parent's env would be a security issue.
[12:36:55] shevy: xabcf sorta http://stackoverflow.com/a/4907053/722915 python has it collected as part of "os.", ruby just uses the global constant ENV
[12:37:38] adaedra: hi apeiros, thanks for the support :p
[12:37:50] apeiros: adaedra: for you, always ;-D
[12:37:53] xabcf: hmm right
[12:37:53] nateberkopec: has joined #ruby
[12:38:06] xabcf: so manually setting ENV is the way to go
[12:38:20] adaedra: Well, there may be others ways.
[12:38:27] shevy: yeah like a baby you have to manually update all the variables on your own :)
[12:38:44] charliesome: has joined #ruby
[12:39:50] adaedra: As I said above, maybe ENV is not what you're looking for. You could output a file and read it in Ruby process, for example.
[12:39:52] azgil: has joined #ruby
[12:40:15] duckpuppy: has joined #ruby
[12:40:42] xabcf: ENV['x'] = `ls`.chomp
[12:40:44] xabcf: like this
[12:40:57] jhass: or likely even compute the values you compute in your shellscript in ruby
[12:41:07] sdothum: has joined #ruby
[12:41:22] solars: has joined #ruby
[12:41:24] Bish: execute it inside a fork, attach to the process with ptrace and then read out the environment variables with writing a thread in x86 assembler
[12:41:28] Bish: sounds reasonable to me!
[12:41:33] jhass: xabcf: what kind of variables are we talking about here really? got any real world example instead of the fake stuff?
[12:41:58] xabcf: ENV['x'] = `ls`.chomp
[12:41:59] shevy: xabcf this is of course moot since you can obtain these information from plain ruby too
[12:42:01] adaedra: Bish: sssh, they may think it's ok to do.
[12:42:10] xabcf: this creates a fork first and then attaches the value to ENV
[12:42:13] Bish: it's a okay thing to do!
[12:42:34] Bish: no it's crazy, don't do that
[12:42:44] jhass: ?xy xabcf
[12:42:44] ruboto: xabcf, it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[12:44:15] xabcf: execute it inside a fork, attach to the process with ptrace and then read out the environment variables with writing a thread in x86 assembler . Bish, this is hard for me to understand
[12:44:26] xabcf: thats why i asked specifically
[12:44:45] xabcf: sorry if that breaks any irc manner
[12:44:53] Scripore: has joined #ruby
[12:45:11] Bish: xabcf: it would be the hardest way to do , there is
[12:45:18] Bish: but it would probably do what you want to do
[12:46:04] Bish: you still shoudn't, printing to a pipe would bbe more easy, by far
[12:47:03] adaedra: xabcf: Bish's solution is not the thing to do. Ignore it.
[12:47:06] adaedra: Bish: see!?
[12:47:15] Bish: im sorry :p
[12:47:20] jhass: well can't say we didn't try to lead you to a proper solution, if you prefer to ignore our advice I see no sense in continuing the discussion
[12:47:42] adaedra: xabcf: explain us what you're trying to do in the first place; we may help you find a better solution
[12:49:08] xabcf: i want to set compiler flags (CC, CXX) while building native extension
[12:49:30] xabcf: and these CC, CXX would differ for linux, darwin
[12:49:46] jhass: why do you need to compute the values inside a shellscript?
[12:50:07] jhass: also doesn't mkmf have its own settings for those?
[12:50:41] Bish: ACTION wishes the ptrace gem would actually work
[12:50:54] xabcf: because there were few other things as well that i had in the script.sh so i though of export it through script.sh and getting them through ENV or something in ruby
[12:51:03] xabcf: mkmf settings ?
[12:51:36] senayar: has joined #ruby
[12:51:37] senayar: has joined #ruby
[12:51:52] jhass: apparently not, mh
[12:51:55] shevy: xabcf one obvious workaround would be to source the .sh script that sets it before you start ruby
[12:52:10] jhass: xabcf: I repeat myself, what makes computing these values from Ruby impossible or even just hard?
[12:52:17] aryaching: has joined #ruby
[12:52:32] xabcf: nothing jhass.
[12:52:36] tvw: has joined #ruby
[12:52:36] xabcf: i can do that
[12:52:54] xabcf: but i thought i could make my extconf.rb cleaner
[12:52:58] jhass: then why waste time on this trying to reuse your shell script no matter what
[12:53:09] jhass: I doubt so
[12:54:07] tomaz_b: has joined #ruby
[12:55:32] jhass: xabcf: https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L604 https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L626
[12:56:42] xabcf: jhass, but even if i use it, i have to compute the values in ruby
[12:57:09] tejasmanohar: has joined #ruby
[12:57:16] jhass: I still can't imagine why that would be complicated
[12:57:22] jhass: what's possibly complex about them
[12:58:16] DeXterbed: has joined #ruby
[12:58:27] xabcf: i just thought that if i can use the exported values from script.sh
[12:58:45] phantummm: has joined #ruby
[12:59:16] xabcf: by the way, this is also a way to set compiler -> RbConfig::CONFIG['CXX'] = path
[12:59:37] shevy: are you reading stackoverflow or something
[12:59:51] jhass: ok. you're evading the question, so no point in pressing it further
[13:00:00] xabcf: https://www.ruby-forum.com/topic/1991938
[13:00:10] xabcf: i am reading this
[13:00:22] Bish: is there a cool x86 debugging tool for ruby?
[13:00:32] Bish: i tried Ptrace and rtrace, they both don't work
[13:01:22] dlitvak: has joined #ruby
[13:01:41] adaedra: 24 letters left to test then.
[13:01:46] pika_pika: has joined #ruby
[13:01:51] idefine: has joined #ruby
[13:02:04] dlitvak: has joined #ruby
[13:02:47] howdoicomputer: has joined #ruby
[13:02:50] GinoManAFK: Hey, is there a difference between puts and print?
[13:03:15] jhass: GinoManAFK: puts appends a trailing newline unless there already is one
[13:03:28] ornerymoose: has joined #ruby
[13:03:38] jhass: GinoManAFK: it also has a different behavior when passed an array
[13:03:51] GinoManAFK: What behavior does it have when passed an array?
[13:04:13] ruboto: Why don't you try it and see for yourself?
[13:05:08] Borkot|2: has joined #ruby
[13:05:10] shevy: GinoManAFK puts will ensure that one \n is at the end
[13:05:12] Borkot|2: has left #ruby: ()
[13:05:34] jhass: shevy: I think I already said that?
[13:05:40] ElFerna_: has joined #ruby
[13:05:45] Bish: if i do puts "x\n" it will not add an \n?
[13:06:03] celly: has joined #ruby
[13:06:03] Bish: interesting, didn't know that.
[13:06:05] shevy: jhass I did not read what you wrote when I looked at the tab here
[13:06:17] shevy: I am multitasking!
[13:06:46] shevy: Bish yeah that confused me too once
[13:07:16] shevy: puts "hello world!" would yield the same result as a puts "hello world!\n" would
[13:07:48] ornerymoose_: has joined #ruby
[13:11:47] AlexRussia: has joined #ruby
[13:11:54] sameerynho: has joined #ruby
[13:12:17] GinoManWorks: has joined #ruby
[13:12:38] tulak: has joined #ruby
[13:13:18] djcp2: has joined #ruby
[13:14:28] GinoManWorks: print actually prints the .to_s of the array itself, puts prints each string in the array on it's own line.
[13:15:44] shevy: so suddenly you mention an array
[13:15:49] jhass: GinoManWorks: exactly!
[13:15:52] B1n4r10: has joined #ruby
[13:16:04] devbug: has joined #ruby
[13:16:11] jhass: shevy: you still didn't read what I wrote then ...
[13:16:26] shevy: jhass is this required?
[13:16:50] jhass: shevy: for that type of comment you just made, yes
[13:17:02] shevy: jhass no I don't think it is required
[13:17:43] GinoManWorks: sorry, I crashed Quassel trying to renick myself as GinoMan@work.... I feel like if that's not legal it should have caught that and told me so
[13:17:57] GinoManWorks: rather than crashed.
[13:18:13] shevy: have you tried /j #0 or something yet
[13:18:31] dlitvak_: has joined #ruby
[13:18:32] jhass: GinoManWorks: well, get a better client then :P
[13:18:38] CloCkWeRX: has joined #ruby
[13:18:47] shevy: quassel is a very strange name... then again so is peechat
[13:18:48] djcp3: has joined #ruby
[13:19:15] shevy: GinoManWorks use a ruby IRC client!
[13:19:21] arup_r: has joined #ruby
[13:19:23] jhass: shevy: such as?
[13:19:50] Macaveli: has joined #ruby
[13:20:09] shevy: perhaps one could use ruby-ncurses
[13:20:27] huyderman: has joined #ruby
[13:20:36] EvilDMP: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[13:21:13] shevy: jhass does crystal have an IRC client yet? :)
[13:21:38] Macaveli_: has joined #ruby
[13:21:42] shevy: hmmm next time I stroll into crystal, I will look at the GUI bindings
[13:21:53] GinoManWorks: shevy: That's really the only reason I didn't put a whole lot of energy into learning ruby through and through; there really isn't a super mature and robust gui library for it like there is for C/C++
[13:22:06] jhass: shevy: there is a client library or two
[13:22:11] GinoManWorks: There's rails for web apps which I've heard is awesome but
[13:22:16] shevy: jhass cool
[13:22:28] GinoManWorks: mostly the only gui stuff for ruby are bindings to C/C++ gui libraries.
[13:23:11] jhass: well of course
[13:23:19] jhass: it's not a wheel you want to reinvent in every language
[13:23:24] synthroid: has joined #ruby
[13:23:31] gaiada: has joined #ruby
[13:23:34] jhass: I mean look at what a pain Swing GUIs are to use (and write)
[13:23:46] B1n4r10: has joined #ruby
[13:25:11] GinoManWorks: jhass: That's true, but for example, Qt, which is what I know how to use, is taylored to C++'s strengths and weaknesses and uses the full extent of C++ and even a seperate meta-object compiler to make gui programming easy and fully integrated with the language.
[13:25:28] shevy: yeah well
[13:25:47] shevy: most of the time there are like 1-2 devs... they have enough energy to map the C API 1:1 onto ruby... and then they move on to do other things
[13:26:07] jhass: GinoManWorks: nothing against building a nicer to use API on top of a rather raw binding
[13:26:14] GinoManWorks: Yeah, I'm programming alone as it were
[13:26:23] TomPeed: has joined #ruby
[13:26:25] jhass: and yes, Ruby is lacking in that kind of abstractions
[13:26:32] jhass: but so are most languages if we're honest
[13:26:44] arup_r: has joined #ruby
[13:26:48] shevy: GinoManWorks ruby-qt looked very nice
[13:26:59] GinoManWorks: Perl doesn't have great gui support either. Python I wouldn't even begin to know what it's like, but I know it has qt bindings
[13:27:13] shevy: python has more developers so they have an advantage there
[13:27:17] GinoManWorks: Bash fuggedaboudit
[13:27:49] shevy: GinoManWorks you can see it on that page there http://www.gtk.org/language-bindings.php ... ruby is not an official binding :(
[13:27:51] GinoManWorks: bash scripts you can access curses stuff using certain programs
[13:27:56] jpank: has joined #ruby
[13:28:20] shevy: yeah you mean something like the slackware menu interface for installing packages and stuff
[13:28:28] momomomomo: has joined #ruby
[13:28:49] GinoManWorks: there are bash scripts that will give you like some curses stuff
[13:29:00] GinoManWorks: that use those libraries
[13:29:10] shevy: GinoManWorks gobolinux had a nice idea back when it still sorta existed http://www.gobolinux.org/abstk/
[13:29:28] blub: i just finished bashing together a cocoa thing in lisp like five minutes ago i really hate interfaces but those bindings are pretty good..
[13:29:36] shevy: I think python has had something similar... anaconda? or whatever it was where you could both have ncurses and gtk
[13:30:11] shevy: cacao and lisp sounds like a cool combination!
[13:30:30] GinoManWorks: Cocoa I liked a lot
[13:30:39] p0wn3d: has joined #ruby
[13:31:19] GinoManWorks: I hated it at first because it was all gui based instead of codebased but when I realized that the design actually makes it *more* powerful than handcoding things, I realized how productive I was being in it and grew to like it a lot
[13:32:27] bronson: has joined #ruby
[13:32:35] d0nn1e: has joined #ruby
[13:34:25] sgambino: has joined #ruby
[13:34:30] gambl0re: has joined #ruby
[13:35:06] rsc___: has joined #ruby
[13:35:27] Macaveli: has joined #ruby
[13:36:32] _stu_: has joined #ruby
[13:36:46] joonty: has joined #ruby
[13:37:51] GinoManWorks: I did find this: http://shoesrb.com/
[13:38:35] pawnbox: has joined #ruby
[13:38:41] nateberkopec: has joined #ruby
[13:39:40] dlitvak: has joined #ruby
[13:41:01] duckpuppy: has joined #ruby
[13:41:03] Bish: i tried shoes, its fun but weird
[13:41:09] Bish: who needs GUIs anyways
[13:44:37] Jardayn: has joined #ruby
[13:44:41] teotwaki: has left #ruby: ("WeeChat 1.3")
[13:45:15] KrzaQ: barefoot is better
[13:45:39] KrzaQ: guess what. I did a google search for barefoot.js and it exists
[13:45:47] ElFerna: has joined #ruby
[13:47:01] Jackneill: has joined #ruby
[13:48:35] dravine: has joined #ruby
[13:48:37] Scripore: has joined #ruby
[13:48:39] Bish: .oO( Will we ever run out of software names...? )
[13:49:50] dlitvak: has joined #ruby
[13:50:10] goodcodeguy: has joined #ruby
[13:50:26] freerobby: has joined #ruby
[13:51:35] Bish: okay, now you really convinced me
[13:51:42] shevy: naming things is hard
[13:51:49] shevy: shoes... barefoot ... node ...
[13:52:00] shevy: animalistic programming languages such as python
[13:52:24] shevy: not that A B C C++ C# D is all much better as a name
[13:52:40] teotwaki: has joined #ruby
[13:53:56] baweaver: has joined #ruby
[13:53:59] ESpiney: has joined #ruby
[13:54:06] teotwaki: has left #ruby: ("WeeChat 1.3")
[13:57:16] spiman: has joined #ruby
[13:57:44] goodcodeguy: has joined #ruby
[13:57:47] cassioscabral: has joined #ruby
[13:58:21] lipoqil: has joined #ruby
[13:58:30] cwong_on_irc: has joined #ruby
[13:58:33] drys: has joined #ruby
[13:58:44] B1n4r10: has joined #ruby
[14:02:26] yaewa: has joined #ruby
[14:03:34] jhooker: has joined #ruby
[14:03:38] howdoicomputer: has joined #ruby
[14:04:27] ibouvousaime: has joined #ruby
[14:07:16] dlitvak: has joined #ruby
[14:08:10] Ishido: has joined #ruby
[14:08:36] prillian5: has joined #ruby
[14:08:51] Bish: hm there was a watchdog gem, which was pretty powerful..
[14:09:00] Bish: forgot it's name, can you help me with that?
[14:09:22] Encapsulation: has joined #ruby
[14:09:58] kalopsian: has joined #ruby
[14:10:29] CloCkWeRX: has joined #ruby
[14:12:41] moei: has joined #ruby
[14:13:45] aspire: has joined #ruby
[14:14:54] goodcodeguy: has joined #ruby
[14:15:20] Macaveli_: has joined #ruby
[14:15:31] ramortegui: has joined #ruby
[14:16:05] Macaveli_: has joined #ruby
[14:16:21] atumzin: has joined #ruby
[14:16:22] atumzin: has joined #ruby
[14:16:52] atomical: has joined #ruby
[14:16:59] Macaveli_: has joined #ruby
[14:17:45] Macaveli: has joined #ruby
[14:18:05] davedev24: has joined #ruby
[14:18:22] droidburgundy: has joined #ruby
[14:18:48] benhuda: has joined #ruby
[14:19:15] dlitvak: has joined #ruby
[14:21:27] Bloomer: has joined #ruby
[14:21:55] dorei: has joined #ruby
[14:22:04] Anderson69s: has joined #ruby
[14:23:18] Vitor_: has joined #ruby
[14:23:45] renderful: has joined #ruby
[14:24:11] Verde`: has joined #ruby
[14:24:26] c355E3B: Good morning
[14:24:33] tlarevo: has joined #ruby
[14:24:44] Verde`: I'm having a hard time finding digest support or a gem for RIPEMD-128
[14:24:54] Verde`: Surely this is supported somehow? Could any of you point me in the right direction?
[14:26:53] Verde`: I can call Ripemd 160 using Digest::RMD160, but there's no 128 bit equivalent
[14:26:56] cdg: has joined #ruby
[14:27:37] jdm_: has joined #ruby
[14:29:01] thekingofbandit: has joined #ruby
[14:30:21] Macaveli: has joined #ruby
[14:32:02] cassioscabral: has joined #ruby
[14:32:29] kam270: has joined #ruby
[14:33:17] chouhoul_: has joined #ruby
[14:33:41] babblebre: has joined #ruby
[14:34:48] dlitvak: has joined #ruby
[14:35:00] cored: has joined #ruby
[14:35:07] decoponio: has joined #ruby
[14:35:12] cored: is there a way in Ruby to validate a JSON structure?
[14:35:34] shanemcd: has joined #ruby
[14:35:38] chrisarcand: has joined #ruby
[14:35:40] malconis: has joined #ruby
[14:35:41] Bish: no that's impossible
[14:35:42] cored: I'm trying with json-schema
[14:36:07] cored: but I just notice that my specs keep passing even when the structure of the schema is not right
[14:36:28] cored: like having nested nodes in the schema but not having the same nesteing in the output from my app
[14:36:36] cored: Bish: oh, thanks, I thought it was possible
[14:36:55] Bish: i was joking.
[14:37:08] cored: Bish: me too
[14:37:35] Bish: just wanted to make sure
[14:37:46] Bish: what's wrong with trying to parse it, rescue the raise?
[14:38:01] cored: the json schema is properly formatted
[14:38:06] cored: so parsing it will work
[14:38:16] cored: is the structure of it that is wrong in contrast with the output from the endpoint
[14:38:29] Bish: so you want the json to have a specific structure?
[14:38:30] cored: I want to enforce schemas on my app so people stop making changing and breaking stuffs
[14:38:33] havenwood: Verde`: Taking a stab at implementing it. :P
[14:38:40] nateberkopec: has joined #ruby
[14:38:45] cored: Bish: https://github.com/ruby-json-schema/json-schema
[14:39:15] Verde`: havenwood, so that's really where we're at?
[14:39:24] Bish: well, give us an example where i fails, so we can help
[14:39:31] Verde`: There is no support for RipeMD 128 in Ruby?
[14:39:32] shanemcd: has joined #ruby
[14:39:38] havenwood: Verde`: Nobody uses it.
[14:40:00] Verde`: I'm not gonna invent a whole new gem to resolve an issue that should've taken me 15 minutes 4 hours ago with a deadline tomorrow :-/
[14:40:35] Verde`: On to second rate hashes then I guess
[14:40:54] nomadicoder: has joined #ruby
[14:40:58] havenwood: Verde`: Why do you need RMD128 instead of RMD160?
[14:41:13] nettoweb: has joined #ruby
[14:41:17] Verde`: havenwood, because I need a 128 bit hexadecimal to be generated
[14:41:33] dlitvak: has joined #ruby
[14:41:46] duckpuppy: has joined #ruby
[14:42:08] cored: Bish: https://gist.github.com/cored/b084716e2a33659358fc
[14:42:15] cored: take a look at the output from the endpoint
[14:42:32] cored: and if you contrast it with the schema the schema have a linked nested inside links which is not the proper structure
[14:42:35] cored: but the specs are passing
[14:42:37] Verde`: To keep it short, the input is "random" as it is but I wanted to run it through Ripe to get a better number distribution
[14:42:40] cored: I would like to enforce structure
[14:43:02] dorei: Verde`: if you aint looking for a pure ruby implementation, maybe this https://github.com/TibshoOT/ruby-mhash might be of help
[14:43:11] InvGhost: has joined #ruby
[14:43:26] Verde`: Ooh thanks dorei, that may actually be my ticket here
[14:43:29] stannard: has joined #ruby
[14:43:35] Verde`: Didn't think of Mhash in the context of Ruby yet :-/
[14:44:35] Bish: cored: well, can you tell me, where it should break?
[14:45:43] cored: Bish: so linked is inside the links key instead of in the root of the JSON, I think that's an issue because that means that I can put the root nodes inside any node without a problem
[14:45:56] s00pcan: has joined #ruby
[14:46:33] dimasg: has joined #ruby
[14:47:15] Bish: i see linked outside of links
[14:47:45] zerowaitstate: has joined #ruby
[14:48:00] bungoman: has joined #ruby
[14:48:05] dlitvak: has joined #ruby
[14:48:25] zapata: has joined #ruby
[14:49:17] Verde`: Thanks cored, that solved my issue
[14:49:29] polishdub: has joined #ruby
[14:49:44] Bish: cored is a good guy
[14:49:47] uris: has joined #ruby
[14:50:01] cored: Verde`: hm?
[14:50:10] cored: Bish: updated it
[14:50:13] Bish: (he means dorei)
[14:50:15] cored: Bish: specs keep passing
[14:50:27] cored: well I'm a good guy either way, right Bish ?
[14:50:32] idefine: has joined #ruby
[14:50:33] Bish: im sure!
[14:50:38] Verde`: cored, mhash I mean
[14:50:39] mary5030: has joined #ruby
[14:50:55] Bish: mhash is a good guy
[14:50:57] Verde`: I'm going back in, god speed gents
[14:51:06] Bish: HACKING IN PROGRESS
[14:51:07] shevy: the cave of the dragon
[14:51:17] mary5030: has joined #ruby
[14:51:43] KrzaQ: Silex: [Finished in 7064.0s]
[14:51:50] Bish: KrzaQ: :D
[14:51:57] KrzaQ: roughly 3500 times slower :P
[14:52:04] Bish: slower than what?
[14:52:35] KrzaQ: an old discussion ([*(0..100)]*4).permutation(4).select{|n| n.inject(:+) == 100} vs. http://melpon.org/wandbox/permlink/iiQUNAwVYibodegS
[14:52:51] KrzaQ: old = ~4 hours or so, I think
[14:53:51] KrzaQ: I was wondering if it's possible to make my permutations generator nicer (it's supposed to make k-element arrays that sum up to a specified value)
[14:53:54] dfinninger: has joined #ruby
[14:54:03] vasilakisFiL: so I have this little ruby program: http://pastie.org/private/rmgiifat6ysbtemnqja44g it fires a tons of requests in my rails API, but it keeps the alive threads constant. If I set ulimit -n 100 (allow 100 open fd) it craches almost in 10 seconds. If I set ulimit -n 1024 it craches after 1 minute. Why aren't socket fd closed? do I do something wrong ?
[14:54:21] Bish: cored: still can't see where it breaks your shema
[14:54:35] vasilakisFiL: obviously if I want it to run for 5 hours I can't fix it by increasing the fd limit
[14:56:27] genpaku: has joined #ruby
[14:57:11] pulgolino: has joined #ruby
[14:58:07] freerobby: has joined #ruby
[14:59:26] rippa: has joined #ruby
[14:59:45] jhass: vasilakisfil: regarding Timeout::timeout, https://github.com/httprb/http#timeouts
[15:00:18] The_Phoenix: has joined #ruby
[15:00:19] cored: Bish: I mean, my schema is not broken
[15:00:40] cored: Bish: what I think should fail is the fact that I have a nested attribute in the JSON schema but in the response that attribute is not nested
[15:00:43] Bish: yeah i am not a native speaker, i mean where your data is not valid according to your shema
[15:00:43] vasilakisFiL: jhass I don't want per request timeout but rather a global timeout so I am not sure if that helps
[15:00:56] jhass: vasilakisfil: and yeah, you never seem to remove stuff from requests?
[15:01:29] cored: Bish: well, no the data is valid what is not valid is the structure of it according to the schema, that's what I want to also be enforce
[15:01:49] Bish: i understand what you're trying to say, but i cannot see where
[15:01:58] vasilakisFiL: what do you mean? when the request is done, the method returns so actor terminates
[15:02:15] Madhur_: has joined #ruby
[15:02:19] cored: Bish: well did you see the output?
[15:02:29] momomomomo: has joined #ruby
[15:02:34] jhass: vasilakisfil: fire returns a reference to the response object
[15:02:36] cored: Bish: if you see the output linked is not nested in links but in the schema it is; I think that should make the spec to fail
[15:02:46] jhass: which you append to the requests array
[15:02:50] jhass: and never remove
[15:03:26] Macaveli_: has joined #ruby
[15:03:50] Bish: cored: well you have required "linked" in root
[15:04:24] howdoicomputer: has joined #ruby
[15:04:26] vasilakisFiL: yes but when the request is done I return some objects.. I mean no point of keeping the connection alive there.. I think I should add the Connection: close header
[15:04:30] Bish: so it should fail, when its missing, shouldn't it?
[15:04:46] cored: Bish: right, probably this is not supported
[15:05:09] Bish: dafuq? i mean.. you say "this is broken because linked is in root, while it should be in links"
[15:05:12] jhass: vasilakisfil: even if that stops leaking FDs, you'll leak memory still
[15:05:16] Bish: but the root says "linked is required"
[15:05:26] Bish: so it should break, if there is no linked in root
[15:05:42] Bish: maybe im the wrong person to answer this, because im a confused guy, but i can't see a mistake in the gem
[15:07:20] cored: Bish: the opposite
[15:07:47] cored: Bish: it should fail because linked is not in the root it's inside the links key
[15:08:08] boxofrox: has joined #ruby
[15:08:12] Bish: but it isn't or am i blind
[15:08:32] houhoulis: has joined #ruby
[15:08:39] whippythellama: has joined #ruby
[15:08:46] Bish: there are two }} before "Linked", meaning it is in root
[15:09:19] cored: I'm tseting wth a simple schema and data
[15:09:49] Bish: there is no need to simplify it for me :D but i can't see a violation of your schema
[15:09:53] Silex: KrzaQ: :P
[15:10:27] Bish: https://gist.github.com/cored/b084716e2a33659358fc <= linked is in root in this one.
[15:10:38] mclong: has joined #ruby
[15:11:00] rsc___: has joined #ruby
[15:11:05] p337rB: has joined #ruby
[15:11:56] ElFerna: has joined #ruby
[15:12:41] shanemcd: has joined #ruby
[15:12:50] cored: Bish: hehe, you are right it was my mistake
[15:13:28] idefine: has joined #ruby
[15:15:56] boxrick1: has joined #ruby
[15:17:17] RobertBirnie: has joined #ruby
[15:17:46] cored: Bish: you are right, what needs a required linked is the root node not the links so that's why is not failing because the required node is in the response
[15:18:19] Bish: woop wooop
[15:18:59] dionysus69: has joined #ruby
[15:19:16] jhass: cored: don't forget to set "additionalProperties": false in your schema, it's not forbidden by default
[15:19:43] jhass: cored: also make sure to use fully_validate over validate, irrc
[15:19:53] jhass: so you get all issues at once
[15:20:23] hobodave: has joined #ruby
[15:20:49] cored: jhass: yes using fully_validate
[15:20:51] grill: has joined #ruby
[15:21:01] hxegon: has joined #ruby
[15:21:05] cored: did not know about the additionalProperties
[15:21:05] vasilakisFiL: modifying the array in the each block is a bad idea ?
[15:21:29] jhass: vasilakisfil: it usually leads to hard to understand code
[15:21:29] ljarvis: vasilakisfil: yes
[15:21:36] tulak: has joined #ruby
[15:21:46] cored: vasilakisfil: it depends but there are simpler way to implement that type of stuffs
[15:21:49] snguyen: has joined #ruby
[15:21:52] jhass: vasilakisfil: while request = requests.shift;
[15:22:21] vcoinminer_: has joined #ruby
[15:22:40] vasilakisFiL: I have the array that loops with the each block and afterr X loops I want to append a value so it keeps looping.. but at the same time I have to start deleting the first items in order not to have memory leak
[15:22:41] dhollinger: has joined #ruby
[15:22:55] shanemcd_: has joined #ruby
[15:23:03] jhass: vasilakisfil: anything wrong with my last suggestion?
[15:23:04] cored: jhass: if I use additionalProperties: false at the top level will it apply to the entire json schema?
[15:23:14] rflot: has joined #ruby
[15:23:29] jhass: cored: uh I don't remember but I don't think so, I think it only applies to the currently defined object
[15:23:34] bithon: has joined #ruby
[15:23:44] nateberkopec: has joined #ruby
[15:24:17] rgtk: has joined #ruby
[15:25:41] jhass: cored: http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.4.4
[15:25:45] phantummm: has joined #ruby
[15:26:21] jhass: I don't see anything about "apply to child" or "check parents", neither in http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.4.4.3
[15:26:55] cored: jhass: yes, reading that right now too
[15:28:40] dimasg: has joined #ruby
[15:28:47] chouhoulis: has joined #ruby
[15:29:17] vasilakisFiL: jhass yes it doesn't work unless you meant something else. Firstly shift modifies the object so it's just requests.shift. Secondly it seems like .each uses an internal counter when looping so when removing an item in the start of the array and adding an item in the end of the array, there is no different for .each, it continues looping using the internal counter. So since requests.size is constant, it stops after a while
[15:29:34] vasilakisFiL: at least that's what I understand, I don't know how .each works exactly
[15:29:44] jhass: vasilakisfil: I didn't say use it inside .each ...
[15:30:10] vasilakisFiL: ah ok sorry my bad
[15:31:50] Bish: && is not a method, right?
[15:32:44] kaka__: has joined #ruby
[15:32:46] vasilakisFiL: given an array of celluloid features, for each one that resolves (returns a value) I want to create a new one.. how can I do that? I tried modyfying the array inside the each block but obviously it doesn't work
[15:32:55] vasilakisFiL: sorry, celluloid futures
[15:33:10] spiman_: has joined #ruby
[15:33:43] codecop: has joined #ruby
[15:33:47] adaedra: Bish: doesn't seem to be.
[15:34:12] eichenwald: has joined #ruby
[15:35:01] platzhirsch: has joined #ruby
[15:35:13] Bish: hm, im trying to translate a set of "filter expressions" into sequel.filter stuff
[15:35:20] platzhirsch: Is there a neater way of writing: array_of_hashes.map { |h| h['key'] } ?
[15:35:38] DeXterbed: has joined #ruby
[15:35:48] ljarvis: platzhirsch: what's not neat about that?
[15:35:50] Bish: platzhirsch: wat?
[15:36:03] platzhirsch: like .map(&:method_name)
[15:36:31] Bish: especially wha tyou wrote, "prettier" is just "array_of_hashes" :D
[15:36:37] radgeRayden_: has joined #ruby
[15:36:52] ljarvis: they didn't say prettier but yeah
[15:36:58] dlitvak_: has joined #ruby
[15:37:21] ljarvis: it's basically not possible, platzhirsch. Your code is fine
[15:37:47] vasilakisFiL: is there a way to modify the each counter ?
[15:37:59] Xentil: has joined #ruby
[15:38:40] Bish: how can i dynamicially create a proc that "ands" things?
[15:38:48] ljarvis: vasilakisfil: what?
[15:38:53] ljarvis: Bish: what?
[15:38:59] ruboto: We can't help you without your code, please post it to https://gist.github.com
[15:39:11] Bish: like [a,b,c] => Proc.new { a && b && c }
[15:39:24] ljarvis: [a, b, c].all?
[15:39:33] Bish: no, i don't care about the result
[15:39:46] Bish: i need a proc for generating a sequel filter
[15:39:53] Xentil: has joined #ruby
[15:40:05] ljarvis: where does a && b && c come from inside the proc?
[15:40:06] Bish: sequel allows me to do things like dataset.where :id == 3 }
[15:40:18] ibouvousaime: has joined #ruby
[15:40:33] ljarvis: ok, we're getting there with some real info, more examples would be helpful
[15:40:39] ljarvis: ones that aren't a && b && c
[15:40:44] Xentil: has joined #ruby
[15:40:44] devbug: has joined #ruby
[15:40:45] Bish: yeah utf8 is broken in this terminal can't writ eit out
[15:40:54] vasilakisFiL: http://pastie.org/private/nitwcnwouvs9bxgzjb3mq likes 84 - 91. I need somehow to remove the first item in the array, append another item in the array and keep looping over the array. I was thinking modifying the index in the each_with_index but it doesn't work
[15:40:59] ljarvis: Bish: gist.github.com
[15:41:35] Bish: i have filter expressions in an array like [{type:"equal",field:"fieldname",params:["peter"]}]
[15:41:40] ljarvis: vasilakisfil: use a new array for the new requests
[15:41:47] Bish: and i want dynamicially create a proc which puts them all together
[15:41:49] ljarvis: and a while loop
[15:42:09] Bish: right now i am doing
[15:42:32] duckpuppy: has joined #ruby
[15:42:34] Bish: table = table.where({field: /something/}) <=
[15:42:46] Bish: but that's pretty ugly, to me
[15:42:56] bradland: So I think I ended up answering some of my own questions while writing this up, but I'd love any feedback/comments on this gist: https://gist.github.com/bradland/559955fc61addf3c96ba
[15:43:08] ljarvis: Bish: that looks nice to me, and you can omit the curlies..
[15:43:13] JohnBat26: has joined #ruby
[15:43:28] bradland: I'm trying to write a library for reading and parsing a UDP stream that is broadcast by the racing simulator ProjectCARS.
[15:43:29] n008f4g_: has joined #ruby
[15:44:23] troulouliou_div2: has joined #ruby
[15:44:42] arup_r: has joined #ruby
[15:44:59] Bish: ljarvis: well a loop that does x = x.something
[15:45:19] Bish: feels so broken :/ i feel like there has to be a better way
[15:47:09] ljarvis: ok, I dont think we have all of the code necessary to really help answer this but I guess I disagree that it feels broken
[15:47:45] ddubs: bradland, have you started first with wireshark to get a feel for offsets and how they encode the data?
[15:49:09] dlitvak: has joined #ruby
[15:49:49] Bish: ljarvis: :( too bad sequel doesn't have .where! wonder why there isn't
[15:50:11] Bish: http://sequel.jeremyevans.net/rdoc/files/doc/cheat_sheet_rdoc.html <= this is sequel in short
[15:50:30] Bish: wonderful little gem, but this table = table.where stuff bugs me
[15:51:07] atumzin: has joined #ruby
[15:51:07] atumzin: has joined #ruby
[15:52:24] pandaant: has joined #ruby
[15:53:25] benhuda: has joined #ruby
[15:55:03] baweaver: has joined #ruby
[15:55:14] ljarvis: yes I dont really understand why but I still can't tell exactly what you're trying to do, I'm very familiar with Sequel
[15:55:42] ljarvis: you have multiple conditions and want to do a where OR instead of a where AND which is what the Sequel where method does?
[15:55:58] p0wn3d_: has joined #ruby
[15:56:49] Bish: imagine i already have the conditions in another language
[15:57:03] ljarvis: sorry I can't help
[15:57:17] Bish: okay what about this
[15:57:41] ljarvis: suggestion: write some actual code and put it on github so people can see exactly what you're trying to do
[15:58:00] Bish: i don't have a github account :(
[15:58:06] ljarvis: you don't need one
[15:58:10] ljarvis: again.. gist.github.com
[15:59:15] havenwood: Verde, ah left already. And I finished a pure Ruby implementation! :(
[16:00:01] havenwood: I suppose there's use for this? >.> Maybe I'll make a little gem.
[16:00:02] FooMunki: has joined #ruby
[16:01:38] Bish: ljarvis: https://gist.github.com/anonymous/7b8ba854d9af8c730b6a
[16:01:49] Bish: sorry for the indent, can't get it to work
[16:02:17] Bish: that's what im doing right now.
[16:03:21] ljarvis: that code would have been so useful all that time ago
[16:03:25] ljarvis: but thank you
[16:03:51] ljarvis: basically from an abstract view I think this is fine. Where do the filter strings come from? user-input?
[16:04:10] Bish: it 'url' get parameters
[16:04:25] Bish: urlencoded, whatver its called
[16:04:48] ljarvis: hmm ok, do you do any sanitization or is this it?
[16:04:49] Bish: request.query is just {"key"=>"value"} then
[16:05:05] howdoicomputer: has joined #ruby
[16:05:15] Bish: this is it, but as i said i wasn't planning on keeping it this way
[16:05:48] ljarvis: well I think the part you dislike (the loop + @table = @table.xxx) is absolutely fine
[16:06:33] Bish: which part is not fine?
[16:06:37] Bish: using // on user input?
[16:06:55] rdark: has joined #ruby
[16:06:56] rgtk: has joined #ruby
[16:07:12] bradland: ddubs: i used tcpdump to grab the data, and it's identical to the pcars.dump content.
[16:07:54] hobodave: has joined #ruby
[16:08:12] Bish: why does sequel not have .where!
[16:09:00] rkazak: has left #ruby: ()
[16:09:11] bradland: so the game setting is a time interval, so i'm thinking it just dumps the contets of this C storage structure to the wire at the specified interval
[16:09:16] arup_r: has joined #ruby
[16:10:03] bradland: that means i should be able to detect any non-zero value and read the length of the number of bytes that constitute SharedMemory.h
[16:11:08] bradland: ddubs: added the SharedMemory.h file to the gist. https://gist.github.com/bradland/559955fc61addf3c96ba
[16:11:20] banister: has joined #ruby
[16:11:26] bradland: there's no clear licensing on that code (and it is copyright), so I may not be able to levae it up indefinitely.
[16:11:29] rubio: has joined #ruby
[16:11:54] linocisco: has joined #ruby
[16:11:56] adaedra: Bish: go ask jeremyevans in #sequel.
[16:13:07] Bish: that man has done enough for me
[16:14:37] TomPeed: has joined #ruby
[16:15:16] freerobby: has joined #ruby
[16:15:29] rubio: Hi there, i'm trying to make a dynamic module loading, basically my idea is that i have a class Customer and i will like to be able to do: customer_extended_functionality = first_customer.custom_module; so then i can call thinks inside customer_extended_functionality.proc1..... each customer will have a lib/custom/customer_id.rb file with a module Custom_id
[16:15:30] rubio: i have try something like @@custom = eval(File.new('lib/...').read) and i have the result BUT @@custom is not filled, so each time i need to read a custom function the system i re-loading the custom file :(
[16:15:43] karidoe: has joined #ruby
[16:16:28] InvGhost: has joined #ruby
[16:17:23] duckpuppy: has joined #ruby
[16:17:38] nerium: has joined #ruby
[16:19:34] platzhirsch: has left #ruby: ()
[16:19:36] YankNYC: has joined #ruby
[16:20:21] Icey: has joined #ruby
[16:21:07] goodcodeguy: has joined #ruby
[16:21:32] duckpuppy: has joined #ruby
[16:21:54] sucks: has joined #ruby
[16:22:15] dfinninger: has joined #ruby
[16:22:30] StevenXL: has joined #ruby
[16:22:31] StevenXL: has joined #ruby
[16:25:38] msankhala: has joined #ruby
[16:27:46] hobodave: has joined #ruby
[16:30:03] senayar: has joined #ruby
[16:30:04] senayar: has joined #ruby
[16:32:18] cwong_on_irc: has joined #ruby
[16:33:20] bronson: has joined #ruby
[16:33:32] ascarter: has joined #ruby
[16:37:04] queequeg2: has joined #ruby
[16:38:44] akem: has joined #ruby
[16:39:23] optikalmouse: has joined #ruby
[16:40:07] optikalmouse: has anyone had an issue with simplecov where it uses cached files? I???m working within a virtual machine and simplecov keeps reporting on a changed file. the # of lines of code are different even and I???ve removed the coverage folder so the cache it uses should be clear but it isn???t. am I missing smething?
[16:42:28] govg: has joined #ruby
[16:45:55] DroidBur_: has joined #ruby
[16:46:01] jbrhbr: has joined #ruby
[16:48:54] goodcodeguy: has joined #ruby
[16:50:50] idefine: has joined #ruby
[16:51:28] linocisco: has joined #ruby
[16:51:47] FooMunki: has joined #ruby
[16:53:05] lxsameer: has joined #ruby
[16:53:06] lxsameer: has joined #ruby
[16:53:25] alvarolm: has joined #ruby
[16:53:27] alvarolm: hi all ! :), im thinking in to use encryption (nacl) with http for an API with just one endpoint (e: http://api.service.com) is that a good idea ?
[16:53:57] cored: so I found a very interesting exception with the json validation Bish
[16:54:13] cored: if you have required fields in your schema but they are not part of your response, the validation passes
[16:54:23] bmalum: has joined #ruby
[16:55:24] apeiros: cored: "interesting"? wouldn't "bug" be the more fitting term?
[16:56:17] eichenwald: has left #ruby: ("WeeChat 1.1.1")
[16:56:23] InvGhost: has joined #ruby
[16:56:48] shevy: you people are adding to my IRC quotes collection!
[16:57:05] S01780: has joined #ruby
[16:57:08] emrox: has joined #ruby
[16:58:07] cored: apeiros: well, yeap that also can define it
[16:58:23] wmdrossard: has joined #ruby
[16:58:41] psye: has joined #ruby
[16:59:42] psye: has joined #ruby
[17:01:03] linocisco: has joined #ruby
[17:01:46] linocisco: how can I learn ruby quickly?
[17:02:03] luckyme: has joined #ruby
[17:02:20] adaedra: Reading tutorials, trying to do some projects
[17:02:42] pabs: linocisco: i recommend the book "Programming Ruby" by dave thomas
[17:03:50] shevy: linocisco write as much code as you possibly can
[17:03:55] optikalmouse: linocisco: download it to your brain.
[17:03:59] bradland: linocisco: what's your background. is this your first language?
[17:04:22] linocisco: pabs, Programming Ruby 1.9 & 2.0
[17:04:22] linocisco: The Pragmatic Programmers??? Guide
[17:04:22] linocisco: Dave Thomas
[17:04:22] linocisco: with Chad Fowler
[17:04:31] linocisco: sorry for my mulitlines
[17:04:31] Pathfinder: has joined #ruby
[17:05:25] linocisco: bradland, I learnt C in 2001, C++ to the level I can only write screen saver in DOS. no OOP, No Pointers
[17:06:28] linocisco: bradland, now I forgot most of that
[17:06:28] shevy: go write your first gem, ideally a game in ruby
[17:06:28] howdoicomputer: has joined #ruby
[17:06:28] shevy: and publish it on rubygems.org too
[17:06:28] phantummm: has joined #ruby
[17:07:01] symm-: has joined #ruby
[17:07:17] bradland: linocisco: i'd second the recommendation of "Programming Ruby" by Dave Thomas
[17:07:19] linocisco: shevy, I am not willing to write game. even all Linux games I saw are not eye catching like windows games as far as I saw. I am just so much into learning ruby to learn rails in no time. My final goal is to develop a database driven website
[17:07:57] bradland: linocisco: I would also recommend "Design Patterns in Ruby" by Obie Fernandez
[17:08:01] linocisco: bradland, yes. thanks again. I have that book in soft copy. it covers 1.9. and 2.0 on cover
[17:08:07] TomyLobo: has joined #ruby
[17:08:10] bradland: that book will help you once you've learned the basics of the Ruby language
[17:08:28] linocisco: bradland, thanks alot
[17:09:00] c-c: linocisco: note that "eyecatching" will not have anything to do with platform
[17:09:42] c-c: for that one needs good artists! :)
[17:09:51] rehat: has joined #ruby
[17:10:03] edwinvdgraaf: has joined #ruby
[17:10:50] linocisco: bradland, I have seen that book "Design Pattern" . I am not fully aware of that and what it aims
[17:11:17] bradland: most of the problems you encounter will already have solutions
[17:11:33] bradland: a "design pattern" is an approach to solving a common problem
[17:11:44] bradland: it's a higher level concept than simply writing code
[17:11:44] dravine: has joined #ruby
[17:11:49] bradland: it has to do with how you structure your code
[17:12:22] linocisco: bradland, thanks. i see. so First book I should read is Programming Ruby and 2nd -> Design pattern?
[17:12:40] alvarolm: i offer an HTTP API which is part of a SaaS for a business client that exclusively uses TLS 1.2 on machines that have custom third party CAs, recently got a complaint that 'someone' has been changing their settings in the SaaS and exported records with their authorization, its not the first time that this happens, an I'm thinking that we might have to implement an encryption layer at the appliction level, Is a good idea to drop TLS and just use one endpoi
[17:12:45] alvarolm: nt using the NACL (http://nacl.cr.yp.to/) library ?
[17:14:03] bradland: linocisco: yes, that would be a sensible approach.
[17:16:29] bradland: if your target is web programming, i would suggest starting out with something like Sinatra, which is a simple library for authoring websites that are powered by ruby
[17:16:32] bradland: Sinatra is very, very simple. it maps routes (URL paths) to code, but that's all.
[17:16:33] bradland: that will allow you to focus on writing Ruby code, rather than learning a framework.
[17:16:33] synthroid: has joined #ruby
[17:16:38] bradland: depending upon your final application goals, you may choose to stay with Sianatra, or move to a larger framework, such as Ruby on Rails.
[17:16:44] kerframil: has joined #ruby
[17:16:44] [Butch]: has joined #ruby
[17:17:31] dlitvak: has joined #ruby
[17:17:55] jhass: alvarolm: elaborate on your motive? Why would TLS not be sufficient?
[17:18:42] ornerymoose: has joined #ruby
[17:19:41] alvarolm: <jhass> is seems that isn't, MitM atacks seems to be pretty common for us.
[17:19:44] bradland: sometimes business requirements dictate that data must be encrypted while at rest
[17:19:45] hxegon: linocisco, Practical object oriented design in ruby might be better if your beginning
[17:19:50] rakm: has joined #ruby
[17:20:03] jhass: alvarolm: are you maybe conflating transport encryption with authentication and your API lacks the latter?
[17:20:50] B1n4r10: has joined #ruby
[17:21:34] bradland: alvarolm: pinning this on a MitM attack as a result of a TLS break is a pretty far stretch, unless you mean to say that someone has lost control of their CA.
[17:21:53] ElFerna: has joined #ruby
[17:22:03] bradland: in that case, it's "not your problem", but I know how this goes. sometimes it's your problem, regardless.
[17:22:25] bradland: if the business needs dictate that the data needs to be encrypted while at rest, then that's the requirement.
[17:22:26] jhass: alvarolm: in fact TLS is probably better protecting you from MITM than your own solution ever will. Avoiding replay attacks and such in the right way is hard
[17:22:38] bradland: *however* I would not drop TLS.
[17:22:45] havenwood: Anyways, RipeMD-128 in pure Ruby: https://gist.github.com/havenwood/b39abc979402ecd1e496
[17:23:12] shanemcd: has joined #ruby
[17:23:14] bradland: there's nothing silly about using TLS for transport, even if you're sending encrypted data.
[17:23:20] havenwood: The person who wanted it left, and now I've had no coffee and have to rush!
[17:23:37] havenwood: Maybe... one day... someone else will need it.
[17:24:03] bradland: well, i'm still adequately impressed, havenwood
[17:24:23] havenwood: bradland: ;)
[17:24:25] bradland: i'll star anything with Array#pack in it anyway
[17:24:31] idefine: has joined #ruby
[17:25:26] linocisco: hxegon, so learning ruby with OOP first? please dont get me more confused!! :P
[17:25:29] bradland: linocisco: i think he meant instead of the design patterns book.
[17:25:29] bradland: which isn't a terrible suggestion
[17:25:32] amclain: has joined #ruby
[17:25:48] havenwood: http://homes.esat.kuleuven.be/~bosselae/ripemd/rmd128.txt
[17:26:10] yqt: has joined #ruby
[17:26:25] bradland: linocisco: Practical Object Oriented Design in Ruby is more general, which would help you understand the Design Patterns book better.
[17:26:27] pietr0: has joined #ruby
[17:26:30] havenwood: pseudo-run the pseudo-code
[17:27:07] hxegon: linocisco, It's also a lot easier to get through, and ruby specific.
[17:27:10] devbug: has joined #ruby
[17:28:49] cassioscabral: has joined #ruby
[17:29:21] Pathfinder: has joined #ruby
[17:30:35] davejlong: has joined #ruby
[17:30:41] jpfuentes2: has joined #ruby
[17:30:41] msankhala: has joined #ruby
[17:31:05] mloy: has joined #ruby
[17:31:29] snoozelose: has joined #ruby
[17:32:02] dfinninger: has joined #ruby
[17:32:04] tomphp: has joined #ruby
[17:33:01] thezanke: has joined #ruby
[17:33:15] colegatron: has joined #ruby
[17:33:25] cored: has joined #ruby
[17:33:26] cored: has joined #ruby
[17:34:41] rgtk: has joined #ruby
[17:36:50] idefine: has joined #ruby
[17:37:12] RobertBirnie: has joined #ruby
[17:37:24] gaiada: has joined #ruby
[17:44:12] Scripore: has joined #ruby
[17:44:53] last_staff: has joined #ruby
[17:48:00] zast: has joined #ruby
[17:48:26] wolffles: has joined #ruby
[17:51:17] ElFerna: has joined #ruby
[17:51:59] Pathfinder_: has joined #ruby
[17:52:30] jackjackdripper: has joined #ruby
[17:54:02] dlitvak: has joined #ruby
[17:54:57] ixti: has joined #ruby
[17:55:54] baweaver: has joined #ruby
[17:59:01] B1n4r10: has joined #ruby
[17:59:36] goodcodeguy: has joined #ruby
[17:59:58] firstdayonthejob: has joined #ruby
[18:00:47] bensarz: has joined #ruby
[18:00:52] rakm: has joined #ruby
[18:01:01] shevy: hmm calculating the md5sum takes quite a long while?
[18:01:21] jhass: who still uses md5 anyhow
[18:01:34] jhass: it's like not using Unicode yet
[18:01:36] snguyen: has joined #ruby
[18:02:05] rsc___: has joined #ruby
[18:02:13] shevy: I thought it would be fairly cheap but it's now the biggest bottleneck for a commandline ruby file
[18:02:24] shevy: now I can probably not show this information :(
[18:02:47] shevy: I am aiming to functionally clone and auto-generate pages similar to this http://www.linuxfromscratch.org/blfs/view/svn/general/ruby.html - one entry is md5sum ...
[18:03:11] shevy: I guess for a static .html this is no issue ... but on the commandline hmmmmm...
[18:04:46] bensarz: ruby n00b here... I've been googling the hell out of debugging techniques in ruby (I'm using Sublime Text 3). I found Pry and Debugger, (also debugger2) and ruby-debug and pry-byebug and just byebug... I'm using it on Ruby 2.2.3 and Rails 4.2.5. My question is this: is there a debugging standing that allows for break points, stepping over/in/out? I know I could be using RubyMine but I'm on the fence about the licensing...
[18:05:15] bensarz: don't hesitate to redirect me to articles/SO posts if the answer already exists out there
[18:05:25] bensarz: couldn't find anything that was less than a year or two old
[18:05:25] shevy: hmm strange... the commandline md5sum shows the information almost instantly
[18:05:28] jhass: bensarz: pry-byebug does that and would be my recommendation
[18:06:25] bensarz: *debugging standard
[18:06:31] jhass: perhaps adding pry-stack_explorer and pry-doc to the mix
[18:06:38] howdoicomputer: has joined #ruby
[18:06:46] Alayde: has joined #ruby
[18:06:54] bensarz: ok awesome, that's good to know, it felt like pry was a bit outdated but I'm probably wrong
[18:07:04] shevy: require 'digest/md5reverse' is no longer available?
[18:07:25] Alayde: has left #ruby: ()
[18:08:32] jhass: bensarz: yes, very :P
[18:10:31] jbrhbr: has joined #ruby
[18:12:09] juddey: has joined #ruby
[18:13:00] hahuang65: has joined #ruby
[18:14:21] howdoicomputer: has joined #ruby
[18:15:03] nkwsy: has joined #ruby
[18:15:24] Macaveli: has joined #ruby
[18:15:29] baweaver: has joined #ruby
[18:15:52] colleenmcguckin: has joined #ruby
[18:16:14] iWaffles: has joined #ruby
[18:16:59] momomomomo: has joined #ruby
[18:17:13] shanemcd: has joined #ruby
[18:18:12] bronson: has joined #ruby
[18:19:40] NeverDie: has joined #ruby
[18:19:43] nateberkopec: has joined #ruby
[18:21:58] benhuda: has joined #ruby
[18:22:51] bradland: shevy: you sure that was ever Stdlib?
[18:23:00] shanemcd: has joined #ruby
[18:23:56] dlitvak_: has joined #ruby
[18:24:41] jbrhbr: has joined #ruby
[18:25:26] Frem: has joined #ruby
[18:27:19] tenderlove: has joined #ruby
[18:27:24] duckpuppy: has joined #ruby
[18:27:28] pdoherty: has joined #ruby
[18:27:28] pumpkinlemma: has joined #ruby
[18:28:11] pumpkinlemma: has left #ruby: ("WeeChat 0.3.8")
[18:28:51] mikecmpbll: has joined #ruby
[18:28:59] Mon_Ouie: has joined #ruby
[18:29:05] [Butch]: has joined #ruby
[18:29:34] Pathfinder: has joined #ruby
[18:29:53] howdoicomputer: has joined #ruby
[18:30:44] advent1: has joined #ruby
[18:31:58] baweaver: has joined #ruby
[18:33:24] snoozelose: has joined #ruby
[18:34:01] Insti: has joined #ruby
[18:34:17] snoozelose: has joined #ruby
[18:34:22] colleenmcguckin: has joined #ruby
[18:35:49] nertzy: has joined #ruby
[18:35:57] tortle: has joined #ruby
[18:36:43] snoozelose: has joined #ruby
[18:36:44] dionysus69: has joined #ruby
[18:37:11] kaka__: has joined #ruby
[18:40:26] advent1: has left #ruby: ()
[18:40:46] juddey: has joined #ruby
[18:41:06] ElFerna: has joined #ruby
[18:41:16] kalopsian: has joined #ruby
[18:42:23] DeXterbed: has joined #ruby
[18:42:28] jbrhbr: has joined #ruby
[18:43:14] nettoweb: has joined #ruby
[18:45:37] postmodern: has joined #ruby
[18:45:38] dlitvak: has joined #ruby
[18:46:23] steffkes: has joined #ruby
[18:47:37] sneakerhax: has joined #ruby
[18:48:19] snockerton: has joined #ruby
[18:48:55] dfinninger: has joined #ruby
[18:49:26] Papierkorb: how do I convert a Fixnum from network byte order to host byte order?
[18:50:16] pipework: Papierkorb: Isn't network usually big and most computers are big, so you'll just have to detect if the machine is little and then handle that?
[18:50:23] pipework: Or are you needing help handling, not just detecting?
[18:51:03] Papierkorb: pipework: handling, I know that the received stuff is in network order (so yes, big endian), and need to turn it into host order. host order is little endian here
[18:51:09] jhass: Papierkorb: I don't it's possible to have an actual Fixnum instance in the wrong byte order
[18:51:14] Papierkorb: it's a small script, don't really care if it just fits that case
[18:51:21] jhass: that is if you have the way you obtain it is what needs fixing, not the Fixnum itself
[18:51:38] jhass: *don't think
[18:51:39] pipework: Yeah, I don't even understand what that meant.
[18:51:50] Papierkorb: Why should a Fixnum care what the byte order it is in?
[18:51:58] jhass: that's my point?
[18:51:59] Papierkorb: I need to reverse it byte-wise
[18:52:04] Papierkorb: Nothing else.
[18:52:16] jhass: Are you asking how to use Array#pack?
[18:52:40] pipework: Papierkorb: Here's just some googling I did. http://stackoverflow.com/questions/17498725/convert-4-bytes-to-integer-using-little-endian-format-least-signficant-byte-fir
[18:52:53] pipework: You'll likely need to use some String#unpack too.
[18:53:03] pipework: Or #unpack whatever.
[18:54:46] bradland: Papierkorb: the reason you're having difficulty getting an answer is because the question isn't entirely clear. internally, you can't affect the byte order of Fixnum within Ruby. you can only affect the byte order of buffers (strings in Ruby).
[18:55:26] bradland: so you read from the wire in to a string, then use pack/unpack to change the byte order for what will be sent back out over the wire, or persisted somewhere.
[18:55:29] Papierkorb: I have a Fixnum which I get out of a HEX string which is in big endian. Need a fixnum out of it using whatever the host uses, possibly doing endian conversion
[18:55:41] pipework: Papierkorb: Papierkorb: Invert this? http://stackoverflow.com/questions/16077885/how-to-convert-to-big-endian-in-ruby
[18:55:44] pipework: reverse that
[18:56:18] berserk_ren: has joined #ruby
[18:56:21] bradland: Papierkorb: you'll need to post some code to get more help than what you've got so far.
[18:56:33] Papierkorb: bradland: parts[7].to_i 16
[18:56:37] Papierkorb: that's litterally it.
[18:56:57] bradland: and parts[7] is a string value, I presume?
[18:56:58] jhass: Papierkorb: use String#unpack instead
[18:57:12] jhass: possibly twice to turn the hex into actual bytes and then decode the number
[18:57:20] bradland: highly recommended that you get familiar with String#unpack and Array#pack if you're going to work with bytes
[18:57:22] pipework: See my last link.
[18:57:35] pipework: kinda covers the last minute or so of the chat.
[18:57:52] Papierkorb: And all I need is ntohl()
[18:58:07] jhass: String#unpack is Ruby's interface to exactly that function
[18:58:19] jhass: well s/exactly//
[18:58:21] bradland: also, recommend that you set your string encoding to BINARY when creating/modifying strings you intend to use as binary buffers
[18:58:26] jhass: but functionality class wise
[18:58:29] ruby-lang706: has joined #ruby
[18:58:38] antgel: has joined #ruby
[18:58:48] ruby-lang706: hi can anyone help me with a quesiton i have
[18:58:58] havenwood: ruby-lang706: ask away!
[18:59:01] bithon: has joined #ruby
[18:59:01] podman: has joined #ruby
[18:59:02] ruby-lang706: it is most likely easy to most of you as i am still learning
[18:59:10] jhass: no worries
[18:59:21] agent_white: has joined #ruby
[19:00:17] ruby-lang706: i am doing practice problems and it asks that i create a method that takes an array of integers and returns the sum of all the odd parts
[19:00:24] ruby-lang706: two problems i am encountering
[19:00:25] yqt: has joined #ruby
[19:00:34] hobodave: has joined #ruby
[19:00:36] bradland: Papierkorb: i'll see if i can wire up a method def for you, but i need a few to get through my current work item.
[19:01:01] norc: has joined #ruby
[19:01:07] ruby-lang706: if someone gives it anything other than a number it returns non defined local variable
[19:01:13] ascarter: has joined #ruby
[19:01:16] Papierkorb: bradland: Bit twiddling hacks are no issue. main concern was if there was a fast built-in for that
[19:01:21] jhass: ?code ruby-lang706
[19:01:21] ruboto: ruby-lang706, We can't help you without your code, please post it to https://gist.github.com
[19:01:31] ruby-lang706: also i dont know how to add the elements in the index but i can output the odd ones
[19:01:58] ruby-lang706: ok give me a few i will create a gist
[19:02:21] bradland: Papierkorb: Array#pack and String#unpack are the fastest (performance wise)
[19:02:46] bradland: i've benchmarked them
[19:03:06] norc: bradland: Since I just hopped in, what is this about? You peaked my curiosity already.
[19:03:20] jhass: Papierkorb: I think the core issue here is that you're asking for specific way to solve it. Give us exact input and exact desired output and soon enough you'll have the most adequate solution
[19:03:22] hxegon: quick room poll; Anyone here used a text editor and then switched to rubymine? or vice versa?
[19:03:42] Papierkorb: jhass: sniffing USB data. https://www.kernel.org/doc/Documentation/usb/usbmon.txt
[19:03:55] bradland: reversing the byte order of a string buffer
[19:03:57] Papierkorb: jhass: and make it *fast*. not convenient to code. just go fast.
[19:04:01] dhollinger: has joined #ruby
[19:04:27] jhass: Papierkorb: ok. give us the .inspect of your source data and the value you want out of it
[19:04:42] norc: Papierkorb: If you want it done fast, dont do it in Ruby. Write an extension and use FFI.
[19:05:11] bradland: Array#pack and String#unpack are highly optimized
[19:05:23] dlitvak: has joined #ruby
[19:05:24] Papierkorb: norc: I'm already considering calling into the libc. I've forgotten though if htonl() was a glibc macro or not
[19:05:29] gagrio_: has joined #ruby
[19:05:29] bradland: i wouldn't be surprised if they beat the overhead of FFI for such a basic operation
[19:05:41] jzigmund_: has joined #ruby
[19:06:43] ruby-lang706: this is the gist link
[19:06:48] ruby-lang706: https://gist.github.com/Cryptochris/cb3abd6923147ca32d57#file-gistfile1-txt
[19:07:04] nettoweb: has joined #ruby
[19:07:32] norc: bradland: Mmm
[19:08:05] eam: Papierkorb: have you considered using FFI to do your conversions for you?
[19:08:37] pipework: Have you considered just using String#unpack and Array#pack and benchmarking it against whatever you think would be faster?
[19:08:46] ruby-lang706: i am trying to add the elements that are odd but i only output them, also if given anything other than a number my method has an error
[19:09:01] Papierkorb: pipework: I'm writing a benchmark. I can't do everything at once.
[19:09:02] eam: oh, I see bradland beat me to the recommendation while I was reading sb
[19:09:08] tenderlove: has joined #ruby
[19:09:10] pipework: Papierkorb: Then you're clearly not an emacs user
[19:09:21] norc: Papierkorb: I think this is where premature optimization will be an issue.
[19:09:28] eam: the nice thing about FFI is you're likely dealing with entire structs, not just ints
[19:09:31] bradland: to be clear, i haven't benchmarked them against FFI, personally
[19:09:35] eam: and it'll handle that for you
[19:09:39] davejlong: has joined #ruby
[19:09:40] norc: Papierkorb: Using unpack/reverse!/pack should be sufficiently fast like bradland says. If its an issue, you can still find another solution.
[19:09:42] Papierkorb: norc: no. this is a self-contained, 20 line ruby script. it could even be a bash script.
[19:09:55] jhass: ruby-lang706: and what's the exact error message you're getting?
[19:10:09] norc: Papierkorb: My point is, try unpack/reverse!/pack and see how it performs.
[19:10:27] Papierkorb: norc: [20:09] <Papierkorb> pipe_nohighlight_work: I'm writing a benchmark. I can't do everything at once.
[19:10:45] f00bar-32: has joined #ruby
[19:10:56] norc: Papierkorb: You spent more time here discussing this than trying it out would have cost you. ;-)
[19:11:02] ruby-lang706: @jhass if someone passed the method anything other than a number it returns non defined local variable
[19:11:18] ruby-lang706: the other thing is im not adding the elements only seperating them
[19:11:28] jhass: ruby-lang706: I don't think that's the exact error message you get from Ruby
[19:11:35] jhass: as a programmer you need to be precise
[19:11:37] bradland: and here i am frantically copy/pasting in to a spreadsheet so i can deconstruct this SharedMemory.h file :)
[19:12:04] jhass: ruby-lang706: also one issue at a time
[19:12:13] ruby-lang706: @jhass it says nameerror
[19:12:32] jhass: ruby-lang706: I've never seen Ruby say just "nameerror"
[19:12:43] ruby-lang706: "undefined local variable or method" when the method i used is passed something other than a number
[19:12:44] jhass: there's usually a ton more context alongside it
[19:12:52] jhass: still vague
[19:13:11] jhass: I'll just keep asking you for the exact error messages you're getting until you provide them
[19:13:43] ruby-lang706: <NameError: undefined local variable or method `hello' for main:Object> > @jhass
[19:13:48] ruby-lang706: is when i pass "hello" to my method
[19:13:50] yos7ph: has joined #ruby
[19:14:04] jhass: do you pass the string "hello" or the bare word hello?
[19:14:10] baweaver: has joined #ruby
[19:14:19] ruby-lang706: odd_sum(hello)
[19:14:22] ruby-lang706: and i get the error
[19:14:36] jhass: ruby-lang706: well, that's quite expected, the hello there is a local variable or method call
[19:14:49] jhass: but neither a local variable nor method hello is available
[19:15:01] jzigmund: has joined #ruby
[19:15:11] jhass: did you mean to odd_sum("hello") ?
[19:15:23] jhass: passing the string "hello"?
[19:15:42] ruby-lang706: just using it to see if it would make an error i think?
[19:15:43] jhass: then I don't see what kind of value you expect hello to be
[19:15:46] ruby-lang706: not sure why i used hello
[19:15:49] zeroDivisible: has joined #ruby
[19:15:51] jhass: well, it made an error, no?
[19:15:58] Papierkorb: https://gist.github.com/Papierkorb/81a406af843275ca0db6 the #pack dance is abysmally slow
[19:16:12] Papierkorb: Which is expected with its GC overhead
[19:16:34] Renich: has joined #ruby
[19:17:43] ruby-lang706: @jhass if i use "hello" i get this as error => #<TypeError: no marshal_dump is defined for class Proc> >
[19:17:44] saddad: has joined #ruby
[19:18:17] jhass: ruby-lang706: on which line of your code?
[19:18:37] ruby-lang706: how can i tell which line has the error?
[19:18:49] jhass: it's in the full error message
[19:18:56] jhass: file:line
[19:18:56] shanemcd: has joined #ruby
[19:18:59] ruby-lang706: i copied and pasted full error
[19:19:06] jhass: I don't think so
[19:19:15] ruby-lang706: thats all that is there
[19:19:31] jhass: you do ruby foo.rb or what?
[19:19:42] ruby-lang706: idk what that is
[19:19:46] NeverDie: has joined #ruby
[19:20:13] ElFerna: has joined #ruby
[19:20:38] jpfuentes2: has joined #ruby
[19:20:41] saddad: has joined #ruby
[19:20:59] dfinninger: has joined #ruby
[19:21:09] kalopsia1: has joined #ruby
[19:21:10] howdoi: has joined #ruby
[19:21:50] Pathfinder_: has joined #ruby
[19:21:53] ruby-lang706: ok well i guess error messages not going to be resolved
[19:22:02] ruby-lang706: maybe help me with how to add the elements once i have the odd ones?
[19:23:17] ElFerna: has joined #ruby
[19:23:19] optikalmouse: has joined #ruby
[19:23:23] jhass: ruby-lang706: how do you use ruby?
[19:23:40] bradland: Papierkorb: did you work out a solutoin?
[19:23:47] bradland: I just wrapped up my other work.
[19:23:53] Papierkorb: bradland: https://gist.github.com/Papierkorb/81a406af843275ca0db6
[19:24:15] Papierkorb: bradland: but replace the :int with :uint32
[19:24:15] shanemcd: has joined #ruby
[19:24:43] bradland: looks like FFI wins!
[19:24:46] momomomomo: has joined #ruby
[19:25:29] jhass: ruby-lang706: no literally, how? how do you run your ruby code?
[19:25:54] ruby-lang706: im using a site that runs it
[19:25:59] gagrio_: has joined #ruby
[19:26:23] Cohedrin: has joined #ruby
[19:26:37] bradland: a = 0x11223344
[19:27:09] jhass: isn't try ruby running a fake interpreter?
[19:27:16] jhass: I'm surprised it even allows Proc.new
[19:27:19] lkba: has joined #ruby
[19:27:21] ruby-lang706: idk what that means
[19:27:44] bradland: Papierkorb: eh, i'm not sure this benchmark is valid
[19:28:03] pwnd_nsfw: has joined #ruby
[19:28:04] jhass: ruby-lang706: you can rewrite your select to odd_numbers = numbers.select {|number| number.even? }
[19:28:13] bradland: for bits and ntoh, you're operating on a Fixnum, but for pack/unpack you're operating on a string
[19:28:23] solars: has joined #ruby
[19:28:27] jhass: ruby-lang706: and compute the sum using ri:Enumerable#reduce
[19:28:28] bradland: so, presumably, this value comes from somewhere over a wire, right?
[19:28:28] `derpy: method `Enumerable#reduce`: Combines all elements of enum by applying a binary operation, specified by a blo??? ??? http://rubydoc.info/stdlib/core/Enumerable#reduce-instance_method
[19:28:33] tomaz_b: has joined #ruby
[19:28:34] bradland: which is going to be IO, which will result in a string
[19:28:38] bradland: not a Fixnum
[19:28:42] Papierkorb: bradland: no, that's fine. that's what I get, and I'm just taking advantage of it there
[19:28:55] bradland: so, you get a Fixnum?
[19:28:59] Papierkorb: bradland: so, in fact, I'm doing it an favor and it's still 5x slower
[19:29:05] Papierkorb: no, i get a hex string.
[19:29:40] bradland: in the pack benchmark, you're performing extra work
[19:29:46] ruby-lang706: @jhass so my method is all wrong?
[19:29:55] Papierkorb: bradland: mh?
[19:30:20] jhass: ruby-lang706: it's rather unidiomatic/convoluted
[19:30:57] ruby-lang706: why do you search for even numbers then reduce? i dont quite understand the doc on .reduce
[19:31:14] jhass: ruby-lang706: oh right, .odd? not .even?, sorry
[19:31:52] jhass: ruby-lang706: did you look at the examples? there's one for summing right there
[19:32:16] ruby-lang706: it just adds the range?
[19:32:16] ruby-lang706: yes but i dont understand it exactly
[19:32:26] bradland: Papierkorb: the bits and ntoh bencmarks are starting with a Fixnum, while pack has to start from a String
[19:32:28] ruby-lang706: will it exclude the even since we are using the odd? method?
[19:32:35] bradland: which results in extra pack/unpack calls
[19:32:48] bradland: not that i think it's going to get down to 0.09s, but it's worth noting
[19:32:51] bradland: this is not apples-to-apples
[19:32:56] jhass: ruby-lang706: the select will give you new array with only the odd numbers, that new array is what you should use reduce on to sum
[19:33:14] jhass: (reduce/inject are two names for the same method)
[19:33:14] cassioscabral_: has joined #ruby
[19:33:37] kirun: has joined #ruby
[19:33:39] bradland: if you start with a string, your benchmarks for bits and ntoh need to do the work of converting from String to Fixnum within the benchmark
[19:33:56] ruby-lang706: ok i have to read about those methods idk them
[19:34:24] kadoppe: has joined #ruby
[19:34:31] ur5us: has joined #ruby
[19:35:19] norc: has joined #ruby
[19:35:36] shevy: ruby-lang706 .select is trivial, you select based on the conditions you put inside your {} block
[19:35:38] norc: unit.send(:*, arg).to('db')
[19:35:42] norc: Why does this feel so ugly. :(
[19:35:44] Zamerick: has joined #ruby
[19:35:52] shevy: because you write ugly code!
[19:36:36] dmolina: has joined #ruby
[19:36:39] ruby-lang706: i havent seen .reduce or .inject so maybe trivial to you guys but new to me
[19:36:55] norc: Or is there another way to chain operators that Im not away of?
[19:37:09] devbug: has joined #ruby
[19:39:22] optikalmouse: has left #ruby: ()
[19:39:30] whiteline: has joined #ruby
[19:39:41] dlitvak: has joined #ruby
[19:39:46] sulky: has joined #ruby
[19:40:49] ElFerna: has joined #ruby
[19:41:28] jhass: norc: I'd prefer (unit * arg).to('db')
[19:41:50] B1n4r10: has joined #ruby
[19:41:57] jackjackdripper: has joined #ruby
[19:42:53] momomomomo: has joined #ruby
[19:44:06] emrox: has joined #ruby
[19:44:36] devbug: has joined #ruby
[19:45:30] goodcodeguy: has joined #ruby
[19:45:44] devbug: has joined #ruby
[19:45:51] shevy: ruby-lang706 yeah that name is a bit weird
[19:46:11] ruby-lang706: i was getting undefined method name for reduce but when i used .inject it worked
[19:46:14] centrx: has joined #ruby
[19:46:20] shevy: I myself use .inject as well
[19:46:54] ruby-lang706: glad i found inject i was trying to index the elements and was thinking i had to add each one depending on the length xD
[19:47:02] ruby-lang706: thank you guys
[19:47:24] jbrhbr: inject seems kinda funky to me
[19:47:54] ruby-lang706: is there any major difference between .reduce or .inject? can they be used interchangably?
[19:48:00] jbrhbr: at least the memo form
[19:48:04] troulouliou_dev: has joined #ruby
[19:48:20] cored: has joined #ruby
[19:48:20] cored: has joined #ruby
[19:48:46] hectortrope: has joined #ruby
[19:48:56] ruby-lang706: my other question i might not be asking correctly
[19:49:03] ruby-lang706: how do i make the method more usable?
[19:49:20] ruby-lang706: if i give anything other than number it errors
[19:49:26] troulouliou_dev: has joined #ruby
[19:49:27] jhass: ruby-lang706: yes reduce and inject are aliases of each other, they're the same method
[19:49:48] jhass: ruby-lang706: what result would you expect for odd_sum("hello", "world")?
[19:50:13] pdoherty: has joined #ruby
[19:50:21] ruby-lang706: @jhass i would expect maybe helloworld ?
[19:50:27] troulouliou_dev: has joined #ruby
[19:50:42] jhass: why? what has that to do with the operation "sum all odd numbers"?
[19:51:10] Pumukel: has joined #ruby
[19:51:19] ruby-lang706: what if the person using our method types in a string or something?
[19:51:40] jhass: then they made a mistake in using the method and should receive an error, no?
[19:51:45] jbrhbr: you can either do validation or it's their problem
[19:51:56] ruby-lang706: i ran the odd_sum("hello", "world") and got #<NoMethodError: undefined method `odd?' for "hello":String>
[19:53:18] treehug88: has joined #ruby
[19:53:42] dfinning_: has joined #ruby
[19:56:34] baweaver: has joined #ruby
[19:56:57] ruby-lang706: @jhass what is validation?
[19:57:40] jhass: raise ArgumentError.new("Expected only numbers") unless numbers.all? {|number| number.is_a? Numeric } for example
[19:57:46] jhass: I wouldn't recommend it here
[19:58:30] dlitvak: has joined #ruby
[19:58:52] blackmesa: has joined #ruby
[20:00:10] ruby-lang706: @jhass that is new to me i have to read about that
[20:00:15] pawnbox: has joined #ruby
[20:02:10] skade: has joined #ruby
[20:02:30] kristianpaul: has joined #ruby
[20:03:04] speakingcode: has joined #ruby
[20:04:02] xaxisx: has joined #ruby
[20:04:40] momomomomo: has joined #ruby
[20:05:21] JohnBat26: has joined #ruby
[20:08:14] Dimik: has joined #ruby
[20:09:00] ascarter: has joined #ruby
[20:09:12] shanemcd: has joined #ruby
[20:10:02] dlitvak_: has joined #ruby
[20:12:59] pawnbox: has joined #ruby
[20:13:10] jbrhbr: has joined #ruby
[20:15:21] eytanfb: has joined #ruby
[20:15:27] hakunin: has left #ruby: ()
[20:15:58] trautwein: has joined #ruby
[20:16:06] houhoulis: has joined #ruby
[20:18:15] phantumm1: has joined #ruby
[20:18:50] dfinninger: has joined #ruby
[20:19:07] steffkes: has joined #ruby
[20:19:07] steffkes: has joined #ruby
[20:20:25] lkba_: has joined #ruby
[20:20:30] dfinninger: has joined #ruby
[20:21:44] leat: has left #ruby: ()
[20:22:01] idefine: has joined #ruby
[20:23:21] wasane: has joined #ruby
[20:23:39] Pathfinder: has joined #ruby
[20:23:51] yfeldblum: has joined #ruby
[20:25:19] baweaver: has joined #ruby
[20:27:03] blackgoat: has joined #ruby
[20:27:46] ElFerna: has joined #ruby
[20:28:08] Phage: has left #ruby: ()
[20:28:08] ascarter: has joined #ruby
[20:28:22] S01780: has joined #ruby
[20:29:43] shanemcd: has joined #ruby
[20:31:33] ElFerna: has joined #ruby
[20:33:02] nettoweb: has joined #ruby
[20:33:57] aryaching: has joined #ruby
[20:34:13] houhoulis: has joined #ruby
[20:34:44] idakyne: has joined #ruby
[20:35:21] djbkd: has joined #ruby
[20:36:51] bbert: has joined #ruby
[20:36:52] bbert: has joined #ruby
[20:39:45] Phage: has joined #ruby
[20:43:01] pawnbox: has joined #ruby
[20:43:53] bithon: hello. anyone here use rbenv? i'm having a slight issue with setting up global ruby version on my system
[20:44:16] bithon: i issue a following command 'rbenv global 2.2.3', yet older version is still the default (i.e. when i do ruby -v i get 2.2.2)
[20:45:21] jhass: `which ruby` ?
[20:45:53] bithon: ~/.rbenv/shims/ruby
[20:47:14] jhass: ACTION shrugs
[20:47:28] jhass: (while true; do rbenv rehash; done) &
[20:47:57] bithon: is this a bug or something
[20:48:21] bithon: lol silly me
[20:48:36] bithon: yes forgot to rehash
[20:48:42] bithon: thanks jhass
[20:48:53] bithon: haven't used rbenv in months
[20:49:32] nfk|laptop: has joined #ruby
[20:52:48] Pathfinder_: has joined #ruby
[20:53:00] alphaatom: has joined #ruby
[20:53:10] pwnd_nsfw: has joined #ruby
[20:55:43] spider-mario: has joined #ruby
[20:55:47] adaedra: jhass: dat solution.
[20:56:02] jhass: adaedra: problem?
[20:56:30] adaedra: I'd have thought you would come with a more efficient one. :p
[20:56:48] jhass: meh, don't care enough about rbenv
[20:58:03] baweaver: has joined #ruby
[20:58:19] webus: has joined #ruby
[20:58:46] shevy: you use rvm?
[20:59:31] s2013: has joined #ruby
[20:59:40] havenwood: shevy: https://gist.github.com/jhass/8839655bb038e829fba1
[20:59:51] havenwood: shevy: Do your research! :P
[21:00:23] bronson: has joined #ruby
[21:00:53] shevy: the yoghurt package manager
[21:01:52] norc: has joined #ruby
[21:02:15] norc: has joined #ruby
[21:02:15] norc: has joined #ruby
[21:03:22] hxegon: the best ruby version manager is arch linux clearly
[21:03:23] dlitvak: has joined #ruby
[21:03:31] xaxisx: has joined #ruby
[21:04:04] minimalism: has joined #ruby
[21:05:38] norc: Hi folks. I somehow have this script lying around http://pastie.org/10634816# (I removed basically a few hundred lines of crap code instead of that task.execute). Is there a more elegant way to parallelize this?
[21:05:56] rakm: has joined #ruby
[21:06:55] norc: There are only a few hundred nodes around, so I have no need for a worker pool and what not
[21:08:28] htmldrum: has joined #ruby
[21:08:42] hahuang65: has joined #ruby
[21:08:58] butterlord: has joined #ruby
[21:09:07] butterlord: I need some help... I need to change a chunk of HTML on a header/topbar on a specific page. Is this possible? Basically if its the page i specify, display the altered HTML, if not display the normal
[21:09:32] idefine: has joined #ruby
[21:12:01] norc: butterlord: Is this about rails?
[21:13:23] eytanfb: has joined #ruby
[21:14:57] stannard_: has joined #ruby
[21:15:10] stannard_: has joined #ruby
[21:17:40] idefine: has joined #ruby
[21:18:47] bithon: butterlord: best. name. ever.
[21:19:58] slash_nick: What's the best way to get `cat path/to/thesefiles_*_*.csv` with ruby?
[21:20:12] Xaitec: has joined #ruby
[21:20:14] slash_nick: I'm assuming I can do it with a oneliner without shelling out
[21:21:03] jhass: Pathname.glob("path/to/thesefiles_*_*.csv").map(&:read).join
[21:21:05] adaedra: slash_nick: `Dir['path/to/thesefiles_*_*.csv'].map(&IO.method(:read)).join
[21:21:09] wrivera: has joined #ruby
[21:21:18] adaedra: lacks a closing `.
[21:21:20] jgt3: has joined #ruby
[21:21:41] slash_nick: thanks you two :)
[21:21:52] davedev24: has joined #ruby
[21:23:39] Pathfinder: has joined #ruby
[21:24:38] webus: has joined #ruby
[21:24:57] atomical_: has joined #ruby
[21:25:35] rodfersou: has joined #ruby
[21:26:15] moonman: has joined #ruby
[21:26:15] ChanServ: +b *Moonman*!*@*
[21:26:15] ChanServ: ChanServ kicked Moonman: is banned from this channel
[21:26:28] gizless: has joined #ruby
[21:27:05] finisherr: has joined #ruby
[21:27:37] finisherr: Where can I find some good literature on metaprogramming concepts?
[21:27:48] finisherr: I'm trying to basically generate methods and classes
[21:28:23] lemur: has joined #ruby
[21:28:34] hxegon: finisherr, try the seventh level of hell, I hear they have an excellent library. </jk>
[21:28:41] failshell: has joined #ruby
[21:29:08] finisherr: I'm just seeing a lot of repetition in some code I'm writing
[21:29:15] finisherr: maybe i can leverage define_method a bit
[21:29:18] finisherr: but that's about all i'm aware of
[21:31:02] quazimodo: has joined #ruby
[21:31:37] norc: finisherr: Just please, whatever you do. Don't use method_missing. :(
[21:32:22] skade: has joined #ruby
[21:33:34] bodgix: has joined #ruby
[21:33:57] CaptainCibai: has joined #ruby
[21:33:59] momomomomo: has joined #ruby
[21:34:37] baweaver: has joined #ruby
[21:34:44] davedev24: has joined #ruby
[21:35:13] c355E3B: has joined #ruby
[21:35:13] shevy: finisherr there isn't that much really; you have ... define_method method_missing respond_to? and the various *eval* variants
[21:35:29] finisherr: This might be the wrong approach
[21:35:33] shevy: and some hooks
[21:35:33] wildlander: has joined #ruby
[21:36:04] finisherr: I'll try to find a good pattern that fits the mold a bit
[21:37:08] calderonroberto: has joined #ruby
[21:37:11] Cohedrin: has joined #ruby
[21:37:44] norc: finisherr: Basically most of the time using various forms of mixins (especially prepend), together with various techniques of defining methods and send gets you pretty far.
[21:39:50] shevy: ah yes I forgot about .send
[21:40:06] CaptainCibai: has joined #ruby
[21:40:07] shevy: finisherr if you wanna go totally crazy, also use Fiddle and manipulate pointers
[21:40:21] norc: That has nothing to do with metaprogramming...
[21:40:23] shevy: there used to be a collection of evil code in a file called evil.rb
[21:40:51] shevy: norc I consider what Ox0dea is doing absolutely meta
[21:41:21] hxegon: necronomicon.rb
[21:42:30] norc: shevy: The whole point of metaprogramming extends on reflection, ducktyping - these sorts of things. When you start breaking down into the memory (i.e. Fiddle), that is the exact opposite way..
[21:42:48] norc: Its not abstraction, its implementation.
[21:42:59] mg^: https://github.com/yugui/evil-ruby/blob/master/lib/evil.rb
[21:43:32] mg^: "Is_1_8 = RUBY_VERSION[/\A1.[678]/]"
[21:43:42] mg^: might be 1.8, or approximately so
[21:44:03] norc: Ah, that is still using DL.
[21:44:06] shevy: evil.rb was cool
[21:44:26] juddey: has joined #ruby
[21:44:38] ruby-lang706: can someone help me with understanding http://ruby-doc.org/core-2.1.0/Enumerable.html#method-i-each_cons
[21:44:41] dlitvak: has joined #ruby
[21:45:05] ruby-lang706: if i add .inject with the each_cons
[21:45:14] brendan-: has joined #ruby
[21:45:22] ruby-lang706: will it add the last index in the array with index 0?
[21:45:58] rubio: has joined #ruby
[21:46:12] TomPeed: has joined #ruby
[21:47:46] TomPeed: has joined #ruby
[21:48:36] jbrhbr: has joined #ruby
[21:49:16] baweaver: ruby-lang706: what are you trying to do?
[21:49:47] kerframil: has joined #ruby
[21:49:47] baweaver: also, consider picking a nickname
[21:50:15] ruby-lang706: @baweaver i am trying to add 3 consecutive elements in an array to see if they add up to 8
[21:50:19] baweaver: https://freenode.net/faq.shtml#contents-userregistration
[21:50:44] baweaver: lets take another step back
[21:50:53] baweaver: what is the entire problem?
[21:51:24] ruby-lang706: create method which takes in an array of integers and returns true if any three consecutive elements sum to 8
[21:51:35] ruby-lang706: practice problem im learning ruby
[21:51:44] baweaver: each cons won't work
[21:51:57] baweaver: that's each consecutive 3
[21:52:15] ruby-lang706: each con is 0,1,2 then 3,4,5 ?
[21:52:36] baweaver: why don't you try and find out?
[21:52:36] ruby-lang706: not 0,1,2 then 1,2,3 ?
[21:52:54] baweaver: ruby comes with irb to experiment with
[21:53:07] baweaver: learn to use it, it's a requirement to use ruby well
[21:53:11] ruby-lang706: im using it froma browser
[21:53:22] ruby-lang706: how do i use irb
[21:53:35] jbrhbr: install ruby on your machine and type irb
[21:53:39] baweaver: the next thing you want to learn is how to properly search the internet for things
[21:53:56] howdoicomputer: has joined #ruby
[21:53:59] baweaver: such as putting in google: "How do I use irb?"
[21:54:01] ruby-lang706: i thought i searched i was confused thats why i asked
[21:54:17] ruby-lang706: i didnt know of irb until u just told me
[21:54:27] baweaver: https://www.ruby-lang.org/en/documentation/quickstart/
[21:55:02] duncannz: has joined #ruby
[21:55:15] rakm: has joined #ruby
[21:56:10] baweaver: so it was consecutive, misread it.
[21:56:19] jgt3: has joined #ruby
[21:58:00] baweaver: find out what each_cons returns in irb
[21:58:03] nfk|laptop: has joined #ruby
[21:58:15] baweaver: then look for a method that will "find" something or return nothing
[21:58:20] mg^: each_cons, nice little method
[21:58:40] baweaver: but honestly if you're learning to program I would not use that method
[21:58:51] aspire: has joined #ruby
[21:59:13] baweaver: why, you may ask? Ask yourself how it's implemented. If you can't answer that you should always consider digging a little deeper.
[22:00:01] tomphp: has joined #ruby
[22:00:09] baweaver: the hint I would give on the implementation of each_cons has something to do with a Stack using push and pop on Array
[22:00:55] kmckelvi1: has joined #ruby
[22:01:20] jbrhbr: man there are so many built-in methods
[22:01:51] stannard: has joined #ruby
[22:02:05] baweaver: Suggested reading: Enumerable, String. Memorize those two and you're set for a while.
[22:02:21] baweaver: Scala has more of a kitchen sink than ruby though
[22:03:10] Scripore: has joined #ruby
[22:03:17] rsc___: has joined #ruby
[22:03:28] chipotle: has joined #ruby
[22:03:35] jbrhbr: i haven't used it but that is surprising
[22:03:49] jbrhbr: if it's in the core language
[22:04:13] jbrhbr: although all of my experience so far has been with rails so it's hard for me to know what rails has monkey-patched in vs what's core at this point :/
[22:04:25] stannard: has joined #ruby
[22:04:41] vifino: has joined #ruby
[22:04:46] cassioscabral: has joined #ruby
[22:05:12] ruby-lang706: i tried searching for a method that finds something but returns nothing and all i got was that ruby always returns something
[22:05:25] sucks: has joined #ruby
[22:05:44] baweaver: http://ruby-doc.org/core-2.1.5/Enumerable.html
[22:06:05] baweaver: what method returns true if any element is true?
[22:08:09] agent_white: has joined #ruby
[22:08:55] baweaver: I would suggest reading through The Well Grounded Rubyist or Eloquent Ruby
[22:09:10] solars: has joined #ruby
[22:10:25] ruby-lang706: ok ill download those now
[22:10:30] baweaver: they'll cover a lot of groundwork
[22:10:42] atom3: has joined #ruby
[22:10:44] baweaver: also ill-advised to mention you're "downloading" them
[22:11:03] ruby-lang706: they are linked for free pdf format on front page of google
[22:11:17] ruby-lang706: i dont think they mind if i had a copy on my comp
[22:11:20] baweaver: yeah, that's called pirated copy
[22:11:32] baweaver: and really not a good idea to talk about on channel
[22:11:55] sucks: has joined #ruby
[22:12:03] ruby-lang706: ill pay for the books right away
[22:12:46] pawnbox: has joined #ruby
[22:13:17] tulak: has joined #ruby
[22:13:29] idefine: has joined #ruby
[22:14:50] bronson: has joined #ruby
[22:16:44] NeverDie: has joined #ruby
[22:17:02] hobodave: has joined #ruby
[22:18:19] saddad: has joined #ruby
[22:19:01] ruby-lang706: so maybe the each_with_object combined with .any
[22:19:18] ruby-lang706: i have ruby installed and typed irb
[22:20:15] vifino: has joined #ruby
[22:21:09] baweaver: >> (1..5).each_cons(3).any? { |xs| xs.reduce(0, :+) == 8 } # The each_cons implementation
[22:21:10] ruboto: baweaver # => false (https://eval.in/485906)
[22:22:02] dreinull: has joined #ruby
[22:22:15] ruby-lang706: i stopped with the each_cons and im trying the .any from the page you linked me
[22:22:16] baweaver: for the other, you want to look into what a stack is. Push elements onto it until you have 3, then sum them.
[22:22:31] zeroDivisible: has joined #ruby
[22:22:39] ruby-lang706: ok ill look up stack now
[22:22:42] bodgix: I've just tested that TCPSocket.new 'fqdn', port tries the next A record of fqdn if fqdn has multiple A records and the 1st one fails. I didn't find any mentions of that in the docs
[22:22:45] baweaver: anyways, meetings
[22:23:24] bodgix: anyone knows if that's something portable or platform dependent?
[22:26:18] bithon: has joined #ruby
[22:29:31] dfinninger: has joined #ruby
[22:29:59] finisherr: has joined #ruby
[22:31:13] gregf: has joined #ruby
[22:32:24] Morrolan: has joined #ruby
[22:32:51] gizmore: has joined #ruby
[22:34:44] Scripore: has joined #ruby
[22:34:59] Wompy: has joined #ruby
[22:37:08] viktor_: has joined #ruby
[22:38:12] snoozelose: has joined #ruby
[22:40:33] baweaver: has joined #ruby
[22:41:28] f00bar-32: has joined #ruby
[22:42:34] jdm: has joined #ruby
[22:43:38] ledestin: has joined #ruby
[22:45:27] zenlot1: has joined #ruby
[22:47:41] nofxx: has joined #ruby
[22:47:42] nofxx: has joined #ruby
[22:49:16] Xiti: has joined #ruby
[22:50:36] colleenmcguckin: has joined #ruby
[22:52:19] yfeldblum: has joined #ruby
[22:55:12] kalopsian: has joined #ruby
[22:55:28] edwinvdgraaf: has joined #ruby
[22:56:34] snoozelose: has joined #ruby
[22:57:46] Azure: has joined #ruby
[22:59:12] grill: what exactly is "io" in the context of this module? http://ruby-doc.org/stdlib-1.9.3/libdoc/rubygems/rdoc/Gem/Package/TarReader.html
[22:59:19] grill: are we talking an IO stream?
[22:59:33] Wompy: has left #ruby: ("Leaving...")
[23:00:06] jhass: grill: yeah I would expect anything that .is_a?(IO)
[23:00:18] edwinvdgraaf: has joined #ruby
[23:01:35] grill: how does one open a file with IO
[23:01:54] grill: i've tried read and sysopen, but neither seem to work
[23:02:08] deeprave: has joined #ruby
[23:02:42] Scripore: has joined #ruby
[23:02:49] edwinvdgraaf: has joined #ruby
[23:03:47] charliesome: has joined #ruby
[23:04:41] viktor_: ignore #xkcd-signal MODES JOINS PARTS QUITS
[23:05:36] Scripore: has joined #ruby
[23:08:50] viktor_: grill did you try IO.binread("filename")
[23:09:00] grill: I just used File.open
[23:09:44] vcoinminer_: has joined #ruby
[23:10:05] jhass: grill: just File.open("foo") do |io|
[23:10:57] finisherr: has joined #ruby
[23:13:24] bronson: has joined #ruby
[23:13:47] pawnbox: has joined #ruby
[23:14:39] kobain: has joined #ruby
[23:15:41] colleenmcguckin: has joined #ruby
[23:16:18] Xiti: has joined #ruby
[23:17:58] BTRE: has joined #ruby
[23:18:54] SenpaiSilver: has joined #ruby
[23:19:03] david77: has joined #ruby
[23:22:25] tomphp: has joined #ruby
[23:25:13] rgtk: has joined #ruby
[23:25:39] radgeRayden: has joined #ruby
[23:25:45] arooni: has joined #ruby
[23:26:28] mroth: has joined #ruby
[23:27:09] calderonroberto: has joined #ruby
[23:29:07] lemur: has joined #ruby
[23:31:09] ChameleonSix: has joined #ruby
[23:31:27] ChameleonSix: Can i ask a question
[23:31:34] ruboto: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[23:31:54] ChameleonSix: It has nothing to do with ruby
[23:32:18] jhass: ?offtopic
[23:32:18] ruboto: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[23:32:18] ChameleonSix: Knowledge is better than grades
[23:32:24] jhass: !kick ChameleonSix no single line lols
[23:32:26] ruboto: ruboto kicked ChameleonSix: single line lols
[23:32:26] ruboto: -o ruboto
[23:32:42] ChameleonSix: has joined #ruby
[23:33:02] ChameleonSix: Do you need great grades to be successful
[23:33:03] colegatron: has joined #ruby
[23:33:28] ChameleonSix: I can't understand few things in my life
[23:33:39] ChameleonSix: I mean singers don't
[23:33:52] centrx: Singers are not successful
[23:33:55] znz_jp: has joined #ruby
[23:33:56] jhass: ?offtopic
[23:33:56] ruboto: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[23:34:14] ChameleonSix: But i need someone with experience
[23:34:24] ChameleonSix: People on off topic are retarded
[23:34:50] Coraline: That's offensive.
[23:34:58] ChameleonSix: Ok i was joking
[23:35:11] Coraline: You're not really winning friends here...
[23:35:26] ChameleonSix: I dont need any irc friends
[23:35:31] jhass: cool. bye.
[23:35:31] eytanfb: has joined #ruby
[23:35:50] eytanfb: has joined #ruby
[23:36:05] tvw: has joined #ruby
[23:36:05] hizenger: has joined #ruby
[23:36:27] ChameleonSix: Only programmers can help me
[23:37:16] jhass: join ##chat if you want general casual talk. If your next sentence isn't a Ruby question I will remove you
[23:37:52] ChameleonSix: I don't need good grades to be a good ruby programmer
[23:38:09] jhass: you don't.
[23:38:11] ChameleonSix: Im at high school anyway
[23:38:18] ChameleonSix: But people always say study
[23:38:19] acovrig: has joined #ruby
[23:38:24] ChameleonSix: If you want to go to uni
[23:38:31] jhass: this isn't a life support channel
[23:38:37] ChameleonSix: I can't study fucking history
[23:39:01] acovrig: I???m having a negative sense moment??? in (nokogiri) page.xpath('//table[@id="ctl00_ContentPlaceHolder1_GridView1"]/tr').each do |r|; how can `r??? be nil?
[23:39:23] jhass: acovrig: it shouldn't, how do you assert it is?
[23:39:29] nunchuck: has joined #ruby
[23:39:52] acovrig: jhass: my next line is `p r??? and it returns `nil??? ~50% of the time...
[23:40:15] jhass: acovrig: do you think you can make a minimal example that we can run and see for ourselves?
[23:40:29] acovrig: jhass: sure, gist pending
[23:41:35] ICantCook: has joined #ruby
[23:41:41] acovrig: jhass: https://gist.github.com/acovrig/57d58cdc924b8086733d is the HTML I???m parsing and the script I???m using
[23:43:18] ChameleonSix: has left #ruby: ("Quit")
[23:43:34] acovrig: jhass: nevermind, there is a r.xpath line that was returning nil???
[23:44:03] howdoicomputer: has joined #ruby
[23:44:08] jhass: acovrig: yup, was just about to mention :)
[23:44:17] acovrig: but it does feel odd to have to do a `next if c.nil???? for each loop...
[23:44:33] jhass: acovrig: btw I recommend avoiding single letter vars, they're only confusing
[23:45:08] acovrig: and a `next if c.first.nil???? and a `next if c.xpath(???/div???).nil???? ...
[23:45:14] Ropeney: has joined #ruby
[23:45:52] bronson: has joined #ruby
[23:46:07] acovrig: yea, I should flush those out to better names (and I started to, but when things refused to make sense I dropped back to single letters for speed fo typing as I am trying to figure out why I???m getting rows with 0 columns, or rows that are ???1??? instead of an element)
[23:46:44] jhass: I just made it a habit to basically never use them
[23:46:46] znz_jp: has joined #ruby
[23:46:56] jhass: typing row and column isn't that much slower than r and c after all
[23:50:17] acovrig: jhass: shouldn???t https://gist.github.com/acovrig/57d58cdc924b8086733d#file-parse-rb-L10 be possible? when i run that I get an error that column[1] is nil, but p column shows there are `td???s there???
[23:52:34] jhass: acovrig: really? '/td' restarts at the top
[23:52:38] acovrig: and isn???t there a source_code method (or something like it) to dump the HTML source for the elemnt I have, cuz I kinda can???t read the output of the element with any reasonable amount of time???
[23:52:40] jhass: just 'td' or './td'
[23:52:52] jhass: to_html iirc?
[23:53:01] jhass: or just to_s even
[23:53:11] rflot: has joined #ruby
[23:54:05] jhass: doc.xpath('//table[@id="ctl00_ContentPlaceHolder1_GridView1"]/tr').each_with_object(Hash.new(0)) {|row, counts| counts[row.xpath("td").size] += 1 }
[23:54:07] jhass: => {1=>2, 0=>1, 11=>50}
[23:54:10] jhass: so careful there
[23:54:53] acovrig: jhass: I tried the `td??? and `./td??? and it works the same way???
[23:55:01] acovrig: jhass: wait, what does that mean?
[23:55:06] finisherr: has joined #ruby
[23:55:39] moeabdol1: has joined #ruby
[23:55:59] jhass: that means there's one row without any td's, 2 with only 1 and 50 with 11
[23:56:50] cassioscabral: has joined #ruby
[23:57:08] acovrig: jhass: thanks for the .to_s idea; I can see there is a tr it can???t find any columns, but I can see it has 24 <td> elements...
[23:57:28] jhass: who said 24?
[23:57:33] acovrig: jhass: so I guess I will need a `next if column.count < 5??? line?
[23:57:43] acovrig: jhass: that???s what I count
[23:57:53] acovrig: jhass: so there will be at least 5 columns
[23:57:56] jhass: are you sure you gisted the right html?
[23:58:27] acovrig: jhass: yes, `pbcopy </Volumes/ram/d.html???
[23:58:44] devoldmx: has joined #ruby
[23:58:49] jhass: idk where or how you counted 24 but I trust my code more
[23:58:59] jhass: and the only counts are none, 1 and 11