« Back to channel list

#ruby - 25 June 2017

« Back 1 day Forward 1 day »
[00:00:24] UserOO7: has joined #ruby
[00:02:24] zautomata1: has joined #ruby
[00:03:27] Radar: comet23: hi
[00:03:53] Radar: ACTION comet23: https://learnxinyminutes.com/docs/ruby/ might help
[00:06:56] vincent_: has joined #ruby
[00:09:09] market: | have txt file to |ine uniq
[00:10:33] milardovich: has joined #ruby
[00:15:15] eightlimbed: i'm pretty new to ruby (just started learning about programming a few months ago). i'm quite confused about lambdas. do you guys have any blog posts/tutorials on lambdas bookmarked that were helpful for you? Someone in this room came up with a very elegant solution to one of the project euler problems using a lambda (https://gist.github.com/eightlimbed/dea399ab0cfdad422e0f51e88b7807fe) and I can't wrap my head around what the
[00:15:15] eightlimbed: lambda does and how he came to that solution.
[00:15:46] market: nonconsecutive input is "a" "b" "a" "b"
[00:18:20] market: nonconsecutive repeats that uniq cannot filter out
[00:21:24] Rodya_: has joined #ruby
[00:22:44] market: Lines repeat each other but they aren't one after another
[00:22:49] humanBird: has joined #ruby
[00:23:18] humanBird: shoot i got timed out. anyone know if you can use multiple subjects in rspec?
[00:25:34] UserOO7: has joined #ruby
[00:27:50] cdg: has joined #ruby
[00:29:01] nacsurte: has joined #ruby
[00:29:31] humanBird: oh. there's subject.push but not sure how to push a key value
[00:30:04] hutch34: has joined #ruby
[00:30:19] bkxd: has joined #ruby
[00:30:21] bkxd_: has joined #ruby
[00:31:53] market: dash can do it but it'll screw up order of appearance
[00:42:39] darix: has joined #ruby
[00:43:07] market: dash cannot uniq "a" "b" "b" " "a , it 'd come out as "a " "b " "a" which isn't right, you can paste it to gist( USE GIST)if anyone of knowledge how to accomplish.
[00:44:17] elomatreb: >> %w[a b b a].uniq
[00:44:18] ruby[bot]: elomatreb: # => ["a", "b"] (https://eval.in/821803)
[00:47:09] Rodya_: has joined #ruby
[00:47:32] market: But the file is 0a -separated, it is not an array yet
[00:48:31] ascarter: has joined #ruby
[00:51:15] humanBird: to exist but it does not respond to either `exist?` or `exists?` . this thing in question is a Datetime
[00:51:23] humanBird: why doesn't it respond to date time
[00:51:59] elomatreb: I think you got cut off there
[00:52:16] tofutoon: has joined #ruby
[00:56:29] zacts: has joined #ruby
[00:59:20] Rodya_: has joined #ruby
[01:04:36] ketan: has joined #ruby
[01:05:21] market: Jessica drove drunk today but african colony's cops didn't notice, one of them is bounded to die after being shotgun shot at in a local nasty hospital
[01:06:54] sunya7a_: has joined #ruby
[01:12:07] zacts: has joined #ruby
[01:13:28] minimalism: has joined #ruby
[01:13:31] market: has left #ruby: ("CHEERS !")
[01:16:41] comet23: how does destructuring work, i mean i just get how to use since i read it but how does it work internally?
[01:19:07] comet23: LIKE: function returns an array ["cereal", "sandwich", "steak"]
[01:20:13] zenspider: comet23: what do you mean by "how does it work internally"?
[01:20:17] comet23: DOING: breakfast, lunch, dinner = #function => "cereal", "sandwich", "steak" in three separate variables
[01:20:38] comet23: breakfast = cereal, lunch = sandwich, and dinner = steak
[01:21:05] comet23: what is the magic behind that destructuring the array with a method call
[01:21:14] UserOO7: has joined #ruby
[01:21:21] comet23: that's interesting... it's easy to understand how to use it, but how it works not so much
[01:21:45] zenspider: yup. `a, b, c = f` looks like: s(:masgn, s(:array, s(:lasgn, :a), s(:lasgn, :b), s(:lasgn, :c)), s(:to_ary, s(:call, nil, :f)))
[01:21:53] adam12: eightlimbed: that's an interesting solution.
[01:22:11] zenspider: it's really not magic, just syntax to ensure some extra stuff happens
[01:22:34] comet23: interesting, i just read that symbols are used to point to a specific place in memory
[01:22:52] comet23: so that's how key value pairs work in ruby and i'm guessing other languages too
[01:23:16] zenspider: eightlimbed: did you get lambdas figured out?
[01:23:31] zenspider: comet23: not sure what you mean
[01:24:16] eightlimbed: zenspider: not really. how would you describe them?
[01:24:41] weathermaker: has joined #ruby
[01:25:13] comet23: like key value pairs work off a specific place in memory, as in key is a variable and the value is what ever is stored in that key but it's at a specific spot in memory and it's referenced by its key name instead of an index
[01:25:14] zenspider: umm... 1st grade: "a function object" 2nd grade: "a function object w/ a closure"
[01:25:30] comet23: are hashes faster to use than arrays?
[01:26:08] zenspider: comet23: if you're talking about hashes when you're talking about "key value pairs" then what you're saying doesn't make sense. if it is something else, then ... I dunno
[01:26:42] zenspider: "symbols are used to point to a specific place in memory" ... probably isn't about symbols, but variable names.
[01:26:51] zenspider: symbols don't point to anything but... the symbol value
[01:28:04] eightlimbed: adam12: it is. does it make sense to you?
[01:28:32] zenspider: eightlimbed: that's probably not addressing your actual questions tho, yes?
[01:29:21] comet23: what is the difference between a symbol and a variable?
[01:29:47] nacsurte: has joined #ruby
[01:30:05] eightlimbed: yeah, zen... from what i understand, a lambda is like a block of code inside a method (?)
[01:31:00] zenspider: or a method is a block of code inside a named slot in a class' method dictionary...
[01:31:20] zenspider: there's semantic differences... that closure in question for example... but they don't matter in the grand scheme
[01:31:42] zenspider: comet23: everything?
[01:32:11] zenspider: the first thing is a variable... the second is a symbol... the former "points" to the latter
[01:32:26] zenspider: the latter "points" basically to itself
[01:32:41] comet23: that's confusing
[01:32:48] zenspider: that's programming
[01:33:01] zenspider: but very elementary programming
[01:33:14] zenspider: is a = "a" confusing?
[01:33:33] comet23: no it's not
[01:33:36] comet23: that makes sense
[01:33:36] zenspider: a = :a is no different... :a is just a different type of value
[01:33:57] comet23: but how does a = :a work?
[01:34:07] zenspider: ?answers comet23
[01:34:07] ruby[bot]: comet23: How to ask the right questions to get you the right answer: https://www.mikeash.com/getting_answers.html
[01:34:14] eightlimbed: by closure you are refering to lambda{0} ?
[01:34:20] zenspider: the same way that a = 1 works
[01:34:27] comet23: what is :a? how is it seen? i thought you have to have the colllection name in order to access :a
[01:34:42] comet23: like collection[:a]
[01:34:44] adam12: eightlimbed: I had to check the docs for `find`
[01:34:57] comet23: i thought that you have to have a = collection[:a]
[01:35:05] zenspider: eightlimbed: no. don't worry about closures just yet... closures are really neat and powerful but can be a bit confusing ... you'll do fine with them once you understand lambdas better
[01:35:07] adam12: eightlimbed: but find accepts an object that is called for the default value, if no value is found
[01:35:27] zenspider: comet23: what is 1? how is it seen?
[01:35:34] adam12: eightlimbed: all though it looks like magic, it's very simple. It's basically some_ary.find(0) { some_condition }
[01:35:49] zenspider: comet23: no, you totally misunderstand what hashes AND symbols are if you're asking such questions
[01:35:53] comet23: 1 is a fixnum
[01:35:58] zenspider: :a is a symbol
[01:36:07] comet23: but what is the value of :a
[01:36:23] zenspider: what is the value of 1 ?
[01:36:30] comet23: no that's the type
[01:36:30] zacts: has joined #ruby
[01:36:34] comet23: i'm talking about value
[01:36:38] zenspider: the value of 1 is 1
[01:36:43] zenspider: the value of :a is :a
[01:36:53] zenspider: the type of 1 is Integer
[01:36:55] comet23: what's the point of that
[01:36:59] zenspider: the type of :a is Symbol
[01:37:04] zenspider: what's the point of anything?
[01:37:05] comet23: :a is :a what is the point of that?
[01:38:21] zenspider: this is a hurdle you're gonna HAVE to get over if you're gonna get ANYWHERE in ruby and pretty much ANY higher level language
[01:39:13] zenspider: symbols ARE values... just as integers are. They represent themselves, just as integers do.
[01:39:43] zenspider: that IS their point
[01:41:42] eightlimbed: adam12: so... Array#find finds the first element with a true value from a given block.
[01:42:07] baweaver: ACTION continues to munch on popcorn
[01:43:25] eightlimbed: if none is found, (the doc says) it calls ifnone -- is that was is happening here: (1..x).find(lambda{0})
[01:43:31] eightlimbed: it's calling the lambda?
[01:43:35] adam12: eightlimbed: right.
[01:43:39] adam12: which obviously returns 0.
[01:43:59] baweaver: [].find {} || 0
[01:44:06] adam12: baweaver: I agree.
[01:44:19] baweaver: Honestly I'm not entirely sure why the lambda there.
[01:44:54] adam12: I've never actually seen #find take an argument other than a block.
[01:45:00] adam12: In the wild, anyways.
[01:45:06] zenspider: so it won't cost anything but the lambda if it isn't used? that's just my guess
[01:45:16] eightlimbed: I was playing around with the code and you can put lambda{100 (or 200, 300, etc} and get the same result.
[01:45:29] eightlimbed: doesn't have to be lambda{0}
[01:45:40] zenspider: I didn't even know about that thing until a couple days ago. I don't really see the point... and the person who was using it... gives less than ideal suggestions in here, so it follows suit
[01:45:55] GinoMan: has joined #ruby
[01:46:23] zenspider: eightlimbed: but yes, learn what lambdas are. learn what blocks are. they're very very powerful constructs and ruby makes them pretty easy to use
[01:46:45] zenspider: baweaver: I assume popcorn was directed at me?
[01:46:53] baweaver: Just overall
[01:47:01] baweaver: rereading that bit about symbols
[01:47:02] zenspider: I think I may have flipped comet23's bozo-bit
[01:47:14] baweaver: ACTION sighs
[01:47:21] baweaver: sudo chmod -b comet23
[01:48:02] d^sh: has joined #ruby
[01:48:05] baweaver: Don't tempt me to -w ;)
[01:48:30] zenspider: hopefully they'll get it soon
[01:48:48] zenspider: or at least ask the right q that gets them to it
[01:50:05] adam12: eightlimbed: I think avdi's site is offline right now, but maybe this video will help explain a bit more about lambda/proc. http://www.virtuouscode.com/2013/02/18/rubytapas-freebie-blocks-procs-lambdas/
[01:52:40] rfoust: has joined #ruby
[01:52:50] zenspider: that's probably too detailed at this point.
[01:53:25] zenspider: (imho) ... stick to really high level descriptions with absolute beginners and let them discover the differences as they grow into them
[01:53:34] zenspider: tho, I really wish we didn't HAVE those differences
[01:54:16] zenspider: they're differences are a complication that ruby really doesn't need
[01:56:37] tofutoon: has left #ruby: ()
[01:57:04] gizmore: has joined #ruby
[02:00:17] relyks: has joined #ruby
[02:02:41] ohjn__: has joined #ruby
[02:03:04] runescape07rsps: has joined #ruby
[02:05:09] ascarter: has joined #ruby
[02:06:27] alamar: has joined #ruby
[02:13:19] zacts: has joined #ruby
[02:19:54] AndBobsYourUncle: has joined #ruby
[02:21:01] Coldblackice: has joined #ruby
[02:21:39] arescorpio: has joined #ruby
[02:22:09] ornerymoose: has joined #ruby
[02:22:27] borodin: has joined #ruby
[02:22:33] aphprentice: has joined #ruby
[02:27:21] dannyh: has joined #ruby
[02:30:00] nacsurte: has joined #ruby
[02:35:51] zenspider: huh... apparently I shut down ALL discussion. :P
[02:36:03] zenspider: even eightlimbed is without words
[02:37:56] montanonic: has joined #ruby
[02:37:59] alamar_: has joined #ruby
[02:40:41] bkxd: has joined #ruby
[02:40:43] bkxd_: has joined #ruby
[02:42:07] mostlybadfly: has joined #ruby
[02:43:19] carterdea: has joined #ruby
[02:43:42] charliesome: has joined #ruby
[02:44:20] relyks: how how do you iterate over a jagged array? when I do [1, [2, 3], 4].each { |e| puts e} it outputs each element including the ones in the second nested array
[02:44:41] relyks: I want it to be 1, [2, 3], 4 instead of 1, 2, 3, 4
[02:45:21] bambanx: has joined #ruby
[02:47:57] zenspider: relyks: not sure what you mean, but maybe you want to use flatten?
[02:48:51] zenspider: "including the ones in the second nested array"...but then goes on to describe that what you want is to include the ones in the second nested array...
[02:50:49] relyks: zenspider: when I use each, it iterates over every element separately including the ones in the nested array. i don't want it to iterate over the elements of the nested array separately
[02:50:58] relyks: zenspider: is that clearer?
[02:51:05] uZiel: has joined #ruby
[02:58:34] elomatreb: relyks: It's already doing what you want, your problem is that if you puts an array, it will print the contents on separate lines
[02:58:50] elomatreb: Replace `puts` with `p` and you'll see what I mean
[02:59:19] relyks: elomatreb: oh shit, you're right!
[02:59:56] relyks: thanks elomatreb and zenspider :)
[03:01:22] hotpancakes: has joined #ruby
[03:05:28] ketan: has joined #ruby
[03:05:54] Rodya_: has joined #ruby
[03:12:48] chouhoul_: has joined #ruby
[03:14:33] zenspider: that... what elomatreb said. I was busy eating dinner
[03:15:14] eightlimbed: has joined #ruby
[03:15:23] zenspider: each means just that. each element of `self`. it isn't recursive
[03:16:09] dannyh: has joined #ruby
[03:22:45] eightlimbed: adam12: thanks for the link. i watched the video but it's over my head
[03:23:00] eightlimbed: i'll start a little lower
[03:23:13] eightlimbed: zenspider: sorry, i got a phone call and had to go walk a dog
[03:31:11] nacsurte: has joined #ruby
[03:36:17] gix: has joined #ruby
[03:37:51] zenspider: eightlimbed: no worries!
[03:38:55] zenspider: eightlimbed: I think for starters you just think of a lambda as a function... but it doesn't have to be bound to a name. And by function, I mean the same type of thing that you learned about in algebra class. def f(a, b); a + b; end is basically the same as f = lambda { |a, b| a + b }
[03:39:08] zenspider: but that `f =` part is totally optional
[03:41:34] eightlimbed: lambda { |x, y| x * y }
[03:42:31] eightlimbed: so why not just use a regular function, like def multiply(x, y); x * y; end
[03:42:59] eightlimbed: because you can pass lambda through other functions?
[03:44:52] apparition: has joined #ruby
[03:46:34] aenialis: has joined #ruby
[03:50:31] hutch34: has joined #ruby
[03:57:13] weathermaker: has joined #ruby
[04:04:16] Prawnzy: has joined #ruby
[04:12:03] elomatreb: eightlimbed: You can't (really) pass around methods in variables, they need to be bound to a receiver to be executed
[04:16:19] carterdea: has joined #ruby
[04:20:36] harfangk: has joined #ruby
[04:23:54] t-recx: has joined #ruby
[04:27:02] Tempesta: has joined #ruby
[04:32:19] nacsurte: has joined #ruby
[04:37:47] moneylotion: has left #ruby: ("Leaving...")
[04:41:36] weathermaker: has joined #ruby
[04:49:09] nanoz: has joined #ruby
[04:49:09] nanoz: has joined #ruby
[05:01:13] dannyh: has joined #ruby
[05:01:44] comet23: what is a way to pause a ruby program
[05:01:58] comet23: like you call a method and the last thing you want to do in that method is to pause for x seconds
[05:02:14] havenwood: comet23: sleep x
[05:02:31] comet23: how can i implement the sleep command?
[05:02:39] comet23: i want to create my own sleep method for fun
[05:04:24] comet23: i have an idea, but i think it's a stupid idea to make it work... basically create a semi-infinite loop that will loop for x iterations doing nothing but iterating
[05:06:21] ketan: has joined #ruby
[05:06:38] havenwood: comet23: You'll notice that'll use more CPU than sleep.
[05:06:50] comet23: what's the right way to do it
[05:07:15] comet23: i want to implement a sleep myself instead of using sleep
[05:07:27] comet23: i want to create my own method that works just like sleep for practice
[05:08:41] djbkd: has joined #ruby
[05:09:19] elomatreb: comet23: What you described earlier is called busy-waiting and it's generally a really bad idea
[05:09:41] runescape07rsps: all you need is a RESTful app
[05:09:56] runescape07rsps: Practice SCRUM AGILE
[05:10:46] havenwood: runescape07rsps: Please no trolling.
[05:11:04] runescape07rsps: how am i trolling
[05:11:46] havenwood: RESTful SCRUM AGILE? I assumed that was meant to be trolling not an answer or question.
[05:12:00] DaniG2k: why hello fellow humans
[05:12:08] havenwood: DaniG2k: hallooo
[05:12:24] runescape07rsps: tell me you dont use a REST api at your job
[05:12:31] runescape07rsps: and ill know never to apply there
[05:12:35] elomatreb: Yes, only humans here, no robots
[05:12:42] elomatreb: ACTION hides can of oil
[05:13:36] DaniG2k: this should probably be asked in the Docker channel (which I did already) but I will also ask here just in case. I am trying to connect three Rails 5 apps to Docker + Puma (Nginx) + PostgreSQL
[05:13:48] comet23: i don't care if it's a bad idea
[05:13:51] DaniG2k: I've explained myself a bit more eloquently here: https://stackoverflow.com/questions/44726227/rails-5-apps-connected-to-docker-puma-nginx-postgresql
[05:13:56] comet23: the world is run on bad ideas, i just want to do this to learn
[05:14:04] havenwood: comet23: I think you'd need to write a C ext to do that well. You might want to choose a different task unless you're feeling up to a yak shave.
[05:14:05] comet23: when you say duck i say jump
[05:14:14] havenwood: comet23: https://github.com/copiousfreetime/hitimes/blob/master/ext/hitimes/c/extconf.rb
[05:14:32] comet23: oh, wait is ruby just c with nice syntax?
[05:14:41] elomatreb: Learn the proper way. Learn how native OS threading works, it'll be far more helpful than writing a loop once
[05:14:46] havenwood: comet23: ^ that might get you on the right track if you really want something other than busy waiting
[05:14:53] FastJack_: has joined #ruby
[05:15:04] enterprisey: has joined #ruby
[05:15:15] comet23: what is a good way to learn that Aloy
[05:15:25] runescape07rsps: remember before code camps
[05:15:30] runescape07rsps: when people knew how to write features
[05:16:21] havenwood: comet23: https://www.jstorimer.com/products/working-with-ruby-threads
[05:17:16] havenwood: ?offtopic runescape07rsps
[05:17:16] ruby[bot]: runescape07rsps: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[05:17:32] comet23: havenwood are you jesse storimier?
[05:17:39] havenwood: comet23: I'm not!
[05:17:49] havenwood: I've met him at RubyConfs.
[05:18:07] comet23: i thought paid stuff was highly discouraged on these chats lol
[05:18:32] runescape07rsps: well he paid off the mods
[05:18:35] runescape07rsps: so it doesnt matter
[05:19:30] havenwood: comet23: If you're looking for only free resources that's fine as well. Or you can email Storimer and ask for a free copy if you're hard up for cash.
[05:19:56] comet23: i have a student pack from github
[05:20:17] elomatreb: There are plenty of decent resources (even university slides sometimes) on the net that explain how operating system threads work, the principle is the same
[05:20:34] comet23: they're giving me 1 month free with an online bootcamp called flatiron school, (a $149 value free for a month) if i finish the program in a month it's free :)
[05:20:58] comet23: https://education.github.com/pack/offers
[05:21:01] comet23: get yours lol
[05:21:11] comet23: unless you're already a pro
[05:21:40] comet23: microsoft has a free thing for students too called imagine
[05:21:52] comet23: https://imagine.microsoft.com/en-us
[05:21:58] comet23: if you know any others please let me know
[05:23:20] havenwood: comet23: There are some good links here: https://ruby-community.com/pages/links
[05:23:28] bkxd: has joined #ruby
[05:23:29] havenwood: comet23: And here: https://www.ruby-lang.org/en/documentation/
[05:23:30] bkxd_: has joined #ruby
[05:23:47] havenwood: comet23: As well as a list of books (some are free, some are not): https://gist.github.com/baweaver/57a7c8296ca2c03effbd8fac1e7f6b40
[05:24:20] havenwood: Many Ruby book authors will comp you a digital copy if you ask nicely.
[05:24:26] havenwood: By email or postcard.
[05:24:47] comet23: i'm definitely going to be buying stuff, i am already invested in a lot of courses, it's just that i am strapped for cash at the moment and i need to find a job asap
[05:25:13] havenwood: comet23: Jesse Storimer's books on Processes, Threads and Sockets all make nice reads.
[05:25:25] havenwood: They're quick introductions to difficult subjects.
[05:25:28] comet23: i have paid for online courses and bought a lot of books
[05:25:42] havenwood: Sounds like you have a good start. Happy coding!
[05:25:50] comet23: i think this github thing is great
[05:26:00] comet23: but i need books with exercises too to cement my learning
[05:26:25] comet23: after i finish the flatiron program, i am going to do the udacity program
[05:26:41] elomatreb: I'd advise more concrete exercises than "reimplement sleep", since that's a very abstract and specific thing
[05:26:56] comet23: hopefully by then i can land a job anywhere without a degree
[05:27:31] comet23: elomatreb it seemed like an easy thing to implement because the idea is really simple lol
[05:28:34] elomatreb: Yes, but it's actually pretty complex under the hood if you go all the way. You want to avoid busy-waiting, since it requires the use of the CPU the entire time, so no other program can run while yours is only waiting
[05:29:39] elomatreb: Proper sleep basically is telling the operating system, "I'm going to sleep now, please wake me in N seconds". The OS is free to have other programs run while you're sleeping that way
[05:29:42] comet23: what would you recommend to a beginner? i like books with exercises, i feel like those work best for me, but i don't know which books to get because i only have html, css, and javascript books
[05:30:41] elomatreb: I don't have recommendations, I don't like exercise books, sorry
[05:32:44] dannyh: has joined #ruby
[05:38:18] hotpancakes: has joined #ruby
[05:43:39] hotpancakes: has joined #ruby
[05:44:29] ascarter: has joined #ruby
[05:55:42] jackjackdripper: has joined #ruby
[06:12:36] dionysus69: has joined #ruby
[06:18:29] jamesaxl: has joined #ruby
[06:25:07] hutch34: has joined #ruby
[06:30:16] ddffg: has joined #ruby
[06:32:38] isBEKaml: has joined #ruby
[06:32:59] nacsurte: has joined #ruby
[06:33:03] Cohedrin_: has joined #ruby
[06:35:13] dannyh: has joined #ruby
[06:38:21] hotpancakes: has joined #ruby
[06:47:32] jamesaxl: has joined #ruby
[06:49:37] ascarter: has joined #ruby
[06:49:46] nowhere_man: has joined #ruby
[06:52:02] bambanx: has joined #ruby
[06:52:28] solocshaw: has joined #ruby
[07:03:56] latemus: has joined #ruby
[07:07:12] ketan: has joined #ruby
[07:10:12] nofxxx: has joined #ruby
[07:19:15] cam27: has joined #ruby
[07:19:45] ltem: has joined #ruby
[07:23:36] antgel: has joined #ruby
[07:24:45] marr: has joined #ruby
[07:26:41] conta: has joined #ruby
[07:29:59] bkxd: has joined #ruby
[07:30:01] bkxd_: has joined #ruby
[07:31:59] dannyh: has joined #ruby
[07:33:51] agent_white: has joined #ruby
[07:34:02] nacsurte: has joined #ruby
[07:39:06] _sfiguser: has joined #ruby
[07:43:24] hotpancakes: has joined #ruby
[07:43:28] lele: has joined #ruby
[07:44:44] konsolebox: has joined #ruby
[07:48:11] _whitelogger: has joined #ruby
[07:50:34] rt: has joined #ruby
[07:56:19] ascarter: has joined #ruby
[08:00:09] runescape07rsps: has joined #ruby
[08:01:22] _main_: has joined #ruby
[08:02:03] VladGh_: has joined #ruby
[08:02:24] _main_: has joined #ruby
[08:04:24] _main_0: has joined #ruby
[08:13:57] dare-to-recurse[: has joined #ruby
[08:14:29] cosmic_imposter_: has joined #ruby
[08:21:04] Mia: has joined #ruby
[08:23:03] montanonic: has joined #ruby
[08:34:48] nacsurte: has joined #ruby
[08:35:14] blackwind_123: has joined #ruby
[08:35:24] dannyh: has joined #ruby
[08:35:25] lxsameer: has joined #ruby
[08:35:58] roshanavand: has joined #ruby
[08:38:23] anisha: has joined #ruby
[08:44:25] vuoto: has joined #ruby
[08:45:14] milardovich: has joined #ruby
[08:51:25] dionysus69: has joined #ruby
[08:56:10] cosmic_imposter: has joined #ruby
[09:03:52] ascarter: has joined #ruby
[09:08:04] ketan: has joined #ruby
[09:13:09] psychicist__: has joined #ruby
[09:13:33] blackwind_123: has joined #ruby
[09:15:51] bkxd: has joined #ruby
[09:15:53] bkxd_: has joined #ruby
[09:22:14] zacts: has joined #ruby
[09:22:37] hutch34: has joined #ruby
[09:25:24] clemens34: has joined #ruby
[09:35:33] nacsurte: has joined #ruby
[09:44:21] rohitpaulk: has joined #ruby
[09:48:33] meshsmith: has joined #ruby
[09:48:33] meshsmith: has joined #ruby
[09:49:24] mbr: has joined #ruby
[09:52:52] kmhn: has joined #ruby
[09:53:18] sepp2k: has joined #ruby
[09:57:23] bkxd: has joined #ruby
[09:57:41] bkxd_: has joined #ruby
[10:02:48] bruce_lee: has joined #ruby
[10:02:48] bruce_lee: has joined #ruby
[10:03:13] aglorei: has joined #ruby
[10:04:18] biberu: has joined #ruby
[10:05:18] Fernando-Basso: has joined #ruby
[10:08:32] ascarter: has joined #ruby
[10:12:09] hotpancakes: has joined #ruby
[10:27:16] alex``: has joined #ruby
[10:27:52] hhatch: has joined #ruby
[10:30:24] chouhoulis: has joined #ruby
[10:35:50] antgel: has joined #ruby
[10:36:29] nacsurte: has joined #ruby
[10:37:06] dannyh: has joined #ruby
[10:37:52] jamesaxl: has joined #ruby
[10:41:33] bkxd: has joined #ruby
[10:44:03] bkxd_: has joined #ruby
[10:52:25] rfoust: has joined #ruby
[10:59:28] blackwind_123: has joined #ruby
[11:03:16] rohitpaulk: has joined #ruby
[11:08:57] ketan: has joined #ruby
[11:11:18] DoubleMalt: has joined #ruby
[11:11:19] djbkd: has joined #ruby
[11:14:38] ascarter: has joined #ruby
[11:23:24] romank: has joined #ruby
[11:24:11] hutch34: has joined #ruby
[11:28:57] rippa: has joined #ruby
[11:35:37] bkxd: has joined #ruby
[11:37:15] nacsurte: has joined #ruby
[11:39:31] marlinc_: has joined #ruby
[11:40:46] bkxd_: has joined #ruby
[11:50:49] romank: has joined #ruby
[11:51:08] meshsmith_: has joined #ruby
[11:55:38] romank: has joined #ruby
[11:56:50] rikkipitt: has joined #ruby
[11:58:46] troulouliou_div2: has joined #ruby
[11:58:56] Prawnzy: has joined #ruby
[11:59:32] ketan: has joined #ruby
[11:59:42] im0nde: has joined #ruby
[12:01:52] kanye_vest: has joined #ruby
[12:01:53] oleo: has joined #ruby
[12:04:12] milardovich: has joined #ruby
[12:04:25] dionysus69: has joined #ruby
[12:07:08] dannyh: has joined #ruby
[12:08:11] romank: has joined #ruby
[12:10:27] ketan: has joined #ruby
[12:16:12] ascarter: has joined #ruby
[12:17:00] uZiel: has joined #ruby
[12:19:46] bkxd: has joined #ruby
[12:20:39] bkxd_: has joined #ruby
[12:22:28] vincent_: has joined #ruby
[12:26:00] hotpancakes: has joined #ruby
[12:27:24] cosmic_imposter: has joined #ruby
[12:27:45] psychicist__: has joined #ruby
[12:33:20] mikecmpbll: has joined #ruby
[12:33:44] romank: has joined #ruby
[12:37:49] nacsurte: has joined #ruby
[12:38:08] romank: has joined #ruby
[12:39:34] FastJack_: has joined #ruby
[12:42:30] wnd_: has joined #ruby
[12:42:53] ledestin: has joined #ruby
[12:49:39] burgestrand: has joined #ruby
[12:57:36] romank: has joined #ruby
[12:58:05] charliesome: has joined #ruby
[12:59:25] aenialis: has joined #ruby
[13:00:18] milardovich: has joined #ruby
[13:01:07] bkxd: has joined #ruby
[13:01:32] bkxd_: has joined #ruby
[13:01:52] DoubleMalt: has joined #ruby
[13:07:01] vuoto: has joined #ruby
[13:11:47] kanye_vest: has joined #ruby
[13:12:52] burgestrand: has joined #ruby
[13:13:37] aenialis: has left #ruby: ("WeeChat 1.8")
[13:19:22] sepp2k1: has joined #ruby
[13:22:12] ascarter: has joined #ruby
[13:22:21] rikkipitt: has joined #ruby
[13:25:36] bathtub_shark: has joined #ruby
[13:25:44] hutch34: has joined #ruby
[13:29:22] ledestin: has joined #ruby
[13:30:31] dionysus69: has joined #ruby
[13:38:34] nacsurte: has joined #ruby
[13:38:47] conta: has joined #ruby
[13:39:25] gjvc: has joined #ruby
[13:42:14] burgestrand: has joined #ruby
[13:42:24] rohitpaulk: has joined #ruby
[13:47:31] Demo318: has joined #ruby
[13:51:56] mydog2: has joined #ruby
[13:59:05] runescape07rsps: has joined #ruby
[13:59:44] Prawnzy: has joined #ruby
[13:59:55] Jameser: has joined #ruby
[14:10:42] andrzejku: has joined #ruby
[14:11:41] hotpancakes: has joined #ruby
[14:21:46] Tau: has joined #ruby
[14:22:26] t-recx: has joined #ruby
[14:24:11] Murda: has joined #ruby
[14:29:42] ascarter: has joined #ruby
[14:30:24] mim1k: has joined #ruby
[14:32:18] romank: has joined #ruby
[14:39:18] nacsurte: has joined #ruby
[14:39:28] oleo: has joined #ruby
[14:39:29] nadir: has joined #ruby
[14:46:12] DoubleMalt: has joined #ruby
[14:54:04] burgestrand: has joined #ruby
[14:55:06] rohitpaulk: has joined #ruby
[14:55:47] johnny56: has joined #ruby
[14:56:01] mydog2: hey apeiros -- group is quiet ehh
[14:57:18] romank: has joined #ruby
[14:59:48] conta: has joined #ruby
[15:01:25] theod: has joined #ruby
[15:02:36] ule: very quiet
[15:04:12] uZiel: has joined #ruby
[15:12:09] solocshaw: has joined #ruby
[15:16:30] oleo: has joined #ruby
[15:22:07] nacsurte: has joined #ruby
[15:25:56] Mia: has joined #ruby
[15:26:00] Mia: has joined #ruby
[15:27:24] apparition: has joined #ruby
[15:27:30] hutch34: has joined #ruby
[15:28:04] apparition: has joined #ruby
[15:29:00] apparition: has joined #ruby
[15:29:47] apparition: has joined #ruby
[15:32:57] ascarter: has joined #ruby
[15:45:36] _sfiguser: has joined #ruby
[15:46:14] dionysus70: has joined #ruby
[15:48:57] hotpancakes: has joined #ruby
[15:51:09] chouhoulis: has joined #ruby
[15:51:27] oleo: has joined #ruby
[15:51:40] kitallis: can I do this in ruby? https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#numberOfLeadingZeros(int)
[15:52:31] jphase_: has joined #ruby
[15:52:34] dannyh: has joined #ruby
[15:52:57] chrisseaton: kitallis: do you need it to be very fast?
[15:56:11] BTRE: has joined #ruby
[15:56:48] chrisseaton: http://hg.openjdk.java.net/lambda/lambda/jdk/file/tip/src/share/classes/java/lang/Long.java#l1416
[15:57:28] chrisseaton: Java will intrinsify that to actually use the lzcnt instruction, but Ruby won't
[15:57:45] chrisseaton: That's probably reasonably fast for Ruby
[15:57:51] psychicist__: has joined #ruby
[15:58:35] kitallis: chrisseaton, let me try
[15:58:37] chrisseaton: Something a bit more Ruby-like and high level but slow could be n.to_s(2).rjust(width, '0').chars.take_while{ |c| c == '0'}.size
[15:59:11] kitallis: yeah, I wanted to see if I could avoid to_s
[16:00:47] Prawnzy: has joined #ruby
[16:01:25] chrisseaton: kitallis: this code references something called 'HD' but I don't know what that is
[16:02:29] mokiwis: has joined #ruby
[16:04:30] kitallis: chrisseaton, I assume >>> is right shift, what do you think <<= is?
[16:04:39] johnny56: has joined #ruby
[16:04:48] romank: has joined #ruby
[16:05:39] kitallis: oh, nvm, it's n <<= 1 is n = n << 1
[16:06:11] relyks: has joined #ruby
[16:06:44] chrisseaton: kitallis: you probably want to use >> in Ruby, instead of >>>
[16:07:04] kitallis: >>> is unsigned
[16:08:04] chrisseaton: (of course, take note of the copyright and licence of this file when copying it etc etc)
[16:09:44] solocshaw: has joined #ruby
[16:13:49] hutch34: has joined #ruby
[16:15:50] rohitpaulk: has joined #ruby
[16:17:33] cam27: has joined #ruby
[16:17:55] hotpancakes: has joined #ruby
[16:22:05] conta: has joined #ruby
[16:22:30] weathermaker: has joined #ruby
[16:22:47] romank: has joined #ruby
[16:22:49] rohitpaulk: has joined #ruby
[16:23:04] nacsurte: has joined #ruby
[16:23:05] kitallis: chrisseaton, seems to be working ok
[16:26:20] kitallis: https://gist.github.com/anonymous/0d2b05fe22087b5fe98550fdcf4b3401
[16:29:37] hotpancakes: has joined #ruby
[16:35:22] ddffg: has joined #ruby
[16:37:20] ascarter: has joined #ruby
[16:38:46] kitallis: chrisseaton, just going to instead do Math.log2(i).ceil
[16:39:02] hotpancakes: has joined #ruby
[16:39:25] chrisseaton: kitallis: ok but that won't work for some integers of course - not all integers fit in a double
[16:42:49] mim1k: has joined #ruby
[16:43:46] kitallis: chrisseaton, yeah
[16:43:51] kitallis: Float can do 1.7976931348623157 * (10 ** 308)
[16:43:56] kitallis: which is huge enough for my usecase
[16:44:37] chrisseaton: It can do that large yes, but not with that much precision
[16:45:01] chrisseaton: I think a Ruby Float will be able to represent an integer op to 2**56
[16:45:16] ledestin: has joined #ruby
[16:46:50] alfiemax: has joined #ruby
[16:48:40] ResidentBiscuit: has joined #ruby
[16:50:14] kitallis: chrisseaton, how do you figure?
[16:50:36] chrisseaton: A Ruby Float is an IEEE double, which has 56 bits of precision
[16:50:56] MrSparkle: has joined #ruby
[16:51:52] rohitpaulk: has joined #ruby
[16:53:18] chrisseaton: irb(main):037:0> 0b11111111111111111111111111111111111111111111111111111.to_f.to_i.to_s(2)
[16:53:19] chrisseaton: => "11111111111111111111111111111111111111111111111111111"
[16:53:19] chrisseaton: irb(main):038:0> 0b111111111111111111111111111111111111111111111111111111.to_f.to_i.to_s(2)
[16:53:19] chrisseaton: => "1000000000000000000000000000000000000000000000000000000"
[16:53:54] chrisseaton: See - the 55th bit is lost
[16:54:08] chrisseaton: I'm not immediately sure why it isn't 56th - I'm not an expert on floating point numbers really
[16:54:46] vuoto: has joined #ruby
[16:55:13] alfiemax: could it be signed?
[16:55:17] chrisseaton: What I'm saying is that you convert an integer rather than 55 bits into a Float, you don't always get the exact integer - you get something close to it
[16:55:27] chrisseaton: There's no negative numbers here
[16:56:11] chrisseaton: This explains in the context of JavaScript https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
[16:57:07] chrisseaton: It says that the maximum integer you can store in a Float without loss of precision is 9007199254740991, or 0x1FFFFFFFFFFFFF
[16:59:00] joes: has joined #ruby
[16:59:02] chrisseaton: Another example:
[16:59:13] chrisseaton: irb(main):048:0> 0x1FFFFFFFFFFFFF.to_f.to_i.to_s(16)
[16:59:13] chrisseaton: => "1fffffffffffff"
[16:59:13] chrisseaton: irb(main):049:0> 0x1FFFFFFFFFFFFFFFFF.to_f.to_i.to_s(16)
[16:59:13] chrisseaton: => "200000000000000000"
[16:59:19] alfiemax: has left #ruby: ()
[16:59:23] chrisseaton: See how it's had to approximate the second number - it's lost precision
[17:05:30] alex``: has joined #ruby
[17:15:46] bkxd: has joined #ruby
[17:15:49] bkxd_: has joined #ruby
[17:18:17] kitallis: chrisseaton, yeah, you're right ("0x%02X" % 8007199254740991.to_s).hex.to_f.to_i
[17:18:28] kitallis: Math.log2(8007199254740991).ceil => 2
[17:18:39] kitallis: err, not 2, 53
[17:18:48] kitallis: seems to be fine until 53
[17:20:32] chrisseaton: Right - because the fixed (as opposed to floating) part of Float is 53 bits. Then there are more bits for the sign and the floating part, but you aren't using those so they just go to waste.
[17:21:08] bkxd: has joined #ruby
[17:21:34] bkxd_: has joined #ruby
[17:23:44] nacsurte: has joined #ruby
[17:24:07] andrzejku: has joined #ruby
[17:24:47] hotpancakes: has joined #ruby
[17:24:57] hotpancakes: has joined #ruby
[17:31:20] clemens34: has left #ruby: ()
[17:31:27] al2o3-cr1: has joined #ruby
[17:35:15] eightlimbed: has joined #ruby
[17:35:29] MrSparkle: has joined #ruby
[17:37:08] hutch34: has joined #ruby
[17:40:15] TinkerTyper: has joined #ruby
[17:41:21] jackjackdripper: has joined #ruby
[17:43:27] ascarter: has joined #ruby
[17:44:26] dionysus69: has joined #ruby
[17:47:03] rohitpaulk: has joined #ruby
[17:47:34] sekmo: has joined #ruby
[17:48:00] DLSteve: has joined #ruby
[17:48:30] montanonic: has joined #ruby
[17:50:03] sepp2k: has joined #ruby
[17:50:43] herbmillerjr: has joined #ruby
[17:54:16] blackwind_123: has joined #ruby
[17:58:27] solocshaw: has joined #ruby
[18:01:20] Prawnzy: has joined #ruby
[18:01:34] rohitpaulk: has joined #ruby
[18:06:03] sepp2k1: has joined #ruby
[18:10:44] jackjackdripper: has joined #ruby
[18:12:59] Cohedrin_: has joined #ruby
[18:13:18] boombox_: has joined #ruby
[18:14:28] troulouliou_div2: has joined #ruby
[18:16:02] rohitpaulk: has joined #ruby
[18:16:31] hotpanca_: has joined #ruby
[18:17:53] roshanavand: has joined #ruby
[18:21:08] andrzejku: has joined #ruby
[18:23:30] rikkipitt: has joined #ruby
[18:24:19] nacsurte: has joined #ruby
[18:31:33] runescape07rsps: has joined #ruby
[18:32:25] blackwind_123: has joined #ruby
[18:33:46] carterdea: has joined #ruby
[18:36:28] romank: has joined #ruby
[18:37:57] ResidentBiscuit: has joined #ruby
[18:41:16] dionysus69: has joined #ruby
[18:43:09] haylon: has joined #ruby
[18:43:24] KeyJoo: has joined #ruby
[18:43:52] ResidentBiscuit: has joined #ruby
[18:43:57] haylon: Is anyone familiar with Chef's Omnibus packager RubyGem?
[18:58:16] ketan: has joined #ruby
[19:01:50] pwnd_nsfw`: has joined #ruby
[19:06:08] havenwood: haylon: You might try the #chef channel if you haven't already.
[19:09:39] Fernando-Basso: has joined #ruby
[19:11:05] kolgomorov: has joined #ruby
[19:12:02] dviola: has joined #ruby
[19:16:01] eightlimbed: has joined #ruby
[19:18:47] nadir: has joined #ruby
[19:18:54] haylon: I wasn't sure if I hsould ask here or Chef since its not really a full chef question, just more about can this be used to package RPMs and a if anyone has used it to package some other software other than a rubygem
[19:19:48] weinstein: has joined #ruby
[19:25:05] nacsurte: has joined #ruby
[19:26:32] mniip: has joined #ruby
[19:28:46] romank: has joined #ruby
[19:33:34] romank: has joined #ruby
[19:36:21] romank: has joined #ruby
[19:39:05] romank: has joined #ruby
[19:39:41] hotpancakes: has joined #ruby
[19:40:16] Tau: has left #ruby: ()
[19:43:02] Ka: has joined #ruby
[19:45:55] hutch34: has joined #ruby
[19:47:35] ascarter: has joined #ruby
[19:52:13] romank: has joined #ruby
[19:54:23] dannyh: has joined #ruby
[19:59:28] Silthias: has joined #ruby
[20:02:18] Prawnzy: has joined #ruby
[20:04:05] |prawnzy: has joined #ruby
[20:09:05] mim1k: has joined #ruby
[20:15:18] sekmo: has joined #ruby
[20:16:17] Rodya_: has joined #ruby
[20:21:43] QpQ4: has joined #ruby
[20:22:31] Dimik: has joined #ruby
[20:23:49] marr: has joined #ruby
[20:25:52] nacsurte: has joined #ruby
[20:33:29] mim1k: has joined #ruby
[20:45:41] chouhoulis: has joined #ruby
[20:47:16] Mendel: has joined #ruby
[20:49:08] ozzloy: has joined #ruby
[20:49:52] jenrzzz: has joined #ruby
[20:54:05] sekmo: has joined #ruby
[20:54:50] mim1k: has joined #ruby
[20:55:08] inkky: has joined #ruby
[20:57:46] ur5us: has joined #ruby
[20:59:10] ketan: has joined #ruby
[20:59:57] QpQ4: has joined #ruby
[21:00:59] Rodya_: has joined #ruby
[21:01:15] shinnya: has joined #ruby
[21:08:09] Azure: has joined #ruby
[21:08:42] AndBobsYourUncle: has joined #ruby
[21:11:06] bkxd: has joined #ruby
[21:11:07] bkxd_: has joined #ruby
[21:11:18] tgragnato: has joined #ruby
[21:12:06] mim1k: has joined #ruby
[21:16:12] bkxd: has joined #ruby
[21:20:46] dcluna: has joined #ruby
[21:26:46] nacsurte: has joined #ruby
[21:41:39] cam27: has joined #ruby
[21:43:33] DK2: has joined #ruby
[21:44:40] uranellus: has joined #ruby
[21:44:40] uranellus: has joined #ruby
[21:49:44] minimalism: has joined #ruby
[21:55:52] ascarter: has joined #ruby
[22:06:13] Rodya_: has joined #ruby
[22:17:17] justache: has joined #ruby
[22:18:13] Emmanuel_Chanel: has joined #ruby
[22:27:05] hutch34: has joined #ruby
[22:27:10] _whitelogger: has joined #ruby
[22:27:32] nacsurte: has joined #ruby
[22:31:17] mim1k: has joined #ruby
[22:32:04] bkxd: has joined #ruby
[22:33:20] bkxd_: has joined #ruby
[22:33:35] bocobit: has joined #ruby
[22:35:11] bocobit: Hello, is there anyone here who could give me a hand/ point me in the right direction?
[22:36:24] eightlimbs: has joined #ruby
[22:38:20] [ohjn]: has joined #ruby
[22:39:40] burgestrand: has joined #ruby
[22:40:38] Mon_Ouie: has joined #ruby
[22:41:16] rikkipitt: has joined #ruby
[22:42:39] bkxd: has joined #ruby
[22:45:39] Radar: bocobit: Sure, just ask your question
[22:46:41] TomyLobo2: has joined #ruby
[22:47:42] bkxd_: has joined #ruby
[22:49:37] comet23: has joined #ruby
[22:49:54] comet23: why is rereading so difficult?
[22:50:40] bocobit: I'm making a form, the form has select with multiple options. How do I get the form to show the value selected after the post method?
[22:50:55] bocobit: like if someone wants to edit that form after they submit it.
[22:50:58] comet23: i've started on a new web development course and i know all the stuff they're talking about, a few new things were said that helped me understand the information in a new way but most of it is review and i already know this stuff, why is it hard for my brain to review and how can i make it less difficult?
[22:51:12] bocobit: the default option selected is the first option
[22:51:27] Silthias1: has joined #ruby
[22:51:31] Rodya_: has joined #ruby
[22:53:17] bocobit: The form will show data that was entered in a text input but all the selects are just the default options
[22:54:20] bocobit: I'm using bootstrap
[22:55:19] bocobit: I'm not using Rails*
[22:55:28] bocobit: Just plain ruby
[23:00:01] ketan: has joined #ruby
[23:00:23] nertzy: has joined #ruby
[23:01:27] TheBloke: has joined #ruby
[23:01:32] chouhoulis: has joined #ruby
[23:01:53] elomatreb: bocobit: You can set the `selected` attribute on the options in a select
[23:02:12] ascarter: has joined #ruby
[23:02:23] chouhoul_: has joined #ruby
[23:06:56] bocobit: elomatreb: how do change which option is selected based on what the user submitted?
[23:07:40] elomatreb: Well, you need to access the data you received and stored based on the request and use it set the attribute
[23:07:52] elomatreb: How you do that depends on how you store your data
[23:08:39] bocobit: Here's my code
[23:09:05] jenrzzz: has joined #ruby
[23:09:05] jenrzzz: has joined #ruby
[23:09:50] Radar: ?rails bocobit
[23:09:50] ruby[bot]: bocobit: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[23:12:38] comet23_: has joined #ruby
[23:14:21] Radar: comet23: what?
[23:14:47] Radar: comet23: keep practicing it.
[23:17:22] comet23_: has joined #ruby
[23:18:27] jenrzzz: has joined #ruby
[23:20:34] mim1k: has joined #ruby
[23:24:38] jenrzzz: has joined #ruby
[23:24:38] jenrzzz: has joined #ruby
[23:27:47] nacsurte: has joined #ruby
[23:30:23] bkxd: has joined #ruby
[23:30:25] bkxd_: has joined #ruby
[23:34:53] planigan: has joined #ruby
[23:37:20] Emmanuel_Chanel_: has joined #ruby
[23:41:08] Emmanuel_Chanel: has joined #ruby
[23:47:07] charliesome: has joined #ruby
[23:49:02] _sfiguser: has joined #ruby
[23:58:58] AndBobsYourUncle: has joined #ruby