« Back to channel list

#ruby - 15 March 2018

« Back 1 day Forward 1 day »
[00:01:35] n0m4d1c: has joined #ruby
[00:02:22] havenwood: GetoptLong is the other stdlib option.
[00:02:32] havenwood: &ri GetoptLong
[00:02:33] `derpy: http://ruby-doc.org/stdlib-2.4.1/libdoc/getoptlong/rdoc/GetoptLong.html
[00:02:53] havenwood: &ri OptionParser
[00:02:54] `derpy: http://ruby-doc.org/stdlib-2.4.1/libdoc/optparse/rdoc/OptionParser.html
[00:04:46] havenwood: I've never actually seen GetoptLong used. ¯\_(ツ)_/¯
[00:04:53] duckpuppy: has joined #ruby
[00:06:14] Psybur__: has joined #ruby
[00:11:05] RedNifre: Well, I just want to do `encode --deck french52 "Some Text"` and `decode --deck quartett A4 C2 E1 B1 B2 ...`
[00:11:32] RedNifre: (It's a program to use decks of cards as a storage medium for unicode text)
[00:19:13] weaksauce: RedNifre don't think either of those can do what you want really... optionparser can't handle the script.rb some verb --extraoptions "some option" style iirc
[00:19:31] RedNifre: Yeah, they looked too complicated so I just go with ARGV
[00:23:05] beremenushka2: has joined #ruby
[00:25:39] banisterfiend: has joined #ruby
[00:27:38] jcarl43: has joined #ruby
[00:29:15] cagomez: has joined #ruby
[00:29:44] sameerynho: has joined #ruby
[00:31:50] RedNifre: Almost done... if I have an array of strings of size 2 each, how do I uppercase the first and lowercase the second letter?
[00:32:42] RedNifre: there's a method for everything :)
[00:33:46] herbmillerjr: has joined #ruby
[00:39:31] jackjackdripper: has joined #ruby
[00:46:33] SteenJobs: has joined #ruby
[00:54:21] duckpuppy: has joined #ruby
[00:55:57] orbyt_: has joined #ruby
[00:57:15] rfoust: has joined #ruby
[00:59:14] ramfjord: has joined #ruby
[00:59:52] Yzguy: has joined #ruby
[01:03:34] workmad3: has joined #ruby
[01:03:46] nowhere_man: has joined #ruby
[01:10:06] Jameser: has joined #ruby
[01:15:33] bmurt: has joined #ruby
[01:19:12] nachoman: has joined #ruby
[01:25:09] roshanavand: has joined #ruby
[01:26:23] kn-928: has joined #ruby
[01:32:39] duckpuppy: has joined #ruby
[01:35:21] dtzuzu: has joined #ruby
[01:37:58] netherwolfe: has joined #ruby
[01:38:06] JonaBurgos: has joined #ruby
[01:38:23] JonaBurgos: Hi guys and partners :)
[01:38:55] JoshS: has joined #ruby
[01:40:08] jeffreylevesque: has joined #ruby
[01:49:52] tolerablyjake: has joined #ruby
[01:55:18] cdg: has joined #ruby
[01:59:34] gnufied: has joined #ruby
[02:04:45] dinfuehr: has joined #ruby
[02:08:53] n0m4d1c: has joined #ruby
[02:12:37] vutral|kali: has joined #ruby
[02:12:37] vutral|kali: has joined #ruby
[02:15:40] cagomez: has joined #ruby
[02:16:18] guacamole: has joined #ruby
[02:18:34] ramfjord: has joined #ruby
[02:22:15] guacamole: has joined #ruby
[02:22:32] imode: has joined #ruby
[02:24:22] darkhanb: has joined #ruby
[02:26:20] yxhuvud: has joined #ruby
[02:27:20] nowhereman_: has joined #ruby
[02:28:43] jeffreylevesque: has joined #ruby
[02:31:50] m27frogy: has joined #ruby
[02:36:19] jgpawletko: has joined #ruby
[02:38:08] guacamole: has joined #ruby
[02:38:53] milardovich: has joined #ruby
[02:41:27] alfiemax: has joined #ruby
[02:41:54] vutral|kali: has joined #ruby
[02:41:54] vutral|kali: has joined #ruby
[02:43:34] Matthew1: has joined #ruby
[02:44:18] Matthew1: has joined #ruby
[02:44:49] vutral|kali: has joined #ruby
[02:44:49] vutral|kali: has joined #ruby
[02:45:51] gizmore: has joined #ruby
[02:47:29] vutral|kali: has joined #ruby
[02:47:29] vutral|kali: has joined #ruby
[02:49:19] milardovich: has joined #ruby
[02:50:54] duckpuppy: has joined #ruby
[02:56:12] n0m4d1c: has joined #ruby
[03:00:23] jeffreylevesque: has joined #ruby
[03:01:30] yxhuvud: has joined #ruby
[03:03:39] guacamole: has joined #ruby
[03:03:40] guacamole: has joined #ruby
[03:03:57] workmad3: has joined #ruby
[03:05:42] Yzguy: has joined #ruby
[03:12:08] jgpawletko: has joined #ruby
[03:18:49] bmurt: has joined #ruby
[03:19:28] guacamole: has joined #ruby
[03:19:28] guacamole: has joined #ruby
[03:27:07] jordanm: has joined #ruby
[03:31:39] ramfjord: has joined #ruby
[03:50:08] cagomez: has joined #ruby
[03:51:22] duckpuppy: has joined #ruby
[03:52:42] cschneid: has joined #ruby
[03:53:29] Yzguy: has joined #ruby
[03:58:54] jackjackdripper: has joined #ruby
[03:59:58] zeds: has left #ruby: ()
[04:00:40] zeds: has joined #ruby
[04:07:41] milardovich: has joined #ruby
[04:15:01] howdoi: has joined #ruby
[04:21:09] jeffreylevesque: has joined #ruby
[04:22:17] alfiemax: has joined #ruby
[04:24:59] dnewkerk: has joined #ruby
[04:25:14] trautwein: has joined #ruby
[04:25:17] dnewkerk: has joined #ruby
[04:26:26] kn-928: has joined #ruby
[04:27:45] _aeris_: has joined #ruby
[04:30:40] yxhuvud: has joined #ruby
[04:32:52] zeds: has left #ruby: ()
[04:57:36] duckpuppy: has joined #ruby
[04:59:07] eckhardt: has joined #ruby
[05:01:06] n0m4d1c: has joined #ruby
[05:03:43] dviola: has joined #ruby
[05:03:44] alfiemax: has joined #ruby
[05:04:13] alfiemax: has joined #ruby
[05:05:37] larson: has joined #ruby
[05:10:18] kn-928: has joined #ruby
[05:20:44] r3m: has joined #ruby
[05:21:56] Gnut_: has joined #ruby
[05:26:12] luminous: has joined #ruby
[05:30:21] sauvin_: has joined #ruby
[05:30:43] cdg: has joined #ruby
[05:31:50] ramfjord: has joined #ruby
[05:34:26] RyanMcCoskrie: has joined #ruby
[05:38:03] EXCHGR: has joined #ruby
[05:44:32] Dimik: has joined #ruby
[05:46:46] alfiemax: has joined #ruby
[05:48:47] KeyJoo: has joined #ruby
[05:49:06] duckpuppy: has joined #ruby
[05:50:05] jamesaxl: has joined #ruby
[05:50:12] nadir: has joined #ruby
[05:55:56] anisha: has joined #ruby
[05:55:58] UKn0Me: has left #ruby: ("The Lounge - https://thelounge.github.io")
[05:58:04] aufi: has joined #ruby
[05:59:48] ledestin: has joined #ruby
[06:02:35] Gnut: has joined #ruby
[06:04:37] milardovich: has joined #ruby
[06:12:13] sidx64: has joined #ruby
[06:15:01] CrazyEddy: has joined #ruby
[06:15:55] eckhardt_: has joined #ruby
[06:23:51] CrazyEddy: has joined #ruby
[06:24:15] sidx64: has joined #ruby
[06:34:25] SteenJobs: has joined #ruby
[06:35:07] guacamole: has joined #ruby
[06:35:25] burgestrand: has joined #ruby
[06:40:11] sidx64_: has joined #ruby
[06:41:25] nachoman: has joined #ruby
[06:41:31] suukim: has joined #ruby
[06:42:44] sidx64: has joined #ruby
[06:47:04] za1b1tsu: has joined #ruby
[06:56:35] jackjackdripper: has joined #ruby
[06:57:50] duckpuppy: has joined #ruby
[06:59:22] burgestrand: has joined #ruby
[07:04:47] workmad3: has joined #ruby
[07:07:51] n008f4g_: has joined #ruby
[07:08:33] alex``: has joined #ruby
[07:11:52] sidx64_: has joined #ruby
[07:13:57] halbbalda: has joined #ruby
[07:15:44] sidx64: has joined #ruby
[07:21:19] halbbalda: has joined #ruby
[07:28:19] mtkd: has joined #ruby
[07:32:06] ramfjord: has joined #ruby
[07:32:19] nadir: has joined #ruby
[07:39:34] rideh: has joined #ruby
[07:44:28] alfiemax: has joined #ruby
[07:48:32] halbbalda: has joined #ruby
[07:48:55] duckpuppy: has joined #ruby
[07:53:17] milardovich: has joined #ruby
[07:53:25] Papierkorb: has joined #ruby
[07:53:57] Papierkorb: has left #ruby: ("Konversation terminated!")
[07:55:06] andikr: has joined #ruby
[07:55:56] guardianx: has joined #ruby
[08:04:50] sidx64: has joined #ruby
[08:05:47] halbbalda: has joined #ruby
[08:06:41] cdg: has joined #ruby
[08:07:40] zacts: has joined #ruby
[08:11:08] aufi: has joined #ruby
[08:12:08] clemens3: has joined #ruby
[08:12:54] TomyWork: has joined #ruby
[08:13:35] Jameser: has joined #ruby
[08:16:19] schneider: has joined #ruby
[08:16:27] alfiemax: has joined #ruby
[08:17:38] halbbalda: has joined #ruby
[08:24:30] claudiuinberlin: has joined #ruby
[08:25:37] yohji: has joined #ruby
[08:27:46] halbbalda: has joined #ruby
[08:27:59] remix2000: has joined #ruby
[08:37:59] willmichael: has joined #ruby
[08:41:38] alfiemax: has joined #ruby
[08:44:38] oetjenj: has joined #ruby
[08:47:21] Sylario: has joined #ruby
[08:48:13] sidx64: has joined #ruby
[08:50:24] jottr: has joined #ruby
[08:51:01] xuyuheng: has joined #ruby
[08:53:45] mikecmpbll: has joined #ruby
[08:53:46] duckpuppy: has joined #ruby
[09:01:39] AJA4350: has joined #ruby
[09:01:59] aupadhye: has joined #ruby
[09:02:46] karapetyan: has joined #ruby
[09:05:05] deathwishdave: has joined #ruby
[09:05:12] workmad3: has joined #ruby
[09:08:00] laekur: has joined #ruby
[09:10:38] schneider: has joined #ruby
[09:11:14] laekur: has joined #ruby
[09:11:39] remix2000: Hello! Which framework (not rails) would be the best choice for an app that will use WebSockets?
[09:12:12] ltem: has joined #ruby
[09:12:23] dminuoso: remix2000: Do you just want websockets or more?
[09:13:36] Jameser: has joined #ruby
[09:14:38] remix2000: dminuoso: what does more mean there?
[09:14:50] dminuoso: remix2000: Do you also want to serve web pages?
[09:15:08] remix2000: dminuoso: yes
[09:17:47] schneider: has joined #ruby
[09:18:40] apeiros: has joined #ruby
[09:19:49] marr: has joined #ruby
[09:21:18] oetjenj: has joined #ruby
[09:24:22] RougeR: has joined #ruby
[09:24:54] Radar: Hanami has websocket support.
[09:25:16] Radar: Or... at least my memory told me so. Google says no.
[09:25:29] Radar: remix2000: why not Rails?
[09:25:57] schneider: has joined #ruby
[09:26:25] guille-moe: has joined #ruby
[09:29:47] remix2000: Radar: I think that Rails is an overkill for a simple app.
[09:32:43] camonz: has joined #ruby
[09:33:31] mtkd: has joined #ruby
[09:34:10] tomphp: has joined #ruby
[09:34:49] ltt: has joined #ruby
[09:37:59] alfiemax: has joined #ruby
[09:40:44] jnollette: has joined #ruby
[09:41:30] milardovich: has joined #ruby
[09:41:39] ltt: has joined #ruby
[09:44:11] tomphp: has joined #ruby
[09:48:58] konsolebox: has joined #ruby
[09:49:57] minimalism: has joined #ruby
[09:49:58] BTRE: has joined #ruby
[09:51:34] tomphp: has joined #ruby
[09:54:42] zenspider: might be overkill but you could have been done by now. :P
[09:54:51] Jameser: has joined #ruby
[09:55:02] duckpuppy: has joined #ruby
[09:55:19] dminuoso: Rails is not overkill. Let me just figure out the DSL to tell you how...
[09:56:23] Beams: has joined #ruby
[09:57:38] nymous: has joined #ruby
[09:57:50] nymous: hey folks. i have a question
[09:58:01] Jameser: has joined #ruby
[09:58:23] nymous: i'm using Mutex::owned? in my app, but I need to run it on 1.9.3 now, which is lacking of this method
[09:58:37] sidx64: has joined #ruby
[09:58:43] nymous: i can monkey patch Mutex i guess, but maybe there is a better way?
[09:59:28] apeiros: yes, it's not running 1.9
[10:00:51] apeiros: 1.9 is EOL and downwards compatibility from 2.5 with 1.9.3 is generally quite good. exotic native gems may cause issues, though.
[10:01:36] tao_: has joined #ruby
[10:01:50] dminuoso: ACTION .oO( Im so curious why so many people feel the need to monkey patch things )
[10:02:06] nymous: i have a bunch of old servers which i'm unwilling to upgrade yet
[10:02:08] dminuoso: I seem to be able to write thousands of lines of code without monkey patching other peoples code.
[10:02:19] apeiros: nymous: but you're willing to patch your way through?
[10:02:32] apeiros: frankly, you're spending your time on the wrong end of patching
[10:02:40] nymous: if it mean 10 mins vs 10 days - yes
[10:03:00] apeiros: there's 2 assumptions in there which both may very well be wrong
[10:03:31] dminuoso: Clearly the only problem between 1.9.3 and 2.5 is Mutex#owned
[10:03:32] nymous: ok, i have to upgrade 80 servers with reconfiguring all the staff
[10:03:44] nymous: OR i can add 3 lines of code into my app
[10:04:26] apeiros: you're still making the same assumption
[10:04:49] apeiros: but then again, I don't know your setup. maybe you manually upgrade each server separately.
[10:05:10] apeiros: (but that only considers one side of the assumptions)
[10:05:50] apeiros: anyway, at that point, if you want to patch your way through, go with the monkey patch.
[10:06:22] apeiros: also https://github.com/marcandre/backports
[10:06:59] dminuoso: If you have such an important software running on 80 servers, you should seriously make plans to patch things.
[10:07:01] apeiros: does not seem to contain Mutex#owned?, though
[10:08:33] cschneid: has joined #ruby
[10:08:42] nymous: even if it's upgrade is automated, you still have to reconfigure a lot
[10:08:49] dminuoso: "reconfigure" ?
[10:09:10] dminuoso: ACTION smells an infrastructure where you have to manually manage, configure and deploy 80 servers
[10:09:13] apeiros: I don't see how replacing an executable requires new configuraiton, but ok…
[10:09:36] dminuoso: The only thing keeping me from upgrading to 2.5 right now is some native extensions.
[10:09:39] nymous: the software is written in java, so it doesn't care about the rest of OS
[10:09:47] dminuoso: Like Im too scared to try ruby-oci8.
[10:10:59] apeiros: dminuoso: same. oracle is usually our reason to lag behind. like two minors, not six (which equates to 6 years)
[10:11:15] nymous: look, if you want me to be more specific, i can. i run opennebula 4.12 on this servers with custom made drivers, running on debian wheezy
[10:11:28] apeiros: nymous: no I don't
[10:11:40] apeiros: it's your shot to call
[10:11:43] nymous: i have to redo all infrastructure including driver upgrades, redoing networking and staff
[10:12:12] nymous: i don't think i can simply apt dist-upgrade to stretch in 5 minutes
[10:12:13] apeiros: and I care relatively little. all I have is an opinion and I gave you both my opinion and my reasoning for it.
[10:12:29] dminuoso: I think I understand where the problem comes from.
[10:12:36] nymous: so, well, yes i can do an upgrade to run my 100 lines ruby script
[10:12:36] apeiros: a) you'll eventually have to upgrade
[10:12:41] dminuoso: nymous: Avoid using system shipped Ruby (especially on Debian)
[10:12:49] apeiros: b) all time you spend in making old stuff compatibly is essentially wasted time
[10:13:00] nymous: but it's not worth it by now
[10:13:14] alfiemax: has joined #ruby
[10:13:15] apeiros: c) the time it takes to make old stuff compatible can very well be open-ended
[10:13:30] burgestrand: has joined #ruby
[10:13:42] dminuoso: nymous: When we say "get new ruby", we usually mean some form of "use some ppa or ruby-install based mechanism to get a fresh ruby"
[10:13:47] nymous: times goes fast, setup was made in 2014 and it was ok back then
[10:14:10] nymous: debian doesn't support ppa
[10:14:21] nymous: it doesn't have newer rubies in backports
[10:14:51] nymous: i don't want to waste my time searching what will break if i upgrade ruby
[10:14:56] conta: has joined #ruby
[10:15:02] nymous: you know, opennebula uses ruby too
[10:15:29] dviola: has joined #ruby
[10:17:35] qba73: has joined #ruby
[10:18:28] apeiros: nymous: that's we we usually don't touch system ruby for our stuff
[10:18:43] apeiros: use a user-install where you only have to care about your stuff
[10:19:09] nymous: it's for a little backend script
[10:23:02] apeiros: not sure why you spend so much time here then. if it's a tiny script, fix the script to not use a 2.5 feature then.
[10:23:53] SynSynack: has joined #ruby
[10:24:11] Fusselgesicht: has joined #ruby
[10:24:14] ledestin: has joined #ruby
[10:25:18] oetjenj: has joined #ruby
[10:25:37] tomphp: has joined #ruby
[10:25:47] Serpent7776: has joined #ruby
[10:26:13] yohji: has joined #ruby
[10:27:34] pugcs: has joined #ruby
[10:27:47] nymous: i was hoping to hear about something like above mentioned backports lib, and not reinvent the wheel by myself
[10:28:40] dminuoso: It's fairly likely that you can just rewrite y using
[10:28:43] dminuoso: &ri try_lock
[10:28:43] `derpy: http://ruby-doc.org/core-2.4.1/Thread/Mutex.html#method-i-try_lock
[10:29:00] gray_-_wolf: nymous: why not just make own ruby package? that should allow you upgrade ruby without having to touch rest of the os
[10:29:00] dminuoso: If its just a 100 line script, then fix the script - not the language.
[10:29:08] dminuoso: owned? is documented to be an experimental API
[10:29:38] dminuoso: Or you know, you can use #locked? directly
[10:29:52] dminuoso: It's completely beyond me why one would consider monkey patching anything.
[10:29:57] rikkipitt: has joined #ruby
[10:30:04] dminuoso: Monkey patching is almost always a design flaw.
[10:30:13] qba73: has joined #ruby
[10:30:37] gray_-_wolf: dminuoso: sometimes on the library/gem part though
[10:30:39] nymous: https://github.com/ruby-concurrency/concurrent-ruby/blob/master/lib/concurrent/synchronization/mri_lockable_object.rb#L35
[10:30:42] nymous: see this?
[10:31:09] mtkd: has joined #ruby
[10:31:12] nymous: if i'll try to run this lib on 1.9.3 i get unknown method
[10:32:10] nymous: this is what i want to fix with less effort
[10:32:35] darix: nymous: probably the lib requires a newer ruby version
[10:33:10] nymous: own ruby package might work though
[10:33:17] nymous: omnibus or something
[10:33:39] darix: well depending on your platform ... your distro might also support newer versions
[10:33:52] darix: or there is a newer version of your OS which comes with a newer ruby version
[10:34:05] Ethan: nymous: that's a very old version of Ruby. What OS are you running?
[10:34:08] nymous: debian wheezy
[10:34:37] darix: is that even still supported?
[10:34:45] nymous: i think not
[10:35:00] Ethan: may I ask why you're running a 5 year old version of debian?
[10:35:02] nymous: i don't have time to upgrade 80 servers though
[10:35:40] Ethan: Wheezy LTS support ends May 31st
[10:35:55] Ethan: so if you care about the security of your servers, you'll want to reconsider.
[10:35:57] darix: "I will upgrade after I got hacked through a bug that would be fixed in a supported debian version"
[10:36:03] gray_-_wolf: so he's still good for 16 days ^_^
[10:36:17] darix: gray_-_wolf: 2.5months
[10:36:31] Ethan: TIME TRAVELLER!
[10:36:33] gray_-_wolf: f... May X March... my English sucks
[10:36:41] Terens: has joined #ruby
[10:36:54] nymous: the problem is, these servers were supposed to be disabled in 2016, but real life is a little bit more complicated
[10:37:11] darix: nymous: so maybe use the next 2.5months to port your app to a newer ruby version and test the upgrade
[10:37:30] darix: nymous: if you leave them on, you also have to do the tasks that come with it. which includes updating :P
[10:37:36] nymous: my is already running on newer server with newer ruby
[10:37:38] darix: there is no free lunch
[10:37:57] ltt: has joined #ruby
[10:38:14] Ethan: hey look the sysadmin I'd never want to work with
[10:38:28] nymous: but this bunch of old servers which i was unwilling to touch now need this script too
[10:38:41] gray_-_wolf: nymous: I think best solution here (assuming upgrading servers is not an option) is to make own ruby package; if possible it's probably better than monkeypatching it
[10:39:18] darix: Ethan: huh?
[10:39:28] darix: Ethan: I dont blame him
[10:39:36] darix: might be management problem
[10:39:38] nymous: my current setup runs latest debian stretch with ruby2.3
[10:40:03] nymous: so no problem here
[10:40:34] darix: nymous: which configuration management thing do you use?
[10:40:51] nymous: it's just a bunch of old servers which were supposed to be disposed 2 years ago, but in the middle of the process management said, stop, we are ok with that
[10:41:08] hfp_work: has joined #ruby
[10:41:21] nymous: so blame me or not, it's real life
[10:41:37] nymous: darix: puppet before, chef now
[10:41:58] darix: then you can automate the updating easily :P
[10:42:44] nymous: i can spend couple of days upgrading them and they would be disposed a week later
[10:42:44] milardovich: has joined #ruby
[10:43:46] nymous: jessie to stretch upgrading was relatively easy, but wheezy to jessie means porting sysv stuff to systemd etc
[10:45:40] darix: nymous: or in 2 years you will be running the same servers
[10:47:35] xuyuheng: has joined #ruby
[10:48:21] nymous: the bad thing is that i'm using another networking virtualisation setup for my current servers, so i want them to be the same as the newer ones, i have to redone networking, which is pain and downtime
[10:48:31] nymous: *if i want
[10:53:35] duckpuppy: has joined #ruby
[10:54:46] ltt: has joined #ruby
[10:56:19] Terens: is this ok to use? https://gist.github.com/parhs/222e84ee8a77417f915dfc6efd3e73c2
[10:57:46] dminuoso: terens: Please make a habit to a) use a .rb file extension to enable syntax highlighting and b) fix your indentation issues. You are using mixed space and tabs.
[10:58:02] dminuoso: terens: Don't share your gist until you looked at your gist, and determined that is clean and easy to read.
[10:58:21] dminuoso: (Or perhaps its just some copy paste error - either way)
[10:58:55] phaul: has joined #ruby
[11:00:47] sidx64: has joined #ruby
[11:02:03] tockitj: has joined #ruby
[11:02:27] tockitj: how to let drb instantiate new object on each client connection? So far I was able only to expose a class.
[11:04:12] workmad3: has joined #ruby
[11:07:41] Jameser: has joined #ruby
[11:08:10] KeyJoo: has joined #ruby
[11:12:00] sidx64: has joined #ruby
[11:14:26] tvw: has joined #ruby
[11:15:16] guacamole: has joined #ruby
[11:17:43] jrafanie: has joined #ruby
[11:17:45] burgestrand: has joined #ruby
[11:18:19] catphish: has joined #ruby
[11:18:42] ltt: has joined #ruby
[11:18:51] catphish: is the bundler gem dead? i see bundler in rubygems
[11:19:48] marahin: catphish: what? No, it's not dead. https://rubygems.org/gems/bundler
[11:19:54] _insomniac: has joined #ruby
[11:20:01] koenrh_: has joined #ruby
[11:20:13] Yonk_: has joined #ruby
[11:20:15] dminuoso: I just manually use `gem`, its so much more flexible.
[11:20:28] tycoon177_: has joined #ruby
[11:20:28] mitsuhiko_: has joined #ruby
[11:20:28] pizzaops_: has joined #ruby
[11:20:33] deimos_: has joined #ruby
[11:20:34] diego3: has joined #ruby
[11:20:36] mozzarel1: has joined #ruby
[11:20:37] catphish: marahin: i think you're right, not sure what i've messed up here then :)
[11:20:52] caw_______: has joined #ruby
[11:20:56] hsiktas_: has joined #ruby
[11:21:00] rwb1: has joined #ruby
[11:21:02] diego3: has joined #ruby
[11:21:14] rheddry: has joined #ruby
[11:21:24] stairmast0r_: has joined #ruby
[11:21:27] justache_: has joined #ruby
[11:21:39] AJA4351: has joined #ruby
[11:21:45] schneider: has joined #ruby
[11:22:14] vald: has joined #ruby
[11:22:14] tockitj: found resolution to my problem (it was DRbUndumped)
[11:22:16] hlmjr: has joined #ruby
[11:22:23] sjumsa: has joined #ruby
[11:22:32] ozzloy_: has joined #ruby
[11:22:38] ptx0_: has joined #ruby
[11:22:42] X-Jester_: has joined #ruby
[11:22:52] Bish_: has joined #ruby
[11:22:54] ablackack: has joined #ruby
[11:22:55] insu: has joined #ruby
[11:23:00] jp|: has joined #ruby
[11:23:01] ljarvis_: has joined #ruby
[11:23:02] cout_: has joined #ruby
[11:23:03] devyn_: has joined #ruby
[11:23:04] izaac_: has joined #ruby
[11:23:12] willmichael: has joined #ruby
[11:23:18] n0m4d1c_: has joined #ruby
[11:23:23] ccooke_: has joined #ruby
[11:23:24] shadeslayer_: has joined #ruby
[11:23:25] DarkArc: has joined #ruby
[11:23:29] kloeri_: has joined #ruby
[11:23:30] knightnc: has joined #ruby
[11:23:31] n13z_: has joined #ruby
[11:23:32] Gnut__: has joined #ruby
[11:23:40] graft_: has joined #ruby
[11:23:40] graft_: has joined #ruby
[11:23:47] MarcWebe1: has joined #ruby
[11:23:49] russt_: has joined #ruby
[11:23:56] llua`: has joined #ruby
[11:24:02] catphish: i run gem update --system; gem install bundler, but on ruby 2.5 something odd is happening, the gem update pulls in bundler, then the gem install bundler fails with: "bundle" from bundler conflicts with /opt/ruby/2.5/bin/bundle
[11:24:14] brodul: has joined #ruby
[11:24:22] snapcase_: has joined #ruby
[11:24:40] Freijo: has joined #ruby
[11:24:47] DEac-: has joined #ruby
[11:24:52] ericmath1son: has joined #ruby
[11:24:56] pugcs: has joined #ruby
[11:25:26] psmolen_: has joined #ruby
[11:25:40] |337: has joined #ruby
[11:25:46] DTZUZO: has joined #ruby
[11:26:01] flips_: has joined #ruby
[11:26:10] alfiemax: has joined #ruby
[11:26:10] catphish: "gem install --force bundler" should fix my issue
[11:26:22] segy_: has joined #ruby
[11:26:23] foxxx0_: has joined #ruby
[11:26:40] CalimeroTeknik_: has joined #ruby
[11:26:48] catphish: i'll give that a try
[11:27:16] _whitelogger_: has joined #ruby
[11:27:19] kt2: has joined #ruby
[11:27:51] jordanm: has joined #ruby
[11:27:54] WebDawg: has joined #ruby
[11:27:56] octomancer: has joined #ruby
[11:28:12] `derpy: has joined #ruby
[11:28:14] cjohnson: has joined #ruby
[11:28:17] mikkel-_: has joined #ruby
[11:28:22] mlehrer: has joined #ruby
[11:28:46] v0n: has joined #ruby
[11:29:00] naquad: has joined #ruby
[11:29:00] Drakevr_: has joined #ruby
[11:29:00] koenrh: has joined #ruby
[11:29:01] Yonk_: has joined #ruby
[11:29:01] pizzaops: has joined #ruby
[11:29:01] justache: has joined #ruby
[11:29:01] caw_______: has joined #ruby
[11:29:01] hsiktas: has joined #ruby
[11:29:01] deimos: has joined #ruby
[11:29:01] mlehrer: has joined #ruby
[11:30:14] mnemon: has joined #ruby
[11:32:20] za1b1tsu: has joined #ruby
[11:32:31] ramfjord: has joined #ruby
[11:33:05] tomphp: has joined #ruby
[11:33:38] naquad: has joined #ruby
[11:34:09] tomphp: has joined #ruby
[11:34:43] xorgnak: has joined #ruby
[11:35:01] qba73: has joined #ruby
[11:43:09] pugcs: has left #ruby: ()
[11:43:21] pugcs: has joined #ruby
[11:44:54] dr3wo: has joined #ruby
[11:44:54] sidx64: has joined #ruby
[11:45:37] tomphp: has joined #ruby
[11:45:47] schneider: has joined #ruby
[11:45:51] pugcs: has joined #ruby
[11:48:04] duckpuppy: has joined #ruby
[11:48:13] Cavallari: has joined #ruby
[11:51:46] ltem_: has joined #ruby
[11:52:47] WhereIsMySpoon: has joined #ruby
[11:52:56] WhereIsMySpoon: Can someone help me how to use this library? https://github.com/jvoorhis/ruby-portaudio/blob/master/lib/portaudio.rb
[11:53:01] halbbalda: has joined #ruby
[11:53:06] WhereIsMySpoon: What do I need to require in order to use this PortAudio class
[11:53:09] ldnunes: has joined #ruby
[11:54:03] herbmillerjr: has joined #ruby
[11:54:35] sidx64: has joined #ruby
[11:54:40] WhereIsMySpoon: He has an example at the bottom of the file but I dont understand how he’s using the PortAudio object
[11:55:11] qba73: has joined #ruby
[11:58:13] John_Ivan: has joined #ruby
[11:58:15] schneider: man, is there a way to use bundler to install gems from gemfile from a ruby script?
[11:59:50] yokel: has joined #ruby
[12:00:32] milardovich: has joined #ruby
[12:02:29] qba73: has joined #ruby
[12:04:33] roshanavand: has joined #ruby
[12:07:58] _nymous_: has joined #ruby
[12:08:30] schneider: has joined #ruby
[12:09:25] _nymous_: the bad thing about omnibus is that you need to rebuild package if you need more dependencies in one special case
[12:10:48] shinnya: has joined #ruby
[12:14:15] WhereIsMySpoon: Has anyone used google-cloud-speech here?
[12:14:42] WhereIsMySpoon: Im trying desperately to find something that will capture microphone input so I can stream it into google cloud speech
[12:14:52] WhereIsMySpoon: The doc in the project isnt very useful
[12:19:49] Terens: WhereIsMySpoon, you need some system calls I guess
[12:20:11] WhereIsMySpoon: terens: any pointers?
[12:20:23] Terens: dont know :(
[12:20:25] burgestrand: WhereIsMySpoon what have you tried with to get the portaudio work?
[12:20:29] Terens: in c it was relativly easy
[12:20:58] IshMael_: has joined #ruby
[12:21:17] WhereIsMySpoon: Burgestrand: require ‘portaudio’ and require ‘ffi-portaudio'
[12:21:40] Terens: there is http://www.rubydoc.info/gems/easy_audio/frames
[12:21:57] WhereIsMySpoon: yeah im trying to play with easy audio but i cant seem to get it to output to a file or to a stream
[12:22:03] WhereIsMySpoon: it just outputs straight back to speaker
[12:22:05] oetjenj: has joined #ruby
[12:22:13] Terens: recording doesnt work?
[12:22:26] WhereIsMySpoon: recording works, i just cant work out how to make it record to a file/stream
[12:22:32] burgestrand: WhereIsMySpoon so did you install ffi-portaudio before you tried it, or how'd you attempt to install the portaudio that you linked to?
[12:22:34] WhereIsMySpoon: rather than just record-playback
[12:22:43] WhereIsMySpoon: Burgestrand: I installed portaudio via brew
[12:22:51] burgestrand: WhereIsMySpoon because ffi-portaudio and portaudio there are two different things
[12:23:01] burgestrand: WhereIsMySpoon that's only the C library, not the ruby library that you showed us
[12:23:07] burgestrand: (you need both)
[12:23:32] WhereIsMySpoon: ah, i think i installed the gem ffi-portaudio
[12:23:37] WhereIsMySpoon: not the ruby lib i linked
[12:23:48] WhereIsMySpoon: how do i install that ruby lib?..
[12:23:58] WhereIsMySpoon: or do I need to download the file and use it directly?
[12:24:46] karapetyan: has joined #ruby
[12:24:56] burgestrand: ffi-portaudio might be sufficient, easy_audio appears to use that too
[12:25:01] burgestrand: … actually, maybe not.
[12:25:20] WhereIsMySpoon: easy_audio seems to be nicer
[12:25:22] burgestrand: I did a bunch of audio driver work in ruby a while back, it was bad enough that I pretty much had to write my own…
[12:25:27] WhereIsMySpoon: if i could get it to output to file/stream
[12:25:36] alfiemax: has joined #ruby
[12:25:43] burgestrand: Ah, yes, it does use ffi-portaudio, never mind!
[12:26:49] AndroUser: has joined #ruby
[12:27:23] WhereIsMySpoon: Burgestrand: :) so I dont want portaudio ruby lib or ffi-portaudio
[12:27:27] WhereIsMySpoon: easy_audio will work?
[12:27:42] burgestrand: Yeah, easy_audio also includes ffi-portaudio so you can drop down to the harder-to-use API if needed
[12:28:07] WhereIsMySpoon: Right, and can you help me understand how to record to a file/stream?
[12:28:10] WhereIsMySpoon: using easyaudio?
[12:29:07] burgestrand: I'm trying to read it, but I'm not sure that easy_audio can output to anything other than a portaudio device (and I'm not familiar enough with portaudio to know if you can create a "file" device)
[12:30:41] burgestrand: I'm fairly sure you'll get uncompressed PCM samples, what kind of input is your google speech thing expecting?
[12:30:58] sidx64: has joined #ruby
[12:31:34] alfiemax: has joined #ruby
[12:32:01] burgestrand: Maybe they can accept raw audio, there seems to be an encoding option in google speech thingy :)
[12:32:05] WhereIsMySpoon: Burgestrand: yes, it can
[12:32:24] WhereIsMySpoon: so whats a pcm sample?
[12:32:26] burgestrand: Yeah, I'm not entirely sure `raw` is actually a format
[12:32:47] WhereIsMySpoon: is what it uses for RAW files
[12:32:51] burgestrand: WhereIsMySpoon it's typically what speakers/microphones produce/consume, essentially a way to encode audio into digital format
[12:32:54] WhereIsMySpoon: in the examples at least
[12:33:00] burgestrand: WhereIsMySpoon you can think of it as an array of numbers
[12:33:26] WhereIsMySpoon: ahh, is it an array of frequencies?
[12:33:44] WhereIsMySpoon: i have some experience with signals and audio, i did electronics at uni
[12:33:44] burgestrand: Not quite, but you can analyze the frequencies using fourier transforms
[12:34:03] WhereIsMySpoon: bit hazy now :P
[12:34:12] WhereIsMySpoon: and the numbers are the output of those transforms?
[12:34:50] burgestrand: WhereIsMySpoon so when you're dealing with raw PCM data, you typically need to know how many channels there are (i.e. 1 (mono), 2 (audio)) and the sample rate (i.e. 44.1kHz, playback speed) and the size of the samples (16bit?)
[12:34:55] AndroUser: has left #ruby: ("退出消息")
[12:35:02] WhereIsMySpoon: google cloud can only analyze 1 channel audio
[12:35:04] AndroUser: has joined #ruby
[12:35:06] burgestrand: Maybe something more too, I might have forgotten…
[12:35:19] burgestrand: Cool, so if your mic is giving you multiple channels we can probably just throw one away
[12:35:20] WhereIsMySpoon: it has inputs for sample rate
[12:35:37] mtkd: has joined #ruby
[12:36:12] WhereIsMySpoon: right, so how do I get easy_audio to output this raw data to a variable or file
[12:36:14] burgestrand: … also important to know if the channels come interleaved or some other way
[12:36:40] burgestrand: Not for google audio, but for when you're getting the data from the microphone
[12:36:54] burgestrand: You can probably configure it to just give you a single channel, too :)
[12:37:17] Psybur__: has joined #ruby
[12:37:24] burgestrand: WhereIsMySpoon you do it yourself, you can pass a block to the EasyAudio::Stream.new, and that will get a buffer and a description of the contents of the buffer (sample rate, channels)
[12:38:04] WhereIsMySpoon: right so this: EasyAudio.easy_open(in: true, out: true, latency: 1.0) { current_sample } will do what? Output the mic input into current_sample?
[12:38:11] burgestrand: WhereIsMySpoon keep in mind all of the audio stuff I'm explaining to you I've kind of taught myself through trial and error, there might be inconsistencies or gaps or straight out errors in what I say :)
[12:38:20] WhereIsMySpoon: better than what ive got :D
[12:38:36] WhereIsMySpoon: this is all for a personal project so no biggie
[12:38:56] burgestrand: Oh, wow, no I wouldn't use EasyStream
[12:39:10] burgestrand: Well, depending on the hardware you're running on it might not be a problem
[12:39:37] WhereIsMySpoon: i have gotten it to record and playback my voice already
[12:39:47] WhereIsMySpoon: just only ina direct input -> output
[12:39:52] WhereIsMySpoon: not storing the data
[12:40:14] burgestrand: WhereIsMySpoon yeah, I think just use a regular stream with a block, so you get the samples chunked, that way you'll buffer the writes to file and it'll perform better :)
[12:40:48] WhereIsMySpoon: http://www.rubydoc.info/gems/easy_audio/EasyAudio/Stream
[12:40:51] burgestrand: WhereIsMySpoon if I'm reading the source correctly, then if you return a symbol from the processing block it'll simply ignore whatever output device is configured
[12:40:56] burgestrand: WhereIsMySpoon yeah I'm reading here: https://github.com/lsegal/easy_audio/blob/master/lib/easy_audio.rb hehe
[12:42:05] WhereIsMySpoon: Hum…Im probably being stupid
[12:42:09] WhereIsMySpoon: How do I use this? xD
[12:42:39] burgestrand: Naw, this is some complex stuff, plus the code is old and documentation could be better :)
[12:42:48] WhereIsMySpoon: I dont mind complex
[12:43:07] WhereIsMySpoon: As long as I can say stuff into my mic and I can throw it at google cloud speech :P
[12:43:42] burgestrand: WhereIsMySpoon yeah, I'm playing a bit with the code at the moment, just writing up a basic project to see if I can get it to read my mic
[12:47:33] WhereIsMySpoon: im not sure theres a way of changing the output
[12:47:45] WhereIsMySpoon: i may need to download this file and integrate it with my project and change teh code
[12:47:50] WhereIsMySpoon: or just not use this project
[12:47:54] WhereIsMySpoon: and use something else
[12:48:15] burgestrand: Appears that the released gem also doesn't contain the latest code
[12:48:46] WhereIsMySpoon: device = API.Pa_GetDefaultOutputDevice
[12:48:50] WhereIsMySpoon: this needs changing somehow
[12:49:02] Psybur: has joined #ruby
[12:49:09] WhereIsMySpoon: brb getting lunch
[12:49:14] WhereIsMySpoon: thank you so far :)
[12:51:55] konsolebox: has joined #ruby
[12:53:44] jrafanie: has joined #ruby
[12:54:20] ldnunes: has joined #ruby
[12:55:24] duckpuppy: has joined #ruby
[12:57:34] KeyJoo: has joined #ruby
[12:59:26] edfk2012: has joined #ruby
[13:00:41] kapil___: has joined #ruby
[13:02:15] edfk2012: has left #ruby: ()
[13:02:34] edfk2012: has joined #ruby
[13:03:14] leitz: has joined #ruby
[13:03:18] CalimeroTeknik: (how) could I avoid using rescue in this getter? http://ix.io/Xot
[13:03:44] dminuoso: CalimeroTeknik: What exception are you trying to protect against?
[13:05:14] dminuoso: CalimeroTeknik: And what's the shape (sighs...) of @seen
[13:05:38] CalimeroTeknik: yes sorry, I should have provided an example: { 'foo' => {:nick => 'max'}, 'bar' => {:nick => 'axel'} }.find{|user, data| data[:nick] == 'baz' }.last
[13:05:58] CalimeroTeknik: with this snippet it's easier to try it out
[13:06:50] CalimeroTeknik: try replacing 'baz' with 'max' to see the expected result for when it does find it
[13:07:42] CalimeroTeknik: expectably the exception is NoMethodError, essentially the result of nil.last
[13:08:27] edfk2012: has joined #ruby
[13:09:10] rfoust: has joined #ruby
[13:11:11] dminuoso: CalimeroTeknik: Let's say I forbid you to use rescue, what would you have to do?
[13:11:24] ltd: has joined #ruby
[13:12:24] CalimeroTeknik: find a monadic version of last
[13:12:52] dminuoso: Curious. What do you mean by monadic version of last?
[13:13:49] CalimeroTeknik: a version of last that does not evaluate if not fed a value
[13:13:53] memo1: has joined #ruby
[13:14:15] dminuoso: CalimeroTeknik: Alright cool. So you kind of misused monadic there. :-)
[13:14:38] dminuoso: Although incidentally there is a monad you can tap into, but "monadic" is something far more general
[13:14:42] CalimeroTeknik: yes, because it's a weird stretch to consider 'nil' as a way to represent Maybe
[13:14:55] dminuoso: CalimeroTeknik: Yes! As it so happens, there is a monadic interface.
[13:15:01] dminuoso: CalimeroTeknik: &. is the equivalent of >>=
[13:15:21] sidx64: has joined #ruby
[13:16:01] jeffreylevesque: has joined #ruby
[13:16:08] CalimeroTeknik: oh, nice. as expected of ruby, the trick always exists
[13:17:04] dminuoso: CalimeroTeknik: I personally like to think of Ruby values as _all_ being Maybe wrapped.
[13:17:15] dminuoso: Since generally any method could somehow produce a nil back.
[13:17:27] nowhere_man: has joined #ruby
[13:17:57] dminuoso: CalimeroTeknik: However, in a different perspective, your previous code does the same thing.
[13:18:00] dminuoso: Maybe models exceptions.
[13:18:28] dminuoso: If you think about it, the Maybe monad represents a failable computation, that once a failure occurs propagates the failure until someone cares about it. All the computation in between is shortcircuited.
[13:18:35] dminuoso: That is just an exception.
[13:18:53] CalimeroTeknik: admittedly, the point is to not use the rescue structure; I wanted the same semantics, but in the form of an expression
[13:19:25] dminuoso: CalimeroTeknik: Just for giggles, Array#flat_map is >>= for Array =)
[13:20:55] dminuoso: CalimeroTeknik: It may possibly be cleaner to do this
[13:21:33] dminuoso: >> { 'foo' => {:nick => 'max'}, 'bar' => {:nick => 'axel'} }.values.find { |e| e[:nick] = 'max' }
[13:23:12] cdg: has joined #ruby
[13:24:02] Strepsils: has joined #ruby
[13:24:58] sidx64: has joined #ruby
[13:25:47] CalimeroTeknik: oh, avoiding the call to last and the extra param indeed
[13:26:54] CalimeroTeknik: maybe you need == instead of =? isn't that mutating the value?
[13:27:18] dminuoso: CalimeroTeknik: Sorry yes.
[13:27:40] dminuoso: What can I say: Just proving a point that type systems are invaluable.
[13:28:27] CalimeroTeknik: curiously enough your version works
[13:28:40] CalimeroTeknik: I have yet to figure out what is going on there
[13:28:59] oetjenj: has joined #ruby
[13:29:09] gr33n7007h: has joined #ruby
[13:29:15] CalimeroTeknik: okay, first element…
[13:29:30] CalimeroTeknik: well, "first" is a coincidence, a hash has no order per se
[13:29:59] CalimeroTeknik: .values creates a brand new datastructure it seems
[13:30:36] CalimeroTeknik: uh no sorry, it clearly doesn't
[13:31:10] WhereIsMySpoon: has joined #ruby
[13:31:15] WhereIsMySpoon: Burgestrand: back :)
[13:31:29] burgestrand: WhereIsMySpoon I got it to work!
[13:31:41] burgestrand: WhereIsMySpoon the computer understands me!
[13:32:30] burgestrand: WhereIsMySpoon so, yeah, use EasyAudio::Stream.new(format) { |buffer| *code* } for one, the block will be called every N samples
[13:32:31] dminuoso: CalimeroTeknik: Hashes maintain insertion order.
[13:32:37] dminuoso: CalimeroTeknik: So they are not completely unordered.
[13:32:42] ramfjord: has joined #ruby
[13:32:59] burgestrand: WhereIsMySpoon you can read the samples from the `buffer` (which is essentially a struct with some data), the samples you're after are inside `buffer.samples`, which is an array of floats
[13:33:46] burgestrand: WhereIsMySpoon now, GCS expects 1-channel 16-bit little endian integer PCM data, so unfortunately we can't just pack the array of floats into a string and then save it, we need to convert it a little bit
[13:34:23] WhereIsMySpoon: sorry im a bit lost, where does buffer come from and how do i use it
[13:34:48] burgestrand: WhereIsMySpoon EasyAudio::Stream.new(format) { |buffer| *code* } <- there is the buffer
[13:35:39] WhereIsMySpoon: im still lost :P
[13:35:56] burgestrand: WhereIsMySpoon where?
[13:36:27] WhereIsMySpoon: what is format supposed to be and what do i do with buffer
[13:37:16] burgestrand: WhereIsMySpoon what format you want depends a bit, I just set it to the default, but made sure to specify that the number of input channels is 1 (most important)
[13:37:41] dminuoso: CalimeroTeknik: Oh and the regular usage of `.` equals to fromJust by the way - blowing up when nil comes along (kind of)
[13:38:02] WhereIsMySpoon: ok, so EasyAudio::Stream.new(in_chans: 1)
[13:38:08] WhereIsMySpoon: and then what do i do with buffer
[13:38:08] dminuoso: (Also in a weird way)
[13:39:00] qba73: has joined #ruby
[13:39:14] burgestrand: WhereIsMySpoon buffer.samples is an array of floats, that's where the audio data is, so that's the thing that you need to save before the block returns
[13:39:42] WhereIsMySpoon: EasyAudio::Stream.new(in_chans: 1) { |buffer| a.push(buffer) }.start gives me an invalid memory address error
[13:39:57] WhereIsMySpoon: i made a an empty array
[13:41:05] WhereIsMySpoon: ah, right, all i want to do is store buffer.samples in a
[13:41:07] WhereIsMySpoon: not push it to a
[13:41:12] WhereIsMySpoon: but still, i get invalid memory error
[13:41:24] WhereIsMySpoon: irb(main):053:0> invalid memory write at address=0x00000000000000
[13:41:26] burgestrand: WhereIsMySpoon ah yes, make sure your block returns :paContinue
[13:42:10] WhereIsMySpoon: irb(main):055:0> EasyAudio::Stream.new(in_chans: 1) { |buffer| a = buffer.samples; :paContinue }.start ?
[13:42:33] WhereIsMySpoon: oh wait itll be a variable on easyaudio somewhere
[13:42:57] psychicist__: has joined #ruby
[13:43:04] burgestrand: WhereIsMySpoon if you return a symbol inside the block, EasyAudio will assume that's the return value of the entire audio processing callback, and will not send it to the speakers
[13:43:27] burgestrand: WhereIsMySpoon so yeah, just make :paContinue the last line of the block
[13:44:16] ltt: has joined #ruby
[13:44:18] WhereIsMySpoon: that isnt working
[13:44:23] WhereIsMySpoon: ive required ffi-portaudio in my irb
[13:44:30] WhereIsMySpoon: and easy_audio ofc
[13:44:34] am55: has joined #ruby
[13:44:46] WhereIsMySpoon: irb(main):004:0> EasyAudio::Stream.new(in_chans: 1) { |buffer| a = buffer.samples; :paContinue }.start
[13:44:48] WhereIsMySpoon: irb(main):005:0> invalid memory write at address=0x00000000000000
[13:46:58] burgestrand: Ah. Indeed, I'm using the easy_audio from github, not the release from rubygems, because the one in rubygems doesn't allow _not_ echoing to the speakers again :(
[13:47:50] WhereIsMySpoon: Burgestrand: I can grab the source, how do I put it in my project so I can just require it like i would a normal gem
[13:48:02] burgestrand: WhereIsMySpoon are you using bundler for your project?
[13:48:15] sidx64: has joined #ruby
[13:48:26] WhereIsMySpoon: i have bundler installed
[13:48:38] WhereIsMySpoon: i certianly can use it
[13:48:50] WhereIsMySpoon: ive used it before, but only for simple bundle install/bundle exec stuff
[13:48:52] burgestrand: WhereIsMySpoon as long as you're not making a gem of this we're all good :)
[13:49:44] burgestrand: WhereIsMySpoon call `bundle init` and then open the `Gemfile` that's created, and then you need to insert the name of all gems you'll be using in there
[13:49:55] WhereIsMySpoon: ive got a gemfile
[13:49:58] burgestrand: WhereIsMySpoon for specifically easy_audio, you can insert: `gem "easy_audio", github: "lsegal/easy_audio"`
[13:50:25] burgestrand: WhereIsMySpoon … and then bundle install :) when you run your project make sure you use either `bundle exec` or you `require "bundler/setup"` somewhere in your code
[13:50:46] burgestrand: WhereIsMySpoon all of this can be read about in http://bundler.io
[13:52:30] WhereIsMySpoon: how do I require easy_audio in irb now? :P
[13:53:00] burgestrand: WhereIsMySpoon same as before, just make sure you either launch IRB with bundler or require "bundle/setup" once you're in IRB
[13:53:04] WhereIsMySpoon: ah i need to..yeah
[13:53:27] duckpuppy: has joined #ruby
[13:54:21] WhereIsMySpoon: EasyAudio::Stream.new(in_chans: 1) { |buffer| a = buffer.samples; :paContinue }.start seems to block
[13:54:25] WhereIsMySpoon: and ctrl-c doesnt stop it
[13:54:41] rafik: has joined #ruby
[13:55:06] sidx64: has joined #ruby
[13:55:15] burgestrand: I've had it deadlock on me a few times too
[13:55:20] burgestrand: It's not consistent
[13:55:32] WhereIsMySpoon: ah, pushing buffer.samples to a as an array seems to work
[13:56:08] karapetyan: has joined #ruby
[13:56:21] rwb: has joined #ruby
[13:58:01] WhereIsMySpoon: Burgestrand: right, I have a very large 2d array
[13:58:06] WhereIsMySpoon: im not sure what it contains
[13:58:37] WhereIsMySpoon: loads of numbers
[13:58:42] WhereIsMySpoon: what do i do with it now :)
[13:58:56] burgestrand: WhereIsMySpoon hehe, buffer.samples is an array, so it's probably an Nx256 (i.e. each element is an array of 256 decimal numbers)
[13:59:05] S007: has joined #ruby
[13:59:49] burgestrand: WhereIsMySpoon I'm fairly sure that each float you have there is an amplitude value for each sample, between -1 and +1, does that look about right?
[13:59:53] JamieD: has joined #ruby
[14:00:11] burgestrand: WhereIsMySpoon (a float is a decimal number)
[14:00:23] WhereIsMySpoon: im aware what a float is :) yes i think so
[14:01:52] bmurt: has joined #ruby
[14:01:54] burgestrand: WhereIsMySpoon yeah, alright, so I think GCS only accepts integer format audio, so you need to convert each -1 to +1 float into a -32768 to 32767 (i.e. minimum and maximum value of a 16-bit integer)
[14:02:34] WhereIsMySpoon: i suppose this involves bit shifting
[14:02:42] WhereIsMySpoon: or are there built in ruby tools for this :D
[14:03:05] burgestrand: Well, maybe it could, but we're doing audio processing in ruby so we've already abandoned most of the efficiency requirements anyway :)
[14:03:30] burgestrand: (i.e. traditionally you don't want to allocate memory inside the audio processing callback, we're kind of screwed since we're using a ruby block as the callback)
[14:04:04] burgestrand: WhereIsMySpoon so, well, easiest conversion is something like this: int16_sample = (float_sample * 32768).to_i
[14:04:04] Dimik: has joined #ruby
[14:05:13] tomphp: has joined #ruby
[14:06:14] SteenJobs: has joined #ruby
[14:06:49] burgestrand: WhereIsMySpoon and once you've done that, there's only one step left, and that's converting the samples into a string of bytes, which you can do using Array#pack
[14:07:14] burgestrand: WhereIsMySpoon I read that GCS wants 16-bit signed little-endian integers, so it'd look something like this:
[14:07:48] burgestrand: >> audio_data = [32767, 32767, 32767, 32767].pack("s<")
[14:07:57] burgestrand: ACTION kicks ruby[bot] 
[14:08:09] cschneid: has joined #ruby
[14:08:17] dr3wo: has joined #ruby
[14:08:58] WhereIsMySpoon: how do i stop irb outputting this huge array each time xD
[14:09:14] burgestrand: I'm not sure what you're doing to make it do that in the first place :)
[14:09:54] WhereIsMySpoon: well i did a.each do |arr|; arr.each do | el | el = (el*32768).to_i; end; end
[14:10:02] burgestrand: Oh, sorry, format should be "s<*" (or probably "s<256")
[14:10:05] WhereIsMySpoon: which actually doesnt seem to have done anything
[14:10:13] guille-moe: has joined #ruby
[14:10:14] burgestrand: WhereIsMySpoon yeah, look into Array#map
[14:10:17] ryandv: has joined #ruby
[14:10:24] burgestrand: >> [1, 2, 3, 4, 5].map { |x| x * 2 }
[14:10:30] burgestrand: … ruby[bot] wake up :(
[14:11:10] nfsnobody: has joined #ruby
[14:11:36] WhereIsMySpoon: Burgestrand: 32767 or 32768 for the multiplier :P
[14:12:00] burgestrand: WhereIsMySpoon minimum value should be -32768 but maximum value should be 32767
[14:12:12] WhereIsMySpoon: right, so its (el*32767).to_i
[14:12:24] synthroid: has joined #ruby
[14:12:48] burgestrand: WhereIsMySpoon nay, 32768 (i.e. 2^16 / 2), but add a check to make sure you don't go out of bounds
[14:13:02] burgestrand: WhereIsMySpoon i.e. if it's above 32768 then set it to 32768, and vice versa for negative
[14:13:42] Rapture: has joined #ruby
[14:13:52] WhereIsMySpoon: im confused. so I need to do el = (el*32768).to_i; then do that check?
[14:13:53] burgestrand: Oh, sorry, 32767 is upper limit, not 32768 :)
[14:13:59] WhereIsMySpoon: thats what i thoguht :P
[14:14:10] burgestrand: Indeed, do it first and then constraint the result just to be sure
[14:14:47] am55: has joined #ruby
[14:15:31] WhereIsMySpoon: i think that worked
[14:15:42] netherwolfe: has joined #ruby
[14:15:58] WhereIsMySpoon: at least i have a 2d array of integers
[14:16:05] WhereIsMySpoon: ah now to pack it
[14:16:20] burgestrand: WhereIsMySpoon aye indeed
[14:16:47] burgestrand: WhereIsMySpoon if you still have an array like so: [[…], […], […]] you'll need to pack each one and then concatenate
[14:16:58] burgestrand: That should be all
[14:17:01] WhereIsMySpoon: b = b.map! { |arr| arr = arr.pack("s<256")}
[14:17:01] burgestrand: You have the raw data for your file
[14:17:26] WhereIsMySpoon: i didnt need to do b = but whatever :P
[14:17:53] burgestrand: Either save it, or if you're using the GCS API then you can wrap it in a stringIO right away: audio = speech.audio StringIO.new(audio_data), encoding: :linear16, sample_rate: 44100, language: "?"
[14:18:49] burgestrand: WhereIsMySpoon oh, keep in mind that the result of map! is now just an array of strings, but you can create a single string from them easily with `output_data = output_data.join`
[14:22:08] WhereIsMySpoon: i wrote it to a file after joining and it has a load of newlines
[14:22:33] burgestrand: It's not impossible that the audio actually converts to a newline character
[14:22:47] burgestrand: … although it probably not be regular :)
[14:23:14] WhereIsMySpoon: \x01A\x01d\x01^\x01_\
[14:23:17] WhereIsMySpoon: does this look legit?
[14:23:20] WhereIsMySpoon: whats all the ^ and _
[14:23:38] WhereIsMySpoon: x8D\xFE(\xFF\xB5\
[14:23:43] llua: has joined #ruby
[14:24:28] burgestrand: Yeah, the data when printed in Ruby is likely to look as such
[14:24:42] burgestrand: Actual data from my mic: \xC8\xFC\r\xFD\x91
[14:24:52] WhereIsMySpoon: i can understand the hex
[14:24:56] WhereIsMySpoon: just not the weird ^ _ and (
[14:25:00] WhereIsMySpoon: “ is there sometimes
[14:25:02] burgestrand: Yeah, well, ruby tries its best to print the characters
[14:25:09] Terens: has joined #ruby
[14:25:30] burgestrand: (if you inspect the data, that is)
[14:25:40] burgestrand: However, your file shouldn't actually have the \x everywhere
[14:26:17] WhereIsMySpoon: it has 0000 001c 6674 etc
[14:26:19] burgestrand: So yeah, actual data from my end too: -\"\x1E\xA9,\xC11\x01$W!
[14:26:50] SteenJobs: has joined #ruby
[14:27:28] imode: has joined #ruby
[14:28:14] catphish: has left #ruby: ("Leaving")
[14:29:12] ramfjord: has joined #ruby
[14:29:22] roshanavand: has joined #ruby
[14:31:22] roshanavand: has joined #ruby
[14:35:13] kn-928: has joined #ruby
[14:35:47] oetjenj: has joined #ruby
[14:38:17] kn-928_: has joined #ruby
[14:38:51] nachoman: has joined #ruby
[14:38:55] burgestrand: WhereIsMySpoon you managed to get it to work yet? :)
[14:39:02] WhereIsMySpoon: fighting google cloud
[14:39:13] burgestrand: Ah yeah… the credentials stuff?
[14:39:26] WhereIsMySpoon: i had it working before im just trying to remember the variable names to pass in :P
[14:41:34] WhereIsMySpoon: i think i need to find a way to record more than just this non existant data
[14:41:51] WhereIsMySpoon: because doing the EasyAudio::Stream.new(in_chans: 1) { |buffer| a = buffer.samples; :paContinue } doesnt gather much
[14:42:02] tomphp: has joined #ruby
[14:42:31] burgestrand: WhereIsMySpoon I thought you were appending to a, not assigning a?
[14:42:40] burgestrand: WhereIsMySpoon i.e. a.push(buffer.samples)?
[14:42:53] WhereIsMySpoon: let me get what ive done in a gist
[14:44:39] cschneid: has joined #ruby
[14:45:30] nachoman: has joined #ruby
[14:46:07] WhereIsMySpoon: Burgestrand: https://gist.github.com/Jarob22/0c5144c6a2de912388db34aa4e31fcf0
[14:46:32] WhereIsMySpoon: i think i did something weird with the array last time to get such a huge one, this time its a small 1d array
[14:47:43] burgestrand: WhereIsMySpoon the code you have there should be an array of arrays, i.e. [[…], […], […]], but then your map treats it as an array of floats
[14:47:55] WhereIsMySpoon: it is a 1d array
[14:48:13] burgestrand: WhereIsMySpoon you also never start the stream; not sure if that's needed to be frank though :)
[14:49:08] WhereIsMySpoon: Burgestrand: ive updated it
[14:49:11] WhereIsMySpoon: with outputs too
[14:49:37] oleo: has joined #ruby
[14:50:34] burgestrand: WhereIsMySpoon if I run your code it throws an error in the map, so something sounds off
[14:51:26] WhereIsMySpoon: this time its a 2d array
[14:51:27] rikkipitt: has joined #ruby
[14:52:00] duckpuppy: has joined #ruby
[14:52:20] tomphp: has joined #ruby
[14:52:59] conta: has joined #ruby
[14:54:37] conta: has joined #ruby
[14:58:06] memo1: has joined #ruby
[14:59:16] roshanavand: has joined #ruby
[15:01:57] milardovich: has joined #ruby
[15:02:19] WhereIsMySpoon: Burgestrand: https://gist.github.com/Jarob22/0c5144c6a2de912388db34aa4e31fcf0
[15:02:21] sldetracking: has joined #ruby
[15:02:34] tomphp: has joined #ruby
[15:02:40] WhereIsMySpoon: this gives me an empty array from the recognize, which is probably correct since i probably didnt record anything
[15:02:47] burgestrand: WhereIsMySpoon 32767 should be 32768
[15:03:01] WhereIsMySpoon: i thought you said upper was 32767
[15:03:11] burgestrand: WhereIsMySpoon yeah, but lower is -32768
[15:03:40] burgestrand: WhereIsMySpoon probably no biggie, but it shifts the amplitude (?) of the recording
[15:03:50] qba73: has joined #ruby
[15:03:51] WhereIsMySpoon: right, so how do i record more
[15:03:54] karapetyan: has joined #ruby
[15:03:59] Puffball: has joined #ruby
[15:04:13] burgestrand: WhereIsMySpoon don't start and then close right away, put a sleep in there for a few seconds perhaps?
[15:04:24] WhereIsMySpoon: start doesnt block
[15:04:32] burgestrand: Which is exactly the problem :)
[15:04:34] WhereIsMySpoon: and im copy-pasting these commands
[15:05:03] burgestrand: If you start and then close you'll only be recording inbetween, which means for a miniscule amount of time
[15:05:15] WhereIsMySpoon: so if i just run stream.start, speak to my mic, then close, i should get something?
[15:05:25] burgestrand: WhereIsMySpoon so I'd suggest something akin to stream.start; sleep 5; stream.close
[15:05:49] burgestrand: WhereIsMySpoon and then you have five seconds to speak to your computer, I don't know about you but I got some weird looks here in the office
[15:06:06] WhereIsMySpoon: im on a hack day
[15:08:30] WhereIsMySpoon: Burgestrand: irb(main):013:0> a.map { |arr| arr.map { |el| if (el < -32768) { el = -32768} elsif (el > 32767) { el = 32767} } }
[15:08:32] WhereIsMySpoon: is this correct?
[15:09:03] burgestrand: WhereIsMySpoon yup, should be alright!
[15:09:18] burgestrand: WhereIsMySpoon oh, keep in mind, your assignment `el = ` does nothing, `map` only cares about the return value of the block
[15:09:35] WhereIsMySpoon: so i just need -32768 for that
[15:09:38] WhereIsMySpoon: and 32767 for the other
[15:09:53] WhereIsMySpoon: a.map { |arr| arr.map { |el| if (el < -32768) { -32768} elsif (el > 32767) { 32767} } }
[15:09:55] burgestrand: aye, and then you need to branch for if it's neither of those (i.e. return el)
[15:10:12] rwb: has joined #ruby
[15:10:27] burgestrand: otherwise you'll return nil when the value is already OK :)
[15:10:40] c_nick: has joined #ruby
[15:10:53] jrafanie: has joined #ruby
[15:11:25] WhereIsMySpoon: something is wrong in this
[15:11:26] WhereIsMySpoon: b.map { |arr| arr.map { |el| if (el < -32768) { -32768} elsif (el > 32767) { 32767} else {el} } }
[15:11:34] WhereIsMySpoon: i copied a into b just in case i fucked it up :P
[15:11:58] tomphp: has joined #ruby
[15:12:12] WhereIsMySpoon: irb seems to think im still inside one level of block
[15:12:21] burgestrand: WhereIsMySpoon yeah, well, ruby does not do curly braces for if-statements
[15:12:38] burgestrand: WhereIsMySpoon (and they end with… well, `end` ;))
[15:12:47] jobewan: has joined #ruby
[15:13:53] pastorinni: has joined #ruby
[15:14:08] IshMael_: has joined #ruby
[15:14:44] rabajaj: has joined #ruby
[15:15:53] rahul_bajaj: has joined #ruby
[15:16:00] c_nick: The user interface for my web app is done using Slim in which i am creating a row (td) and dumping the data from a config file in it. Now I want to color the content dynamically
[15:16:27] burgestrand: c_nick could you elaborate on `dynamically`?
[15:16:45] rikkipitt: has joined #ruby
[15:17:24] c_nick: lets say i have a config file - data.yaml which has contents text="This is a sample text" and in my data.slim i am doing td = "#{@yaml.text}"
[15:18:43] WhereIsMySpoon: Burgestrand: :D:D
[15:18:49] burgestrand: WhereIsMySpoon nice, well done!
[15:18:54] WhereIsMySpoon: no, well done you :D
[15:19:08] burgestrand: WhereIsMySpoon here's my code for the same thing: https://gist.github.com/Burgestrand/b2310cb4ca05455acdbbe8be8598bb8f
[15:19:17] burgestrand: WhereIsMySpoon didn't want to post it until you got it working yourself :)
[15:20:08] c_nick: Burgestrand, Now in my yaml file i want to do something like text = "sample data" <but hey! this should be in red> something like that
[15:20:16] WhereIsMySpoon: Burgestrand: whats this frame size?
[15:20:40] burgestrand: WhereIsMySpoon I believe it's how many samples portaudio buffers up before calling the callback
[15:21:03] elomatreb: c_nick: You mean syntax highlighting?
[15:21:17] burgestrand: WhereIsMySpoon the frame size tells you how long the buffer.samples array is
[15:21:46] burgestrand: WhereIsMySpoon default value is 256, but I used it in the pack-format so I figured I'd specify it explicitly :)
[15:21:47] c_nick: elomatreb, yeah a protocol .. so that in user.slim i can understand and color it while in configuration file i define it
[15:22:09] WhereIsMySpoon: cheers man, you’re the best
[15:22:23] burgestrand: WhereIsMySpoon it was fun!
[15:22:53] elomatreb: c_nick: It sounds like you want a syntax highlighter, possibly with your own color theme. There are quite a few options, both server-side and client-side
[15:23:32] c_nick: server side for me .. i want to communicate from yaml to my web app to color the text
[15:23:39] WhereIsMySpoon: Burgestrand: definitely :D
[15:24:02] jeffreylevesque: has joined #ruby
[15:24:59] headius: has left #ruby: ()
[15:25:45] rwb: has joined #ruby
[15:26:15] dminuoso: 16:12 Burgestrand | WhereIsMySpoon yeah, well, ruby does not do curly braces for if-statements
[15:26:21] dminuoso: Haha. I could have sworn it did.
[15:26:26] c_nick: elomatreb, i guess this will work for me text {#formatting option}
[15:26:40] dminuoso: But it's kind of hard to remember in which special cases ruby requires {} and where it disallows them.
[15:26:59] c_nick: and in my web server i will try to search if there is any {} and dump the contents in a span style
[15:27:05] burgestrand: >> if_statement = -> (bool, &block) { block.call if bool }
[15:27:20] burgestrand: Problem solved! dminuoso
[15:27:23] tomphp: has joined #ruby
[15:27:32] elomatreb: How would you do the else though
[15:27:37] llua: has joined #ruby
[15:27:55] c_nick: dminuoso, its a string so i will do string manipulation so no issues in ruby
[15:28:06] burgestrand: if_statement(false) { puts "No!" } || begin puts "Why?" end
[15:28:40] dminuoso: elomatreb: -> (if_, then_, else_) { return then_ if if_; return else_ }.curry
[15:28:49] elomatreb: You could monkey patch the returned object to have a .else method (and other terrible ideas)
[15:29:18] elomatreb: Truly poetic code
[15:29:37] c_nick: ACTION off to code
[15:31:03] alfiemax: has joined #ruby
[15:31:52] Terens: has joined #ruby
[15:32:31] alfiemax: has joined #ruby
[15:33:24] lele: has joined #ruby
[15:33:49] alfiemax: has joined #ruby
[15:34:06] mikecmpb_: has joined #ruby
[15:34:49] Hanmac: has joined #ruby
[15:35:22] ycyclist: has joined #ruby
[15:35:42] ycyclist: Did there used to be a splice method in strings or arrays?
[15:36:51] burgestrand: There is an equivalent though
[15:37:00] elomatreb: What do you expect it to do?
[15:37:18] burgestrand: But it requires mutation, I'm quite sure
[15:37:23] WhereIsMySpoon: Burgestrand: is there a bit shifting equivalent of el = (el * 32768).to_i
[15:37:28] WhereIsMySpoon: just out of curiosity
[15:37:31] burgestrand: >> string = "Hello"; string[2, 0] = " spliced! "; p string
[15:38:32] burgestrand: WhereIsMySpoon I don't think so, but I can't really say with an acceptable degree of confidence
[15:42:17] DTZUZO: has joined #ruby
[15:42:45] schneider: has joined #ruby
[15:43:42] reber: has joined #ruby
[15:43:48] riotjoe: has joined #ruby
[15:44:57] tomphp: has joined #ruby
[15:45:22] leitz: has joined #ruby
[15:47:01] desperek: has joined #ruby
[15:47:05] leitz: The other day someone said Ruby wasn't under a dictatorship anymore. Did I miss the memo?
[15:48:19] qba73: has joined #ruby
[15:48:46] alfiemax: has joined #ruby
[15:49:34] karapetyan: has joined #ruby
[15:53:08] duckpuppy: has joined #ruby
[15:54:45] Strepsils: has joined #ruby
[15:56:16] riotjones: has joined #ruby
[15:57:10] WhereIsMySpoon: Burgestrand: I guess the next thing to do now would be instead of stream.start and stream.stop, to just have it listening all the time and have it clear and analyze the output whenever the amplitude is above a certain number
[15:57:20] WhereIsMySpoon: Burgestrand: those numbers from -1 to 1 that I get iniitally, what are those again
[15:57:33] burgestrand: WhereIsMySpoon I _believe_ that's amplitude
[15:57:35] tomphp: has joined #ruby
[15:57:49] c_nick: has joined #ruby
[15:57:53] burgestrand: WhereIsMySpoon i.e. you can graph it over time and you'd get the waveform
[15:58:09] burgestrand: WhereIsMySpoon which is why you need to use an FFT to get the frequency
[15:58:15] c_nick: hi again , name {color:red} how to extract just color:red from this text
[15:58:15] burgestrand: s/frequency/frequencies
[15:58:40] WhereIsMySpoon: Burgestrand: I see
[15:58:46] c_nick: \{\.*\} still gives the \{ \}
[15:59:02] WhereIsMySpoon: Burgestrand: and the el * 32768 .to_i and then bounding it is that fft?
[15:59:08] burgestrand: WhereIsMySpoon no :)
[15:59:21] eckhardt_: has joined #ruby
[15:59:22] deathwishdave: has joined #ruby
[15:59:31] burgestrand: WhereIsMySpoon that's converting float PCM data into int16 PCM data
[16:00:01] burgestrand: WhereIsMySpoon you're aware of that sound is essentially a bunch of different sine waves played on top of each other?
[16:00:34] roshanavand: has joined #ruby
[16:00:35] burgestrand: WhereIsMySpoon FFT is a mathy thing to extract the individual sine waves from the combined one
[16:01:05] WhereIsMySpoon: so if i have the amplitude
[16:01:07] burgestrand: (or, well, FT => fourier transform, the extra F is because it's FAST!)
[16:01:12] WhereIsMySpoon: im reading that dB = 20 * log10(amplitude)
[16:01:12] cagomez: has joined #ruby
[16:01:51] llua: has joined #ruby
[16:01:53] burgestrand: WhereIsMySpoon unfortunately I can't help you in figuring out the amplitude from the raw data, that's a little bit outside of what I've done before plus I'm leaving in like 3 minutes :)
[16:02:04] WhereIsMySpoon: ok man, you’ve helped enough anyway
[16:04:19] jeffreylevesque_: has joined #ruby
[16:04:37] leitz: c_nick, I'm not a great rubyist, but I'd get the index of the colon and the index of the closing brace, and then: mystring[colon + 1 .. closing_brace -1 ]
[16:04:39] chouhoulis: has joined #ruby
[16:05:03] leitz: There are probably better ways, though. That would expand if you had other needs.
[16:05:29] c_nick: leitz, yes thats a good one .. i am somehow hell bent on regex .. its like drugs
[16:05:34] c_nick: cooked up something like data.scan(/\{(.*)\}/).flatten.first
[16:06:07] leitz: In a python book I read "First you start with a problem. You try to solve it with a regex. Now you have two probelms." :)
[16:06:16] c_nick: as scan gives u an array of all the groups in arrays and flatten will knock off the first array and first will get the value within
[16:06:42] c_nick: leitz, but its super cool
[16:06:48] c_nick: unless u reach level 2
[16:07:30] mikecmpbll: has joined #ruby
[16:07:59] llua: has joined #ruby
[16:08:29] rippa: has joined #ruby
[16:09:02] c_nick: leitz, /\{(.*)\}/.match(data)[1] seems better option
[16:09:05] tolerablyjake: has joined #ruby
[16:09:11] c_nick: no need of the beef
[16:10:40] WhereIsMySpoon: can I ask, what does array.pack(“s<256”) actually -mean-? I can see that s< means 16 bit little endian, but what does the 256 do
[16:10:56] leitz: I have a limited number of brain cells and keep things simple. :)
[16:14:09] synthroid: has joined #ruby
[16:16:59] Zaab1t: has joined #ruby
[16:17:34] jcarl43: has joined #ruby
[16:17:59] c_nick: thanks leitz :-)
[16:18:02] c_nick: has left #ruby: ("Ex-Chat")
[16:20:06] guacamole: has joined #ruby
[16:21:44] roshanavand1: has joined #ruby
[16:21:55] oz: has joined #ruby
[16:22:54] jrm2: has joined #ruby
[16:25:52] alfiemax: has joined #ruby
[16:25:55] ltt: has joined #ruby
[16:26:26] psychicist__: has joined #ruby
[16:28:30] guacamole: has joined #ruby
[16:30:36] ltt: has joined #ruby
[16:31:28] marr: has joined #ruby
[16:31:45] DLSteve: has joined #ruby
[16:31:50] tomphp: has joined #ruby
[16:34:14] willmichael: has joined #ruby
[16:34:54] eckhardt_: has joined #ruby
[16:35:58] tomphp: has joined #ruby
[16:36:00] Ryzokuken: has joined #ruby
[16:38:57] schneider: has joined #ruby
[16:40:43] qba73: has joined #ruby
[16:41:09] robscomputer: has joined #ruby
[16:41:34] alfiemax: has joined #ruby
[16:43:53] darkhanb: has joined #ruby
[16:44:15] mgraf: has joined #ruby
[16:45:29] netherwolfe: has joined #ruby
[16:46:33] netherwolfe: has joined #ruby
[16:48:23] karapetyan: has joined #ruby
[16:49:20] jeffreylevesque: has joined #ruby
[16:50:09] milardovich: has joined #ruby
[16:53:01] alex``: has joined #ruby
[16:55:16] duckpuppy: has joined #ruby
[16:56:25] leitz: The other day someone said Ruby wasn't under a dictatorship anymore. Did I miss the memo?
[16:56:42] leitz: More curious than anything.
[16:57:21] orbyt_: has joined #ruby
[16:57:52] eckhardt_: has joined #ruby
[17:00:32] pilne: has joined #ruby
[17:01:11] mtkd: has joined #ruby
[17:01:51] guacamole: has joined #ruby
[17:01:51] guacamole: has joined #ruby
[17:04:18] elomatreb: As opposed to all those other programming languages, where everything is decided by an elected representative body?
[17:04:43] raynold: has joined #ruby
[17:07:05] eckhardt_: has joined #ruby
[17:07:36] leitz: elomatreb, not sure on that. I assumed Matz was still "in charge", but the person's comment seemed to suggest otherwise
[17:12:05] headius: has joined #ruby
[17:12:28] qba73: has joined #ruby
[17:18:07] milardovich: has joined #ruby
[17:18:09] nowhereman_: has joined #ruby
[17:18:32] havenwood: On nightly: Integer('nope', exception: false) #=> nil
[17:19:06] ramfjord: has joined #ruby
[17:19:43] havenwood: leitz: Matz has said he'll remain the benevolent dictator as long as he is in his corporeal form.
[17:20:47] leitz: havenwood, thanks! From down here (in the Ruby world) things seem to be going okay. Wasn't sure if it would change.
[17:25:30] \void: has joined #ruby
[17:32:54] alfiemax: has joined #ruby
[17:35:55] llua: has joined #ruby
[17:37:26] phaul: does anybody use vim-bundler here? Does automatic setting of tags work for you?
[17:46:01] ule: https://www.serverless-ruby.org/
[17:46:08] ule: phaul: I use ctags
[17:47:00] ule: phaul: map <Leader>ct :<C-U>!=/usr/local/bin/ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)<CR>
[17:47:12] ule: when I type: ,ct
[17:47:18] ule: it updates all ctags
[17:49:05] phaul: ule: i guess I could do something like that, although I liked the idea of having a separate tags per gem and load what's needed in the project
[17:51:08] chouhoul_: has joined #ruby
[17:52:40] phaul: so vim-bundler makes the promise of populating your tags vim option based on your bundled gems. That way you only generate tags when you install a gem. bit like rdoc/ri sits in $HOME/.gems
[17:53:23] phaul: altough it doesn't work for me :)
[17:53:52] clemens3: has joined #ruby
[17:54:04] ule: Yeah, in my case there I'm creating ctags based on all installed gems. "bundle --list"
[17:54:43] duckpuppy: has joined #ruby
[17:57:34] karapetyan: has joined #ruby
[17:58:51] oncall-pokemon: has joined #ruby
[18:01:43] am55: has joined #ruby
[18:03:27] robscomputer: has joined #ruby
[18:03:53] apeiros_: has joined #ruby
[18:04:56] eckhardt_: has joined #ruby
[18:05:24] jottr: has joined #ruby
[18:09:23] chouhoulis: has joined #ruby
[18:12:40] qba73: has joined #ruby
[18:13:09] Lytol: has joined #ruby
[18:14:33] alfiemax: has joined #ruby
[18:19:05] jottr: has joined #ruby
[18:22:43] robscomputer: has joined #ruby
[18:25:09] mtkd: has joined #ruby
[18:25:55] Terens: has joined #ruby
[18:29:10] graft: what is the deal with URI.encode? are we supposed to use it? not use it? why can't we encode brackets? must I take up an 'addressable' dependency?
[18:29:13] graft: et cetera
[18:30:47] kapil___: has joined #ruby
[18:34:15] jottr: has joined #ruby
[18:34:43] jamesaxl: has joined #ruby
[18:35:40] mgraf_: has joined #ruby
[18:36:22] apeiros_: graft: hm? why do you think you're supposed to not use it?
[18:36:40] apeiros_: oh, I should not answer when going afk soon :(
[18:36:51] apeiros: ACTION afk for a bit
[18:37:25] leotaku: has joined #ruby
[18:41:25] n008f4g_: has joined #ruby
[18:43:30] milardovich: has joined #ruby
[18:44:30] im0nde: has joined #ruby
[18:45:21] milardovich: has joined #ruby
[18:46:19] mtkd: has joined #ruby
[18:47:12] IshMael_: has joined #ruby
[18:47:16] jottr: has joined #ruby
[18:52:09] riotjoe: has joined #ruby
[18:53:28] duckpuppy: has joined #ruby
[18:53:40] mgraf: has joined #ruby
[18:54:19] leotaku: has joined #ruby
[18:56:19] jottr: has joined #ruby
[18:58:59] fiachetti: has joined #ruby
[19:02:43] jottr: has joined #ruby
[19:08:38] bmurt: has joined #ruby
[19:10:39] milardovich: has joined #ruby
[19:10:45] jottr: has joined #ruby
[19:13:34] ghormoon: has joined #ruby
[19:14:28] karapetyan: has joined #ruby
[19:14:34] ltt: has joined #ruby
[19:16:47] cagomez: has joined #ruby
[19:17:18] leotaku: has joined #ruby
[19:19:19] guacamole: has joined #ruby
[19:19:19] guacamole: has joined #ruby
[19:21:00] ledestin: has joined #ruby
[19:21:19] sameerynho: has joined #ruby
[19:21:55] karapetyan: has joined #ruby
[19:23:29] chouhoulis: has joined #ruby
[19:25:36] jottr: has joined #ruby
[19:27:12] tAn: has joined #ruby
[19:28:28] Cavallari: has joined #ruby
[19:30:55] rwb: has joined #ruby
[19:33:58] jottr: has joined #ruby
[19:34:32] John_Ivan: has joined #ruby
[19:34:33] John_Ivan: has joined #ruby
[19:38:25] jackjackdripper: has joined #ruby
[19:39:09] workmad3: has joined #ruby
[19:41:58] tvw: has joined #ruby
[19:43:59] claudiuinberlin: has joined #ruby
[19:44:22] jottr: has joined #ruby
[19:46:11] weaksauce: has joined #ruby
[19:47:05] coderphive: has joined #ruby
[19:48:04] SeepingN: has joined #ruby
[19:49:05] karapetyan: has joined #ruby
[19:50:29] nadir: has joined #ruby
[19:51:29] shinnya: has joined #ruby
[19:52:33] karapetyan: has joined #ruby
[19:52:57] jottr: has joined #ruby
[19:53:08] eckhardt_: has joined #ruby
[19:54:24] pastorinni: has joined #ruby
[19:55:30] duckpuppy: has joined #ruby
[19:59:53] jottr: has joined #ruby
[20:01:13] mikecmpbll: has joined #ruby
[20:02:02] cagomez: has joined #ruby
[20:04:04] anisha: has joined #ruby
[20:05:22] nowhere_man: has joined #ruby
[20:08:10] BTRE: has joined #ruby
[20:10:22] tolerablyjake: has joined #ruby
[20:14:26] jottr: has joined #ruby
[20:17:21] phaul: has joined #ruby
[20:18:42] jamiejackson: has joined #ruby
[20:20:22] jenrzzz: has joined #ruby
[20:20:23] jenrzzz: has joined #ruby
[20:20:37] deathwishdave: has joined #ruby
[20:20:50] cagomez: has joined #ruby
[20:23:33] jottr: has joined #ruby
[20:24:19] leotaku: has joined #ruby
[20:24:51] nowhereman_: has joined #ruby
[20:26:29] kfpratt: has joined #ruby
[20:29:41] perzival: has joined #ruby
[20:29:59] jottr: has joined #ruby
[20:36:01] chouhoulis: has joined #ruby
[20:36:45] RougeR: has joined #ruby
[20:37:00] sspreitz: has joined #ruby
[20:43:31] jottr: has joined #ruby
[20:43:46] tAn: has joined #ruby
[20:46:39] cdg: has joined #ruby
[20:48:48] cdg: has joined #ruby
[20:51:06] mtkd: has joined #ruby
[20:51:49] robscomputer: has joined #ruby
[20:55:49] jamiejackson25: has joined #ruby
[20:56:25] orbyt_: has joined #ruby
[20:56:59] jottr: has joined #ruby
[20:57:20] duckpuppy: has joined #ruby
[21:03:19] jackjackdripper: has joined #ruby
[21:04:12] jottr: has joined #ruby
[21:04:31] pastorinni: has joined #ruby
[21:05:48] jamesaxl: has joined #ruby
[21:08:04] Terens: has joined #ruby
[21:09:58] workmad3: has joined #ruby
[21:10:30] Quentinius: has joined #ruby
[21:11:54] roshanavand: has joined #ruby
[21:13:21] Azure: has joined #ruby
[21:13:36] jottr: has joined #ruby
[21:15:19] Azure|dc: has joined #ruby
[21:16:49] jenrzzz: has joined #ruby
[21:18:22] memo1: has joined #ruby
[21:25:34] tAn: has joined #ruby
[21:25:34] guacamole: has joined #ruby
[21:25:34] guacamole: has joined #ruby
[21:27:41] cagomez: has joined #ruby
[21:29:09] jottr: has joined #ruby
[21:30:14] cagomez: has joined #ruby
[21:31:21] cagomez: has joined #ruby
[21:34:20] jamiejackson2577: has joined #ruby
[21:36:07] jottr: has joined #ruby
[21:36:40] jenrzzz: has joined #ruby
[21:36:40] jenrzzz: has joined #ruby
[21:38:08] karapetyan: has joined #ruby
[21:38:57] memo1: has joined #ruby
[21:42:43] le0taku: has joined #ruby
[21:46:18] kloeri: has joined #ruby
[21:47:48] cagomez: has joined #ruby
[21:48:55] im0nde_: has joined #ruby
[21:49:12] jottr: has joined #ruby
[21:52:37] chouhoulis: has joined #ruby
[21:53:38] jackjackdripper: has joined #ruby
[21:54:59] BTRE: has joined #ruby
[21:55:43] allcentury: has joined #ruby
[21:55:44] duckpuppy: has joined #ruby
[21:55:48] jottr: has joined #ruby
[21:57:05] jamiejackson2577: has joined #ruby
[21:59:01] ramfjord: has joined #ruby
[21:59:53] jinie: has joined #ruby
[22:00:51] marr: has joined #ruby
[22:01:40] cagomez: has joined #ruby
[22:02:22] jinie: has joined #ruby
[22:02:22] cagomez: has joined #ruby
[22:05:12] arand: has joined #ruby
[22:06:43] cschneid: has joined #ruby
[22:08:25] robscomputer: has joined #ruby
[22:08:54] jenrzzz: has joined #ruby
[22:09:07] leah2: has joined #ruby
[22:10:48] jottr: has joined #ruby
[22:14:30] Terens: has joined #ruby
[22:16:34] arand: Being quite new to ruby, I have been using exclusive ranges x = y[a...-b] in order to extract "middle parts" of things, but this only works if b > 0, is it common to use inclusive syntax x = y[a..-(b + 1)] to avoid this edge case or is there a neater way?
[22:16:37] cagomez: has joined #ruby
[22:18:37] weaksauce: arand perhaps doing it that way is not quite the ruby way unless you have a really specific need
[22:19:03] weaksauce: what are you doing that requires extracting the middle... maybe someone knows of a better method to do what you want?
[22:20:59] apeiros: arand: huh? exclusive ranges work fine with negative end offset
[22:21:10] apeiros: >> [1,2,3][1...-1]
[22:21:16] arand: In a communications protocol I have a frame with a header, data field and a trailer, and I want to extract the data field.
[22:21:20] apeiros: ACTION pokes ruby[bot]
[22:21:38] apeiros: >> [1,2,3][1..-1]
[22:21:45] apeiros: # => [2, 3]
[22:21:59] arand: >> [1,2,3][1...-0]
[22:22:01] jottr: has joined #ruby
[22:22:10] apeiros: arand: misunderstanding on your part
[22:22:38] apeiros: if you read the docs, it tells you that if N is negative, it's interpreted as length+N
[22:22:44] apeiros: and hence -1 is the last offset
[22:22:51] apeiros: (since length-1 is the last offset)
[22:23:02] bmurt: has joined #ruby
[22:23:17] havenwood: -0.negative? #=> false
[22:23:42] arand: Yes, and if the offset is variable, exclusive syntax cannot be used if the variable could conceivably be 0.
[22:24:11] eam: >> -0 == 0
[22:24:27] eam: o is the thingy not running?
[22:24:33] apeiros: arand: sounds like "I can't use this if I have a logic error in my code", and why, yes of course.
[22:24:35] havenwood: eam: I'm trying to fill in. ;-P
[22:24:38] eam: haha ty
[22:24:48] eam: integers shouldn't have a negative zero, but floats should
[22:24:56] eam: ints don't have a way to store it
[22:24:57] havenwood: ACTION pokes ruby[bot] 
[22:25:22] eam: which is why integers can store one more negative number than positive (not counting zero)
[22:25:36] karapetyan: has joined #ruby
[22:25:49] ruby[bot]: has joined #ruby
[22:25:49] ChanServ: +o ruby[bot]
[22:25:56] apeiros: eam: floats have
[22:26:05] apeiros: >> -0.0.equal?(0.0)
[22:26:07] eam: however ... in Ruby it looks like maybe -0.0 is equal to 0.0
[22:26:07] arand: apeiros: My question is, is there a prettier way to write x = y[a..-(b + 1)] without the "+ 1"?
[22:26:10] ruby[bot]: apeiros: # => false (https://eval.in/972824)
[22:26:11] eam: which seems wrong to me
[22:26:15] havenwood: -0.0 #=> -0.0
[22:26:17] jrm: has joined #ruby
[22:26:21] ruby[bot]: -b+b *!~Quaday@ppp-seco21parth2-46-193-170-22.wb.wifirst.net *!~Quaday@ppp-seco21parth2-46-193-170-22.wb.wifirst.net$#ruby-banned
[22:26:21] apeiros: eam: it is ==, it's not equal?
[22:26:48] eam: apeiros: aha!
[22:26:49] apeiros: eam: and the == is very much correct :)
[22:26:56] havenwood: 0.equal?(-0) #=> true
[22:26:57] havenwood: 0.0.equal?(-0.0) #=> false
[22:27:05] eam: and with equal? we do see that integer negative zero equals zero, but float negative zero does not
[22:27:08] eam: so all is well
[22:27:16] apeiros: havenwood: the bot works properly again. I restarted it.
[22:27:19] orbyt_: has joined #ruby
[22:27:20] zenspider: y.first(a+b).last(b)
[22:27:20] apeiros: whatever was jammed
[22:27:26] zenspider: which is just dumb
[22:27:37] zenspider: it sounds like you're making this more difficult than it needs to be
[22:28:00] deathwishdave: has joined #ruby
[22:28:37] apeiros: arand: no, I think not
[22:28:49] apeiros: arand: there may be a prettier way to write your overall problem
[22:29:25] zenspider: arand: is this a binary protocol?
[22:31:22] apeiros: arand: but for "prettier way for overall problem" I'd actually need more info :)
[22:31:33] arand: My source and target data are strings, representing a binary byte stream.
[22:31:57] zenspider: eam / havenwood : what's a nice hotel near your office?
[22:32:05] apeiros: also I use string[offset, length] way more often than string[offset..offset2], maybe that form would help you here too?
[22:32:24] zenspider: arand: is that a yes or a no?
[22:32:38] zenspider: it's a simple question... I thought
[22:32:38] apeiros: ACTION read that as a "yes"
[22:32:57] zenspider: arand: `ri String.unpack`
[22:33:04] havenwood: zenspider: The InterContinental on Howard isn't too far. Hrm, there are probably closer.
[22:33:28] jottr: has joined #ruby
[22:34:53] IshMael_: has joined #ruby
[22:35:04] IshMael_: has left #ruby: ()
[22:40:03] arand: zenspider: I think so, what would be a non-binary protocol?
[22:41:39] zenspider: SMTP, HTTP, telnet (mostly), ftp... umm... most of them?
[22:42:40] tAn: has joined #ruby
[22:43:42] memo1: has joined #ruby
[22:43:43] pddman: has joined #ruby
[22:45:04] arand: I'm doing stage/chunk processing of a data stream, so my target format is string as well, hence I don't think I want to unpack it?
[22:45:22] jottr: has joined #ruby
[22:45:29] eam: zenspider: I'm the wrong guy to ask, I think all of SF is a stinkhole :D
[22:46:00] pastorin_: has joined #ruby
[22:46:02] arand: For example: http://paste.ubuntu.com/p/VR35r7tGdM/
[22:47:29] sspreitz: has joined #ruby
[22:47:30] nowhere_man: has joined #ruby
[22:48:00] samort7: has joined #ruby
[22:48:37] apeiros: arand: seems like you indeed have the case I said. you have size, not offset, so you should use slice!(offset, length), not slice!(0...offset)
[22:49:21] apeiros: ah, though, second is the size of the suffix. could remove that instead of the middle.
[22:51:25] zenspider: also remove line 6 and the assignment on line 5. no value
[22:52:11] zenspider: I would also remove all slice! and other destructive/mutative methods
[22:52:40] duckpuppy: has joined #ruby
[22:52:58] arand: Other than documentation no, does excess copies like that add cost in ruby?
[22:53:24] zenspider: @data[0, @cadu_size][CCSDS_SYNC_MARKER_LEN, @reed_solomon_size]
[22:53:39] zenspider: tho, really: @data[CCSDS_SYNC_MARKER_LEN, @reed_solomon_size]
[22:54:09] zenspider: you're using ruby. you don't care about cost until you measure
[22:54:14] edwardly: has joined #ruby
[22:54:14] edwardly: has joined #ruby
[22:54:26] arand: I do want to mutate @data though.
[22:54:33] zenspider: I recommend you don't
[22:55:02] zenspider: you can choose to ignore that advice... that's fine.
[22:55:13] zenspider: I charge a LOT for my debugging services. ;)
[22:57:58] roshanavand: has joined #ruby
[22:58:01] arand: @data is the buffer for the yet-unproccessed data.
[23:00:00] zenspider: I'm not confused about what @data is.
[23:00:28] yokel: has joined #ruby
[23:03:25] weaksauce: another option is to use StringIO if you want a stream to do variable length reads from without having to do all that intermediate splicing.
[23:03:59] zenspider: weaksauce: StringIO on a stream? or StringScanner?
[23:04:16] zenspider: (I dunno... maybe you can use StringIO on a stream? no clue, but that could be cool)
[23:04:46] jottr: has joined #ruby
[23:04:57] weaksauce: depends on what @data is actually i suppose
[23:06:13] KeyJoo: has joined #ruby
[23:07:03] arand: For excess context, I'm interfacing as a new "protocol" in https://github.com/BallAerospace/COSMOS/tree/master/lib/cosmos/interfaces/protocols
[23:08:35] arand: I get my data through an external call to read_data(data) with a string input and string output (or :STOP/:DISCONNECT)
[23:10:17] alfiemax: has joined #ruby
[23:10:41] arand: This is for example how the same thing is done in the "length protocol": https://paste.ubuntu.com/p/PFtvcDTVrj/
[23:10:43] weaksauce: arand perhaps gist the entire code?
[23:12:16] marr: has joined #ruby
[23:13:10] pastorinni: has joined #ruby
[23:14:47] jottr: has joined #ruby
[23:16:00] iszak: has joined #ruby
[23:16:00] iszak: has joined #ruby
[23:17:58] nowhereman_: has joined #ruby
[23:19:46] schneider: has joined #ruby
[23:30:43] tAn: has joined #ruby
[23:31:39] alfiemax: has joined #ruby
[23:35:17] tolerablyjake: has joined #ruby
[23:37:39] arand: weaksauce: https://gist.github.com/ienorand/829be91d10aba7829482fcbc3f0dfa7f
[23:38:24] arand: I removed the second slice!, that was indeed pointless.
[23:40:51] rfoust: has joined #ruby
[23:41:53] zenspider: half your returns can go. you need not pass anything to super unless you're changing the args, still not sure why you're insisting on using ranges instead of lengths
[23:43:14] zenspider: and to be clear: there's a semantic difference between super() and super
[23:43:31] zenspider: super() or super(args...) vs super
[23:44:08] arand: >> [0,1,2,3,4,5,6,7][1, 1] != [0,1,2,3,4,5,6,7][1..-(1 + 1)]
[23:44:13] n0m4d1c: has joined #ruby
[23:44:19] ruby[bot]: arand: # => true (https://eval.in/972836)
[23:45:25] weaksauce: >> [0,1,2,3,4,5,6,7][1, 6]
[23:45:26] ruby[bot]: weaksauce: # => [1, 2, 3, 4, 5, 6] (https://eval.in/972837)
[23:46:13] zenspider: arand: you seem stuck on that. not sure why
[23:46:49] guacamole: has joined #ruby
[23:48:24] arand: I'm using ranges instead of lengths since that means I don't need to calculate the length.
[23:48:40] alfiemax: has joined #ruby
[23:49:18] zenspider: *sigh* you ARE calculating the length.
[23:49:42] zenspider: I think I'm done. I don't understand your pathology.
[23:52:14] Psybur: has joined #ruby
[23:53:35] n0m4d1c: has joined #ruby
[23:53:50] milardovich: has joined #ruby
[23:56:33] arand: I guess there's no point further explaining that then. I should definitely read up on 'super' since I have basically just cargo-culted its use from other similar protocols so far. I guess by removing returns you mean using just the naked variable, which I conceede is just a non-idiomatic-roby-beginner taste of mine.
[23:57:03] arand: s/roby/ruby/
[23:57:28] duckpuppy: has joined #ruby
[23:57:54] n0m4d1c: has joined #ruby