« Back to channel list

#ruby - 28 June 2017

« Back 1 day Forward 1 day »
[00:00:27] Cohedrin_: has joined #ruby
[00:01:07] Rodya_: has joined #ruby
[00:05:58] ledestin: has joined #ruby
[00:06:42] raspado: has joined #ruby
[00:07:17] dasher00: has joined #ruby
[00:08:12] tuelz: has joined #ruby
[00:08:31] brent__: has joined #ruby
[00:11:10] Cohedrin_: has joined #ruby
[00:19:20] charliesome: has joined #ruby
[00:20:18] jphase: has joined #ruby
[00:24:02] hahuang65: has joined #ruby
[00:24:18] Jameser: has joined #ruby
[00:28:26] patarr: has joined #ruby
[00:29:00] Patadas: has joined #ruby
[00:29:30] Patadas: has joined #ruby
[00:30:11] Patadas: has joined #ruby
[00:31:15] Patadas: has joined #ruby
[00:32:24] Patadas: has joined #ruby
[00:35:51] jenrzzz: has joined #ruby
[00:35:51] jenrzzz: has joined #ruby
[00:35:52] zacts: has joined #ruby
[00:37:24] mostlybadfly: has joined #ruby
[00:40:13] hopland: has joined #ruby
[00:40:39] Xiti: has joined #ruby
[00:41:16] hopland: Hey, all :) Trying to build ruby within a flatpak - but I've got some problems on the initial build
[00:42:04] hopland: How do I specify a costum dir/url to config.guess?
[00:43:04] mim1k: has joined #ruby
[00:44:41] Rodya_: has joined #ruby
[00:45:28] railswebdev: has joined #ruby
[00:45:33] justbleed: has joined #ruby
[00:47:04] graft: has joined #ruby
[00:48:14] cdg: has joined #ruby
[00:49:21] Guest2429: has left #ruby: ()
[00:52:09] SteenJobs: has joined #ruby
[00:56:11] Pepu: has joined #ruby
[01:00:08] Cohedrin_: has joined #ruby
[01:00:35] elsevero: has joined #ruby
[01:02:01] patarr: has joined #ruby
[01:05:33] t-recx: has joined #ruby
[01:07:43] Cohedrin_: has joined #ruby
[01:09:24] Dimik: has joined #ruby
[01:09:47] charliesome: has joined #ruby
[01:10:00] umaaji: has joined #ruby
[01:11:38] PresidentBiscuit: has joined #ruby
[01:13:07] cyphase: has joined #ruby
[01:18:00] Jameser: has joined #ruby
[01:20:58] railswebdev: has joined #ruby
[01:21:01] workmad3: has joined #ruby
[01:23:30] Cohedrin_: has joined #ruby
[01:27:31] Cohedrin_: has joined #ruby
[01:28:08] millerti: has joined #ruby
[01:32:37] uZiel: has joined #ruby
[01:34:22] Phanes: has joined #ruby
[01:35:28] Phanes: has joined #ruby
[01:36:14] r3vDev: has joined #ruby
[01:42:26] patarr: has joined #ruby
[01:42:40] cam27: has joined #ruby
[01:45:15] d^sh: has joined #ruby
[01:46:40] charliesome: has joined #ruby
[01:46:47] Cohedrin_: has joined #ruby
[01:53:18] im314ous: has joined #ruby
[01:53:47] gizmore|2: has joined #ruby
[01:55:32] uZiel: has joined #ruby
[01:57:40] railswebdev: has joined #ruby
[01:59:40] Tau: has joined #ruby
[02:01:09] jackjackdripper: has joined #ruby
[02:01:22] hahuang65: has joined #ruby
[02:02:01] __Yiota: has joined #ruby
[02:07:35] svetlana: has joined #ruby
[02:08:10] svetlana: has joined #ruby
[02:10:21] Patadas: has joined #ruby
[02:11:23] Patadas: has joined #ruby
[02:12:18] uZiel_: has joined #ruby
[02:13:41] nicesignal: has joined #ruby
[02:17:25] cdg: has joined #ruby
[02:19:57] hahuang65: has joined #ruby
[02:22:43] justbleed: has joined #ruby
[02:22:56] uZiel: has joined #ruby
[02:23:23] harfangk: has joined #ruby
[02:36:14] bogdanteleaga: has joined #ruby
[02:37:19] pawandubey: has joined #ruby
[02:38:03] D9: has joined #ruby
[02:38:09] biox: has joined #ruby
[02:38:30] gf3: has joined #ruby
[02:39:44] gsingh93: has joined #ruby
[02:40:09] dyyylan: has joined #ruby
[02:40:16] duracrisis: has joined #ruby
[02:41:05] tsul: has joined #ruby
[02:42:00] patr0clus: has joined #ruby
[02:42:56] chrisarcand: has joined #ruby
[02:43:30] z64: has joined #ruby
[02:43:38] mim1k: has joined #ruby
[02:43:42] bazzy: has joined #ruby
[02:44:22] railswebdev: has joined #ruby
[02:48:33] Silthias: has joined #ruby
[02:49:36] asdfasdf: has joined #ruby
[02:51:37] asdfasdf: Hello, I am having trouble with the Ruby net/https library. For some reason I get a SocketError from my code, seen here: https://pastebin.com/zccLMppV .
[02:51:38] ruby[bot]: asdfasdf: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/d18beb547630864bb709b71d148236a4
[02:51:38] ruby[bot]: asdfasdf: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
[02:53:55] mim1k: has joined #ruby
[03:01:27] elomatreb: asdfasdf: The net/http constructor wants a pure domain (no protocol) I think, try leaving the http:// part off
[03:01:28] havenwood: asdfasdf: If you just want the response it's less code to use OpenURI from the stdlib: require 'open-uri'; response = open 'http://www.wikipedia.org', &:read
[03:04:09] bed7: has joined #ruby
[03:05:17] asdfasdf: elmatreb, havenwood: I still get the same result
[03:06:01] havenwood: asdfasdf: You should get a redirect after elomatreb's fix or the response body with OpenURI.
[03:06:21] havenwood: asdfasdf: Double check you're running the suggested code?
[03:07:09] havenwood: asdfasdf: Try from your console:
[03:07:09] havenwood: ruby -ropen-uri -e "puts open 'http://www.wikipedia.org', &:read"
[03:07:31] asdfasdf: havenwood: Okay, so I get this now: https://gist.github.com/anonymous/c035b0de4834ce23b6eff3ff25c0a687
[03:09:32] havenwood: asdfasdf: That's odd. What Ruby version?
[03:09:34] havenwood: asdfasdf: Try?:
[03:09:35] havenwood: equire 'open-uri'; response = URI('http://www.wikipedia.org').read
[03:09:42] asdfasdf: havenwood: I also get this when I run the command: https://gist.github.com/anonymous/be69e4a39f195915211f832e8294b727
[03:10:21] havenwood: works on my machine ¯\_(ツ)_/¯
[03:10:28] havenwood: Okay, doesn't work pre 2.4
[03:10:41] havenwood: redirection
[03:11:06] asdfasdf: Should I install rvm?
[03:11:15] asdfasdf: Because I just used default ruby in my distros repo
[03:11:34] havenwood: I forgot it was in 2.4 that open-uri got redirection automagical support.
[03:11:39] havenwood: asdfasdf: What distor?
[03:12:00] havenwood: asdfasdf: Excuse me, I mean what distro?
[03:12:13] asdfasdf: havenwood: Ubuntu
[03:12:34] havenwood: Brightbox maintains up-to-date Ruby package for Ubuntu, including Ruby 2.4: https://www.brightbox.com/docs/ruby/ubuntu/
[03:13:18] asdfasdf: Okay, I'll try it thanks.
[03:13:26] havenwood: asdfasdf: Or if it's dev and you'd like more versions of Ruby, ruby-install + chruby is simple and effective: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
[03:13:45] havenwood: There's an Ubuntu walkthrough for Ruby 2.4 ^ on Ubuntu with ruby-install/chruby.
[03:14:34] havenwood: asdfasdf: You can handle the redirect yourself with net/http or open-uri but I think you're right to just bump to 2.4.1 if that's an option!
[03:16:00] havenwood: asdfasdf: There are also many high quality HTTP gems. Some wrap net/http, some wrap libcurl and some are pure Ruby.
[03:16:22] havenwood: asdfasdf: Here's one good option, http.rb: https://github.com/httprb/http#readme
[03:16:31] asdfasdf: I was trying to use Nokogiri
[03:16:36] havenwood: asdfasdf: For your immediate issue I think Ruby 2.4 and OpenURI is a nice solution.
[03:16:50] havenwood: asdfasdf: HTTP.rb + Nokogiri is great as well.
[03:18:49] havenwood: asdfasdf: Nokogiri::HTML HTTP.follow.get 'http://www.wikipedia.org'
[03:18:49] asdfasdf: May I ask how long you have been using Ruby for?
[03:19:13] asdfasdf: I think Nokogiri uses the Net/http library because I was getting the same errors
[03:19:30] havenwood: asdfasdf: Nokogiri is an XML/HTML parser.
[03:19:46] havenwood: You'd need the body result before it comes into play.
[03:19:59] FastJack: has joined #ruby
[03:20:21] havenwood: asdfasdf: About six years.
[03:20:24] havenwood: Almost six.
[03:21:54] havenwood: asdfasdf: Actually checking it'd be: Nokogiri::HTML HTTP.follow.get('http://www.wikipedia.org').to_s
[03:24:34] mydog2: has joined #ruby
[03:24:48] havenwood: asdfasdf: Confirmed working in Ruby 2.4: Nokogiri::HTML URI('http://www.wikipedia.org').read
[03:25:43] asdfasdf: havenwood: does chruby allow you to switch between ruby versions?
[03:25:51] havenwood: asdfasdf: yes
[03:26:13] asdfasdf: Why not use RVM?
[03:26:21] havenwood: asdfasdf: For example `chruby 2.4` or `chruby 2.3.4`.
[03:26:38] havenwood: asdfasdf: chruby is about a hundred lines of shell, then another fifty if you want to autoswitch with .ruby-version files
[03:26:55] havenwood: asdfasdf: RVM is tens of thousands of lines of shell and handles both installing, switching, and more
[03:27:12] roamingdog: has joined #ruby
[03:27:21] havenwood: asdfasdf: they're different categories
[03:27:42] mydog2: has joined #ruby
[03:27:52] havenwood: asdfasdf: if you want exotic system support or patches for very old Rubies or are just used to it you might prefer RVM
[03:28:22] havenwood: asdfasdf: chruby is quite simple and fast and just works
[03:28:27] havenwood: asdfasdf: i've got to run, happy coding!
[03:28:34] itsautomatisch: has joined #ruby
[03:28:47] railswebdev: has joined #ruby
[03:29:07] mistym: has joined #ruby
[03:29:34] montanonic: has joined #ruby
[03:29:37] asdfasdf: havenwood: Okay, thankls
[03:30:36] hahuang65: has joined #ruby
[03:32:44] gix: has joined #ruby
[03:33:31] hutch34: has joined #ruby
[03:35:14] asdfasdf: havenwood: Sorry, but I'm still getting the same error: https://gist.github.com/anonymous/86d939b6f92c19f790d3d35263591884
[03:38:52] asdfasdf: havenwood: nevermind, I got it
[03:39:49] jackjackdripper: has joined #ruby
[03:40:42] Coldblackice: has joined #ruby
[03:41:12] mydog2: has joined #ruby
[03:42:47] xzhao_: has joined #ruby
[03:45:23] astrobunny: has joined #ruby
[03:46:45] SteenJobs: has joined #ruby
[03:47:09] mydog2: has joined #ruby
[03:48:26] charliesome: has joined #ruby
[03:50:04] rohitpaulk: has joined #ruby
[03:55:40] BackEndCoder: has joined #ruby
[04:00:24] elsevero: has joined #ruby
[04:00:49] wimplash: has joined #ruby
[04:03:44] mydog2: has joined #ruby
[04:06:59] KeyJoo: has joined #ruby
[04:10:15] minimalism: has joined #ruby
[04:12:45] JustTheDoctor: has joined #ruby
[04:15:05] SteenJobs: has joined #ruby
[04:16:31] konsolebox: has joined #ruby
[04:23:56] govg: has joined #ruby
[04:29:17] nofxxxx: has joined #ruby
[04:30:01] jackjackdripper: has joined #ruby
[04:32:53] PorcoRex: has joined #ruby
[04:33:02] rgr: has joined #ruby
[04:36:34] cadillac__: has joined #ruby
[04:37:35] mim1k: has joined #ruby
[04:37:46] PatrikasZvaigzde: has joined #ruby
[04:44:54] cyphase: has joined #ruby
[04:47:02] pawandubey: has joined #ruby
[04:49:32] mahlon: has joined #ruby
[04:50:22] cdg_: has joined #ruby
[04:52:12] minimalism: has joined #ruby
[04:53:23] Trynemjoel: has joined #ruby
[04:54:28] wimplash: has joined #ruby
[04:55:04] r3vDev: has joined #ruby
[05:01:23] Ropeney: has joined #ruby
[05:03:03] enterprisey: has joined #ruby
[05:10:48] ringrong: has joined #ruby
[05:11:38] ringrong: has joined #ruby
[05:14:05] mydog2: has joined #ruby
[05:17:50] charliesome: has joined #ruby
[05:19:46] govg: has joined #ruby
[05:24:30] conta: has joined #ruby
[05:25:44] anisha: has joined #ruby
[05:27:05] apofis: has joined #ruby
[05:31:26] hahuang65: has joined #ruby
[05:32:32] Mortomes|Train: has joined #ruby
[05:33:32] rohitpaulk: has joined #ruby
[05:35:08] biberu: has joined #ruby
[05:35:56] hutch34: has joined #ruby
[05:40:55] runescape07rsps: has joined #ruby
[05:43:12] rgr_: has joined #ruby
[05:44:03] astrobunny: has joined #ruby
[05:46:27] aupadhye: has joined #ruby
[05:48:27] biberu: has joined #ruby
[05:51:31] jackjackdripper: has joined #ruby
[05:54:44] uZiel: has joined #ruby
[05:55:02] TomyLobo: has joined #ruby
[05:58:38] aufi: has joined #ruby
[05:59:27] muelleme_: has joined #ruby
[06:02:44] rippa: has joined #ruby
[06:03:42] gja: has joined #ruby
[06:05:22] roamingdog: has joined #ruby
[06:06:07] roamingdog: has joined #ruby
[06:06:58] roamingdog: has joined #ruby
[06:07:48] roamingdog: has joined #ruby
[06:08:28] charliesome: has joined #ruby
[06:08:33] roamingdog: has joined #ruby
[06:13:12] rohitpaulk: has joined #ruby
[06:24:04] alex``: has joined #ruby
[06:27:13] hopland: has joined #ruby
[06:29:57] dionysus69: has joined #ruby
[06:33:34] andikr: has joined #ruby
[06:35:28] rohitpaulk: has joined #ruby
[06:38:26] Azure: has joined #ruby
[06:40:24] conta: has joined #ruby
[06:44:37] alamar: has joined #ruby
[06:49:02] cyphase: has joined #ruby
[06:52:29] roshanavand: has joined #ruby
[06:57:42] Antiarc: has joined #ruby
[06:59:46] mathys: has joined #ruby
[07:01:21] Mortomes|Work: has joined #ruby
[07:02:04] Jameser: has joined #ruby
[07:07:09] ur5us: has joined #ruby
[07:07:29] tAn: has joined #ruby
[07:09:59] roamingdog: has joined #ruby
[07:10:47] kies: has joined #ruby
[07:12:31] cyphase: has joined #ruby
[07:15:04] elsevero: has joined #ruby
[07:15:43] TomyWork: has joined #ruby
[07:16:56] elsevero_: has joined #ruby
[07:18:54] Madmanden: has joined #ruby
[07:21:35] Jameser: has joined #ruby
[07:23:34] judofyr: has joined #ruby
[07:24:04] Madmanden: has left #ruby: ()
[07:25:57] Jameser: has joined #ruby
[07:26:06] sysvalve: has joined #ruby
[07:28:26] patarr: has joined #ruby
[07:28:32] ddddddd: has joined #ruby
[07:30:14] nunchuck: has joined #ruby
[07:32:03] ferr: has joined #ruby
[07:32:17] hahuang65: has joined #ruby
[07:37:46] hutch34: has joined #ruby
[07:37:52] DoubleMalt: has joined #ruby
[07:43:24] nobitanobi: has joined #ruby
[07:44:27] xychix: has left #ruby: ()
[07:50:09] latemus: has joined #ruby
[07:51:18] PatrikasZvaigzde: has joined #ruby
[07:53:34] Patadas: has joined #ruby
[07:58:15] mikecmpbll: has joined #ruby
[07:58:30] blackwind_123: has joined #ruby
[07:59:11] jenrzzz: has joined #ruby
[07:59:11] jenrzzz: has joined #ruby
[07:59:12] romank: has joined #ruby
[08:04:37] jaruga________: has joined #ruby
[08:10:34] Axsuul: has joined #ruby
[08:10:47] simmaniac: has joined #ruby
[08:13:45] burgestrand: has joined #ruby
[08:14:57] Mia: has joined #ruby
[08:14:57] Mia: has joined #ruby
[08:15:12] rohitpaulk: has joined #ruby
[08:16:05] Ishido: has joined #ruby
[08:22:51] yeticry: has joined #ruby
[08:24:15] Silthias1: has joined #ruby
[08:27:04] Silthias1: has left #ruby: ()
[08:31:01] lxsameer: has joined #ruby
[08:32:14] _moep_: has joined #ruby
[08:34:33] kruppm: has joined #ruby
[08:35:43] Silthias: has joined #ruby
[08:36:50] romank: has joined #ruby
[08:38:06] Patadas: has joined #ruby
[08:40:44] _moep_: hello! I have a problem: I try to install unicorn via bundle exec gem install unicorn, but I get this error: https://paste.debian.net/hidden/4485ab46/ which tells me the correct gem in ~/.rbenv
[08:45:46] rohitpaulk: has joined #ruby
[08:46:07] marr: has joined #ruby
[08:47:50] Jameser: has joined #ruby
[08:52:05] mim1k: has joined #ruby
[09:01:32] jenrzzz: has joined #ruby
[09:01:32] jenrzzz: has joined #ruby
[09:05:19] im0nde: has joined #ruby
[09:06:24] pandaant: has joined #ruby
[09:08:10] Coldblackice_: has joined #ruby
[09:08:36] Axsuul: has joined #ruby
[09:09:57] djbjd: has joined #ruby
[09:13:30] Coldblackice: has joined #ruby
[09:13:44] contradictioned: has joined #ruby
[09:16:21] _Coldblackice: has joined #ruby
[09:16:40] _Coldblackice: has joined #ruby
[09:17:26] _Coldblackice: has joined #ruby
[09:17:52] _Coldblackice: has joined #ruby
[09:18:37] _Coldblackice: has joined #ruby
[09:19:00] _Coldblackice: has joined #ruby
[09:20:28] dminuoso: _moep_: Im wondering if this is a psych related bug that was fixed in a newer version.
[09:20:32] Coldblackice: has joined #ruby
[09:20:33] dminuoso: _moep_: Can you try upgrading to 2.3.4?
[09:25:23] flips: has joined #ruby
[09:26:11] Coldblackice_: has joined #ruby
[09:26:43] Coldblackice_: has joined #ruby
[09:27:04] Coldblackice_: has joined #ruby
[09:27:09] runescape07rsps: has joined #ruby
[09:28:58] govg: has joined #ruby
[09:29:13] patarr: has joined #ruby
[09:29:33] Fernando-Basso: has joined #ruby
[09:31:11] Coldblackice: has joined #ruby
[09:32:08] _Coldblackice: has joined #ruby
[09:32:15] dhollinger: has joined #ruby
[09:32:39] _Coldblackice: has joined #ruby
[09:33:05] hahuang65: has joined #ruby
[09:35:44] pale3x: has left #ruby: ("WeeChat 1.8")
[09:35:50] Esf: has joined #ruby
[09:39:21] hutch34: has joined #ruby
[09:41:46] astrobunny: has joined #ruby
[09:42:52] psychicist__: has joined #ruby
[09:47:34] ltem: has joined #ruby
[09:51:55] judofyr_: has joined #ruby
[09:52:17] Coldblackice: has joined #ruby
[10:00:58] Serpent7776: has joined #ruby
[10:02:46] psychicist__: has joined #ruby
[10:11:17] r3vDev: has joined #ruby
[10:11:22] Fysicus: has joined #ruby
[10:12:06] Fraeon: has joined #ruby
[10:15:40] djbjd: has joined #ruby
[10:19:04] GodFather: has joined #ruby
[10:23:01] sami: has joined #ruby
[10:29:24] alex``: has joined #ruby
[10:30:14] r3vDev: has joined #ruby
[10:30:47] tvw: has joined #ruby
[10:36:34] anisha: has joined #ruby
[10:37:33] _moep_: dminuoso: ok, I'll try
[10:40:43] psychicist__: has joined #ruby
[10:41:24] ledestin: has joined #ruby
[10:45:57] ur5us: has joined #ruby
[10:50:07] roamingdog: has joined #ruby
[10:50:53] bkxd: has joined #ruby
[10:50:56] bkxd_: has joined #ruby
[10:56:11] bkxd: has joined #ruby
[10:56:32] nowhere_man: has joined #ruby
[10:57:30] ur5us: has joined #ruby
[11:01:29] stamina: has joined #ruby
[11:05:50] DoubleMalt: has joined #ruby
[11:12:56] zacts: has joined #ruby
[11:24:44] mydog2: has joined #ruby
[11:29:56] patarr: has joined #ruby
[11:31:37] kspencer: How can I add my ~/.gem/... path to the ruby load path? As I'm looking and only seeing how to add 'lib' directories, not user gem directories
[11:32:12] bkxd: has joined #ruby
[11:34:11] hahuang65: has joined #ruby
[11:35:03] bkxd_: has joined #ruby
[11:40:49] hutch34: has joined #ruby
[11:48:22] IRC-Manager: has joined #ruby
[11:51:25] ldnunes: has joined #ruby
[11:51:29] WhereIsMySpoon: has joined #ruby
[11:51:46] WhereIsMySpoon: Hey, I’m trying to install json 1.7.7 and I’m getting a crapton of compile errors when trying to install
[11:52:09] WhereIsMySpoon: when its trying to run make
[11:55:26] Jameser: has joined #ruby
[12:05:44] sepp2k: has joined #ruby
[12:06:22] im0nde: has joined #ruby
[12:08:55] blackwind_123: has joined #ruby
[12:10:00] chimkan: has joined #ruby
[12:10:06] synthroid: has joined #ruby
[12:10:33] minimalism: has joined #ruby
[12:13:07] chimkan: has joined #ruby
[12:15:29] _moep_: dminuoso: it doesnt work: https://paste.debian.net/hidden/816b0529/
[12:16:40] cschneid: has joined #ruby
[12:18:54] chimkan: has joined #ruby
[12:20:08] minimalism: has joined #ruby
[12:22:08] chimkan: has joined #ruby
[12:22:24] chimkan: good morning
[12:22:27] chimkan: I have a question
[12:22:38] chimkan: I’m using whenever gem to cron my ruby scripts
[12:23:01] chimkan: but when it runs, it runs in a the cron bin directory instead of the app’s folder
[12:23:18] chimkan: then the app just doesn’t run because I cannot set the directory path
[12:23:34] chimkan: currently, I’m setting by using a constant and I name the directory’s path
[12:23:43] chimkan: isn’t there any other way to do it dynamically?
[12:23:59] dminuoso: _moep_: It does.
[12:23:59] minimalism: has joined #ruby
[12:24:02] dminuoso: _moep_: It's an entirely different error.
[12:24:35] _moep_: dminuoso: hmmm my problem is, that I cant access to the unicorn
[12:25:20] dminuoso: _moep_: Im not convinced that "bundle exec gem install" is such a wise idea.
[12:25:21] dminuoso: What are you trying to do?
[12:25:34] _moep_: try to run a rails app
[12:25:55] dminuoso: _moep_: The rails app should specify all its dependencies in the Gemfile.
[12:26:06] dminuoso: _moep_: Which means a plain "bundle install" will install all necessary external dependencies.
[12:26:21] djbjd: has joined #ruby
[12:27:56] _moep_: yes I know and i did it
[12:28:30] _moep_: I unicorn is running, but I cant see it
[12:34:37] millerti: has joined #ruby
[12:35:04] dropsh0t: has joined #ruby
[12:37:55] ldnunes: has joined #ruby
[12:39:10] mim1k: has joined #ruby
[12:41:10] graft: has joined #ruby
[12:41:10] graft: has joined #ruby
[12:42:11] GinoMan: has joined #ruby
[12:42:32] FastJack: has joined #ruby
[12:42:43] cdg: has joined #ruby
[12:43:02] Mortomes|Work: has joined #ruby
[12:43:03] Jameser: has joined #ruby
[12:48:54] r3vDev: has joined #ruby
[12:49:39] jphase: has joined #ruby
[12:51:04] synthroid: has joined #ruby
[12:52:31] Rodya_: has joined #ruby
[13:03:51] patarr: has joined #ruby
[13:03:56] mim1k: has joined #ruby
[13:04:42] minimalism: has joined #ruby
[13:08:53] bed7: has joined #ruby
[13:08:57] rohitpaulk: has joined #ruby
[13:09:37] WhereIsMySpoon: has joined #ruby
[13:09:37] WhereIsMySpoon: has joined #ruby
[13:10:20] TheBloke: has joined #ruby
[13:12:11] simmaniac: has joined #ruby
[13:14:20] Jameser: has joined #ruby
[13:17:44] runescape07rsps: has joined #ruby
[13:26:35] Jameser: has joined #ruby
[13:28:12] synthroid: has joined #ruby
[13:29:01] phikes: has joined #ruby
[13:29:26] nowhere_man: has joined #ruby
[13:30:49] burgestrand: has joined #ruby
[13:30:50] WhereIsMySpoon: has joined #ruby
[13:31:41] gnufied: has joined #ruby
[13:34:16] DLSteve: has joined #ruby
[13:35:00] hahuang65: has joined #ruby
[13:38:29] centrx: has joined #ruby
[13:38:43] gregf_: has joined #ruby
[13:42:16] r3vDev: has joined #ruby
[13:42:23] hutch34: has joined #ruby
[13:42:47] fuzzyhorns1: has joined #ruby
[13:43:12] Jameser: has joined #ruby
[13:45:56] roamingdog: has joined #ruby
[13:47:15] psychicist__: has joined #ruby
[13:47:26] oleo: has joined #ruby
[13:47:30] gheegh: has joined #ruby
[13:47:41] pier: has joined #ruby
[13:48:47] rohitpaulk: has joined #ruby
[13:50:10] __Yiota: has joined #ruby
[13:50:13] burgestrand: has joined #ruby
[13:50:41] ljarvis: that's because they're not real
[13:53:22] jordanm: has joined #ruby
[13:53:39] chouhoulis: has joined #ruby
[13:53:49] itsautomatisch: has joined #ruby
[13:57:03] millerti: has joined #ruby
[14:00:01] railswebdev: has joined #ruby
[14:00:54] WhereIsMySpoon: has joined #ruby
[14:04:11] cttttt: Just wondering. Is it possible to perform an early return from a block in Ruby? I'm noticing that if I use `return` from a block is jumps out of the containing method instead of the block. I guess if returns aren't possible, the alternative would be to just fully describe the logic in blocks and make sure the result is evaluated last on all codepaths...right?
[14:04:39] troys: has joined #ruby
[14:05:29] WhereIsMySpoon: has left #ruby: ()
[14:06:03] wsewolod: has joined #ruby
[14:06:10] chimkan: has joined #ruby
[14:06:15] ljarvis: >> def foo; yield; end; foo { next 1; 2 }
[14:06:16] ruby[bot]: ljarvis: # => 1 (https://eval.in/823749)
[14:06:44] ljarvis: but yeah, you shouldn't really be doing too much complex stuff in blocks
[14:07:10] ljarvis: whoops i meant to use break not next
[14:07:27] ljarvis: next works in this case.. for reasons, but break is more correct
[14:08:37] cttttt: ljarvis: True. Are early `return` 's just seldom used in Ruby because of the last-statement-is-the-return-value behavior?
[14:09:09] charliesome: has joined #ruby
[14:09:12] ljarvis: pretty much yeah. They're used, but not too often
[14:10:07] chimkan: has joined #ruby
[14:10:35] cttttt: ljarvis: Cool. I think Javascript scrambled my brain. It's actually easier to reason with when branches fully describe control flow. But in Javascript, early return is life.
[14:11:13] dangerousdave: has joined #ruby
[14:13:58] elomatreb: cttttt: They're used in Ruby like guard frequently too, like guard statements. Catching the simple case/errors in the beginning of methods, usually in the form `return a if/unless b` or `raise A if/unless b`
[14:14:20] dropsh0t: has joined #ruby
[14:14:22] elomatreb: eh, garbled sentence
[14:16:05] Tau: has joined #ruby
[14:16:26] cttttt: elomatreb: Yeah...this is a thing in JS as well. But it's more because in earlier iterations of the language, folks couldn't decide how to handle background tasks, so some slow operations take a callback which is called with an optional error argument. So, first thing u do is inspect the error, and return immediately if something's wrong...then process the result of the slow operation.
[14:16:45] cttttt: elomatreb: Since this happens *a lot* folks just do an early return, and avoid the indenting.
[14:16:56] bkxd: has joined #ruby
[14:17:03] bkxd_: has joined #ruby
[14:17:09] cttttt: elomatreb: And, not garbled enough to be unreadable :) thx for the insights.
[14:18:07] cttttt: So, `next` in blocks (but avoid early return) and `return` in actual functions. I guess blocks !== functions in Ruby, eh?
[14:18:12] elomatreb: You'll find that Ruby code often doesn't use the explicit return keyword anywhere except in these statements
[14:18:22] ljarvis: cttttt: ruby doesn't really have functions
[14:18:26] ljarvis: cttttt: also, break not next
[14:18:37] elomatreb: Prefer break over next, and yes, blocks are not functions/methods
[14:18:49] elomatreb: They're just a bit of code associated with a method call
[14:19:09] dropsh0t: Early return is generally considered cleaner in ruby as well https://github.com/airbnb/ruby#no-nested-conditionals
[14:19:25] ljarvis: i mean, both of those examples are horrible
[14:19:42] cttttt: https://www.irccloud.com/pastebin/rpJ8DaHd/
[14:19:44] ruby[bot]: cttttt: we in #ruby do not like irccloud.com, I reposted your paste to gist for you: https://gist.github.com/e2121670ab33c74acc192ebc00a4005e
[14:19:45] ruby[bot]: cttttt: irccloud.com has no syntax highlighting, distracting formatting and loads slowly for most.
[14:19:49] mydog2: has joined #ruby
[14:19:56] elomatreb: When you `yield` to a block it doesn't call a method (as in, put something on the stack until it returns), it's usually like a jump
[14:20:14] ljarvis: cttttt: you don't want map there, you want select :)
[14:20:20] cttttt: ljarvis: Re: Early return, was just thinking about literally returning early from a call to a block.
[14:20:28] ljarvis: >> (1..5).select(&:odd?)
[14:20:29] ruby[bot]: ljarvis: # => [1, 3, 5] (https://eval.in/823755)
[14:20:51] cttttt: ljarvis: Completely academic example...was literally expecting the events to be turned to `nil` here.
[14:20:59] cttttt: events --> evens
[14:21:21] elomatreb: cttttt: ljarvis solution is idiomatic, alternatively you could utilize that a non-branching if returns nil already, so `d if d.even?` has the same effect
[14:21:24] ljarvis: cttttt: sure, you just very hardly have to do that. If you do, maybe the code is bad. Using your example, you would indeed just write if d.even?; return; else; d; end
[14:21:35] cttttt: ljarvis: Just popped into a blank file to figure out why return was weird. Makes sense though...these aren't really first class functions being passed around.
[14:21:58] ljarvis: yeah, elomatreb's example would be how it's done in the wild. Implicit nil value from the conditional
[14:22:17] Ropeney: has joined #ruby
[14:22:23] cttttt: ljarvis: Yup. Makes senses. I'll try to reprogram myself to embrace the branch in Ruby :)
[14:22:26] chimkan: has joined #ruby
[14:22:40] ljarvis: >> (1..5).select { |d| d unless d.even? }
[14:22:42] ruby[bot]: ljarvis: # => [1, 3, 5] (https://eval.in/823756)
[14:23:24] cttttt: elomatreb: Just reading ur responses. So, yield is like calling a subroutine in some languages. Yikes. So, blocks are in no way functions at all. Interesting.
[14:23:40] ljarvis: nothing is a function in Ruby, btw
[14:23:56] cttttt: ljarvis: Interesting. So, not even lamdas?
[14:24:04] ljarvis: They're lambdas :)
[14:24:13] cttttt: ljarvis: touche
[14:24:14] elomatreb: You can mutate state in lambdas, so they're not functions either
[14:24:34] ljarvis: it'll all start making sense pretty quickly
[14:24:34] cttttt: Okay. I guess under the strict definition, yeah...ur right...
[14:25:11] elomatreb: In Ruby they're called methods for that reason
[14:25:49] Yzguy: has joined #ruby
[14:26:01] cttttt: elomatreb: Makes sense. Because they can mutate data outside of converting args to a result.
[14:27:24] elomatreb: Wrt blocks from earlier: You can get a Proc object (basically a wrapper for a block) to pass them around like you would in Javascript
[14:27:44] ljarvis: you can also unbind and rebind ruby methods
[14:27:46] ljarvis: because why not
[14:28:31] haylon: has joined #ruby
[14:28:59] Ropeney: elomatreb, can you reference something that a function must not change the state of anything?
[14:29:29] cttttt: ropeney: It's a thing in pure functional programming circles. Technically, they're right that the term is misused in a lot of cases.
[14:29:38] elomatreb: I'm thinking of functions from math, where calling a function with the same arguments must always produce the same result
[14:29:49] kruppm: has joined #ruby
[14:30:07] Ropeney: I don't see how changing the state on something is any different to that?
[14:30:08] cttttt: ropeney: From a computer science/math standpoint, ...a function produces the same result from the same inputs. So, mutating those inputs or anything else could break that contract.
[14:31:55] elomatreb: It's a fairly dumb technicality, you're right
[14:32:04] Ropeney: I don't think it is a technicality
[14:32:33] Ropeney: So a function in a "functional" language, couldn't write to a database during a function call?
[14:32:58] elomatreb: Look at how you have to jump through hoops in e.g. Haskell with the IO monad to achieve that
[14:33:04] elomatreb: You're right in essence, yes
[14:33:12] cttttt: ropeney: Whatever calls out to the db wouldn't be a function.
[14:33:37] elomatreb: In functional languages there is often one special "function" that's allowed to break this rule
[14:33:38] cttttt: ropeney: If you talk to a hardcore functional programmer, you'll notice anger if you say that a routine the mutates data is a function.
[14:33:41] Ropeney: It'd be "changing state" of something, indirectly or not.
[14:35:07] elomatreb: As I said, look at how e.g. IO works in Haskell, it demonstrates all this
[14:35:22] Ropeney: I can't find anything backing this up, do you mind sharing any article?
[14:36:19] theunraveler: has joined #ruby
[14:36:26] oblique: has joined #ruby
[14:36:29] elomatreb: https://en.wikipedia.org/wiki/Functional_programming#Pure_functions -- Changing state is a side effect
[14:36:43] elomatreb: But this is getting OT
[14:38:02] Ropeney: "In computer programming, a function may be considered a pure function if both of the following statements about the function hold:", so I'
[14:38:12] Ropeney: m still confused if "function" is incorrect here.
[14:38:57] dminuoso: ropeney: it is incorrect.
[14:39:02] dminuoso: ropeney: They ought to say "routine"
[14:39:30] dminuoso: ropeney: "pure function" is the desperate attempt for "function" to regain its original meaning
[14:39:42] dminuoso: "function" is suddenly used synonmously with routine, so the old meaning of function suddenly becomes pure function.
[14:40:44] dminuoso: ljarvis | you can also unbind and rebind ruby methods
[14:40:46] elomatreb: How this came to be has to do with the evolution of programming languages from the basic form of a list of instructions
[14:41:59] dminuoso: ropeney: Essentially a pure function is a function that behaves in a mathematical sense.
[14:42:22] itsech0: has joined #ruby
[14:43:34] ljarvis: pure like dminuoso
[14:43:37] conta: has joined #ruby
[14:43:43] roamingdog: has joined #ruby
[14:44:13] ljarvis: many routine, such mathmatics
[14:44:23] Ropeney: I think in maths, the purity comes natural though? This doesn't defy the standard definition of function in CS though.
[14:44:31] t-recx: has joined #ruby
[14:44:34] dropsh0t: take it over to #haskell
[14:44:56] elomatreb: ACTION mumbles something about monads and burritos
[14:45:02] ljarvis: #ruby-offtopic is fine
[14:45:18] ljarvis: nobody needs to be sent to haskell
[14:45:21] dminuoso: elomatreb: Maybe.
[14:45:44] dminuoso: ljarvis: None needs to be send to Haskell even.
[14:46:05] ljarvis: that was average at best for you
[14:46:14] dminuoso: ljarvis: Im Just trying to be like baweaver
[14:46:27] dminuoso: There's Nothing wrong with that.
[14:46:40] ljarvis: Maybe you should stop
[14:46:50] ljarvis: ^ see, subtle
[14:47:06] ljarvis: oh you did Maybe already
[14:47:14] ljarvis: ok everyone go to #ruby-offtopic
[14:47:27] dminuoso: ljarvis: You should Read what I say.
[14:47:35] workmad3: has joined #ruby
[14:51:12] roamingdog: has joined #ruby
[14:51:20] ALVAN: has joined #ruby
[14:51:57] roamingdog: has joined #ruby
[14:52:47] roamingdog: has joined #ruby
[14:53:37] roamingdog: has joined #ruby
[14:54:02] mim1k: has joined #ruby
[14:54:11] ALVAN: hello, in bash i can specify multiple hosts using box0[1-9].dev.foo, can i use same aproach to define an attribute like hosts='box0[1-9].dev.foo' as a list ?
[14:54:22] roamingdog: has joined #ruby
[14:54:43] ALVAN: so i wont need to enter all the 9 hosts
[14:55:52] elomatreb: >> (1..9).map {|i| "host#{i}.dev" }
[14:55:53] ruby[bot]: elomatreb: # => ["host1.dev", "host2.dev", "host3.dev", "host4.dev", "host5.dev", "host6.dev", "host7.dev", "host8.d ...check link for more (https://eval.in/823769)
[14:56:04] graft: has joined #ruby
[14:56:04] graft: has joined #ruby
[14:56:09] dminuoso: There must be a shorter way to do that.
[14:56:29] dionysus70: has joined #ruby
[14:58:29] bkxd__: has joined #ruby
[14:58:36] bkxd___: has joined #ruby
[14:58:52] runescape07rsps: has joined #ruby
[14:58:57] ALVAN: thanks elomatreb i will try it
[14:59:56] elomatreb: I agree with dminuoso though, this does not feel like a satisfyingly Ruby-obscure solution
[15:01:15] enterprisey: has joined #ruby
[15:02:05] cam27: has joined #ruby
[15:02:22] runescape07rsps: has joined #ruby
[15:03:04] dminuoso: asm>> (1..9).map {|i| "host#{i}.dev" }
[15:03:05] ruby[bot]: dminuoso: I have disassembled your code, the result is at https://eval.in/823771
[15:03:07] workmad3: has joined #ruby
[15:03:26] dminuoso: elomatreb: I do not think it is doable any shorter than that. But perhaps we can find a solution that uses less vm opcodes.
[15:04:18] uZiel: has joined #ruby
[15:04:20] dminuoso: 1..9 is a primitive?
[15:04:43] dminuoso: That seals the deal. That _is_ the shortest way.
[15:05:21] patarr: has joined #ruby
[15:11:17] im0nde: has joined #ruby
[15:12:05] d10n-work: has joined #ruby
[15:12:27] Rodya_: has joined #ruby
[15:12:41] hutch34: has joined #ruby
[15:16:15] andrzejku: has joined #ruby
[15:17:59] balo: szerintem erdemes
[15:18:04] balo: wrong window sry
[15:24:33] rickumali: has joined #ruby
[15:33:36] Tau: has joined #ruby
[15:35:47] davidmichaelkarr: has joined #ruby
[15:35:52] hahuang65: has joined #ruby
[15:36:16] Tau: has joined #ruby
[15:37:26] brent__: has joined #ruby
[15:37:32] Tau: has joined #ruby
[15:38:42] nb_bez___: has joined #ruby
[15:40:11] workmad3: has joined #ruby
[15:40:21] justbleed: has joined #ruby
[15:42:22] __Yiota: has joined #ruby
[15:42:41] pawandubey: has joined #ruby
[15:43:17] skweek: has joined #ruby
[15:43:30] Tau: has joined #ruby
[15:45:08] pawelbx: has joined #ruby
[15:45:29] pawelbx: is there a way to check if a range is unbounded?
[15:46:06] xzhao: has joined #ruby
[15:46:11] dminuoso: &ri Range#exclude_end? pawelbx
[15:46:11] `derpy: pawelbx: http://ruby-doc.org/core-2.4.1/Range.html#method-i-exclude_end-3F
[15:46:35] dminuoso: Unbounded kind of means something else.
[15:46:40] dminuoso: Ranges are by definition bounded.
[15:47:25] roshanavand: has joined #ruby
[15:47:35] Rodya_: has joined #ruby
[15:48:01] pawelbx: i meant if a range goes from -infinity to infinity
[15:48:37] Papierkorb: pawelbx: That's not possible, even if you use Float::INFINITY, it has no special meaning for ruby
[15:48:43] Yzguy: has joined #ruby
[15:49:09] Papierkorb: As far ruby is concerned, 0..Float::INFINITY is still bounded
[15:49:15] [Butch]: has joined #ruby
[15:49:19] cschneid_: has joined #ruby
[15:50:10] dminuoso: But if you have some custom range with some Infinity object at the end, just test for range.end == YourInfinityObject
[15:50:39] eam: I mean, Float::INFINITY is actually a discrete value
[15:51:09] xzhao: has joined #ruby
[15:51:19] montanonic: has joined #ruby
[15:51:41] pawelbx: hmm ok so if i want to see if range is -infinity..infinity i should just check start/end values
[15:52:09] dminuoso: pawelbx: Yeah.
[15:52:39] Rodya_: has joined #ruby
[15:57:12] gusrub: has joined #ruby
[15:58:26] r3vDev: has joined #ruby
[15:59:23] workmad3: has joined #ruby
[16:00:02] gusrub: has joined #ruby
[16:00:27] Tatey: has joined #ruby
[16:01:22] rohitpaulk: has joined #ruby
[16:02:22] rubylegend2092: has joined #ruby
[16:02:50] rubylegend2092: Can you please help with a problem that I'm having.
[16:03:05] DaniG2k: has joined #ruby
[16:03:59] amclain: has joined #ruby
[16:04:14] rubylegend2092: I'm trying to build an activerecord relationship between 3 models. I have a user model and a business user model. I would like to give the user the ability to leave a review on the ReviewModel linked to the business user. What kind of relationship would you establish for that?
[16:04:22] ljarvis: ?rails rubylegend2092
[16:04:22] ruby[bot]: rubylegend2092: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[16:06:37] rubylegend2092: has joined #ruby
[16:07:51] Rodya_: has joined #ruby
[16:08:39] Mia: has joined #ruby
[16:08:40] Mia: has joined #ruby
[16:12:06] gnufied: has joined #ruby
[16:12:19] anjen: has joined #ruby
[16:13:14] havenwood: >> (-Float::INFINITY..Float::INFINITY).mixmax
[16:13:15] ruby[bot]: havenwood: # => undefined method `mixmax' for -Infinity..Infinity:Range ...check link for more (https://eval.in/823814)
[16:13:28] havenwood: Strange: Did you mean? minmax
[16:13:48] havenwood: rubylegend2092: Hi.
[16:14:11] havenwood: rubylegend2092: If you register and identify your nick you can join #RubyOnRails for Rails-specific questions.
[16:14:23] rubylegend2092: How do I register?
[16:14:29] havenwood: ?register rubylegend2092
[16:14:29] ruby[bot]: rubylegend2092: you need to be identified with NickServ, see /msg NickServ HELP
[16:14:43] havenwood: rubylegend2092: https://freenode.net/kb/answer/registration
[16:14:43] rubylegend2092: register rubylegend2092
[16:19:40] gusrub: has joined #ruby
[16:20:36] bkxd: has joined #ruby
[16:21:42] bkxd_: has joined #ruby
[16:22:43] hutch34: has joined #ruby
[16:23:45] djbjd: has joined #ruby
[16:23:50] rubylegend2092: Alright, I managed to get registered to the IRC.
[16:24:03] Zarthus: excellent job
[16:24:27] conta: has joined #ruby
[16:24:39] mikecmpbll: that is a fine choice of alias, sir.
[16:28:13] muelleme_: has joined #ruby
[16:29:06] rubylegend2092: What I'm having an issue with, is how I should set a relationship up between 3 models. I have a BusinessUser model, a User model and a BusinessReview model. How can I allow the user to create/update/delete/read business reviews on the BusinessReview model. But still have a reference to the BusinessUser Model (for tracking purposes) ActiveRecord
[16:30:10] cdg: has joined #ruby
[16:30:28] rubylegend2092: If you have a better approach. Please let me know.
[16:31:15] jaruga_________: has joined #ruby
[16:31:57] cdg: has joined #ruby
[16:32:02] JustTheDoctor: has joined #ruby
[16:33:00] valentin: has joined #ruby
[16:33:50] cdg: has joined #ruby
[16:34:25] mim1k: has joined #ruby
[16:34:28] ddddddd: has joined #ruby
[16:36:34] wsewolod: has joined #ruby
[16:38:39] cadillac__: has joined #ruby
[16:39:21] meshsmith: has joined #ruby
[16:50:18] tgragnato: has joined #ruby
[16:50:37] balazs: has joined #ruby
[16:55:02] isBEKaml: has joined #ruby
[16:55:30] rohitpaulk: has joined #ruby
[16:57:35] dionysus69: has joined #ruby
[16:57:40] Cohedrin_: has joined #ruby
[16:59:17] GinoMan2440: has joined #ruby
[17:00:03] nowhere_man: has joined #ruby
[17:00:13] ujjain: has joined #ruby
[17:00:13] ujjain: has joined #ruby
[17:01:37] skweek: has joined #ruby
[17:01:47] gusrub: has joined #ruby
[17:04:35] pawandubey: has joined #ruby
[17:06:32] Tau: has joined #ruby
[17:07:38] cgfbee: has joined #ruby
[17:11:46] ljarvis: rubylegend2092: you need to join #rubyonrails -- type /join #rubyonrails depending on your irc client
[17:12:20] TomyLobo: has joined #ruby
[17:13:48] baweaver: ljarvis bit slow there
[17:13:56] baweaver: they're already there :)
[17:14:29] hahuang65: has joined #ruby
[17:14:41] kies: has joined #ruby
[17:14:55] GinoMan2440: has joined #ruby
[17:18:37] gusrub: has joined #ruby
[17:20:14] workmad3: has joined #ruby
[17:21:02] muelleme_: has joined #ruby
[17:22:30] dminuoso: baweaver, what are you doing in here?
[17:25:37] shinnya: has joined #ruby
[17:28:45] baweaver: dminuoso hm?
[17:29:14] ltem: has joined #ruby
[17:31:28] nobitanobi: has joined #ruby
[17:32:10] synthroid: has joined #ruby
[17:32:48] xzhao_: has joined #ruby
[17:33:47] xzhao_: has joined #ruby
[17:34:17] nuk9: has joined #ruby
[17:34:38] nuk9: has joined #ruby
[17:36:33] perniciouscaffei: has joined #ruby
[17:40:53] xzhao_: has left #ruby: ("http://quassel-irc.org - Chat comfortably. Anywhere.")
[17:43:30] zululee: has joined #ruby
[17:44:15] bodgix: has joined #ruby
[17:45:13] kolgomorov: has joined #ruby
[17:45:25] bodgix: has left #ruby: ()
[17:52:02] __Yiota: has joined #ruby
[17:52:50] khaki: has joined #ruby
[17:53:59] ThatsNotJack: has joined #ruby
[17:55:27] montanonic: has joined #ruby
[17:56:33] jottr: has joined #ruby
[18:01:41] sebd: has joined #ruby
[18:01:58] synthroid: has joined #ruby
[18:04:13] tAn: has joined #ruby
[18:06:26] lxsameer: has joined #ruby
[18:08:19] GinoMan1423: has joined #ruby
[18:08:39] ALVAN: has left #ruby: ()
[18:10:15] oncall-pokemon: has joined #ruby
[18:11:27] uZiel: can I iterate over array elements with each, but after skipping first n elements?
[18:12:46] rickumali: you can try passing in the slice before your call to each
[18:12:54] rickumali: a[5..a.length].each { |n| puts n }
[18:13:33] apeiros: or a.skip(n).each
[18:14:01] apeiros: not skip… but there was a method…
[18:14:04] andrzejku: has joined #ruby
[18:14:09] apeiros: ah, right, drop
[18:14:18] apeiros: ary.drop(n).each …
[18:14:53] uZiel: I was thinking of implementing something like a Fibonacci seq, in one line in ruby if possible
[18:15:12] conta: has joined #ruby
[18:15:52] uZiel: so i have a=[1,1,0,0,0,0,0,0,0,0...]; after the operation I want to update each element inplace with previous two sums
[18:16:15] theunraveler: has joined #ruby
[18:17:20] uZiel: (2..a.size-1).each {|i| a[i] = a[i-1] + a[i-2]}
[18:17:38] uZiel: ^ will this do it?
[18:18:24] uZiel: or is there a better way?
[18:18:29] haylon: has joined #ruby
[18:19:40] rohitpaulk: has joined #ruby
[18:20:39] agent_white: has joined #ruby
[18:20:46] baweaver: If it _is_ fibonacci, you don't even need a loop or recursion.
[18:21:37] uZiel: then how?
[18:23:26] Tau: has joined #ruby
[18:23:54] baweaver: Integer(φ^n + τ)
[18:24:11] baweaver: You'd use Phi and Tau.
[18:25:53] jphase: has joined #ruby
[18:26:52] uZiel: nah man, I am _not_ using fibonacci exactly but doing some other opration on the previous two elements
[18:26:53] dmtd: has joined #ruby
[18:27:54] mydog2: has joined #ruby
[18:28:24] baweaver: each_with_index
[18:28:37] baweaver: last(n - offset)
[18:28:48] baweaver: https://github.com/lipanski/slow-down/pull/2/commits/f1ab80be9cf9890885a8e8187c1ab5203aa6d080
[18:32:36] havenwood: my fav fib in Ruby: require 'matrix'; def fib n; (Matrix[[0, 1], [1, 1]] ** n.pred)[1, 1].to_i end
[18:33:17] rohitpaulk: has joined #ruby
[18:33:28] havenwood: >> require 'matrix'; def fib n; (Matrix[[0, 1], [1, 1]] ** n.pred)[1, 1].to_i end; fib 10
[18:33:29] ruby[bot]: havenwood: # => 55 (https://eval.in/823927)
[18:34:00] cam27: has joined #ruby
[18:34:14] havenwood: https://gist.github.com/havenwood/02cf291b809327d96a3f
[18:34:55] KeyJoo: has joined #ruby
[18:36:31] Ilie[]: has joined #ruby
[18:43:13] Cohedrin_: has joined #ruby
[18:45:36] marxarelli: has joined #ruby
[18:46:27] jottr: has joined #ruby
[18:47:15] urux: has joined #ruby
[18:48:20] jackjackdripper: has joined #ruby
[18:48:42] t-recx: has joined #ruby
[18:50:01] roamingdog: has joined #ruby
[18:54:02] cdg: has joined #ruby
[18:56:47] dionysus70: has joined #ruby
[19:00:39] ahrs: has joined #ruby
[19:01:51] tonini: has joined #ruby
[19:02:08] __Yiota: has joined #ruby
[19:03:30] jottr: has joined #ruby
[19:04:20] jenrzzz: has joined #ruby
[19:04:33] jenrzzz: has joined #ruby
[19:05:01] elsevero: has joined #ruby
[19:08:46] __Yiota: has joined #ruby
[19:09:32] millerti: has joined #ruby
[19:11:00] pawandubey: has joined #ruby
[19:17:02] SeepingN: has joined #ruby
[19:20:17] FastJack: has joined #ruby
[19:20:57] gusrub: has joined #ruby
[19:26:26] __Yiota: has joined #ruby
[19:27:05] yehowyada: has joined #ruby
[19:27:22] benlieb: has joined #ruby
[19:27:27] Rodya_: has joined #ruby
[19:28:26] dare-to-recurse[: has left #ruby: ("User left")
[19:31:00] alex``: has joined #ruby
[19:34:37] flak: has joined #ruby
[19:35:03] HoierM: has joined #ruby
[19:36:53] nobitanobi: has joined #ruby
[19:40:44] Dimik: has joined #ruby
[19:46:03] govg: has joined #ruby
[19:46:11] wilbert: has joined #ruby
[19:49:54] pohvak: has joined #ruby
[19:50:50] pawandubey: has joined #ruby
[19:56:36] MrBusiness: has joined #ruby
[20:02:12] roamingdog: has joined #ruby
[20:02:43] patarr1: has joined #ruby
[20:02:52] chouhoul_: has joined #ruby
[20:03:12] jphase: has joined #ruby
[20:03:38] rohitpaulk: has joined #ruby
[20:03:59] roamingdog: has joined #ruby
[20:05:01] chouhoul_: has joined #ruby
[20:05:39] jackjackdripper: has joined #ruby
[20:05:57] roamingdog: has joined #ruby
[20:13:11] jenrzzz: has joined #ruby
[20:13:11] jenrzzz: has joined #ruby
[20:13:23] rickumali: has left #ruby: ("peace!")
[20:16:29] mim1k: has joined #ruby
[20:18:38] benlieb: has joined #ruby
[20:19:59] R11: has joined #ruby
[20:28:29] chouhoulis: has joined #ruby
[20:32:55] cschneid_: has joined #ruby
[20:36:08] shinnya: has joined #ruby
[20:37:11] hutch34: has joined #ruby
[20:38:29] jackjackdripper: has joined #ruby
[20:40:29] anjen: has joined #ruby
[20:40:50] jenrzzz: has joined #ruby
[20:40:50] jenrzzz: has joined #ruby
[20:43:56] patarr: has joined #ruby
[20:45:59] brent__: has joined #ruby
[20:47:03] theunraveler: has joined #ruby
[20:49:01] Bock: has joined #ruby
[20:49:22] mikecmpbll: has joined #ruby
[20:53:02] workmad3: has joined #ruby
[21:03:07] GinoMan2440: has joined #ruby
[21:03:18] Axy: has joined #ruby
[21:04:38] patarr: has joined #ruby
[21:06:29] nobitanobi: has joined #ruby
[21:07:23] Mia: has joined #ruby
[21:07:24] Mia: has joined #ruby
[21:09:44] mim1k: has joined #ruby
[21:09:57] cschneid_: has joined #ruby
[21:11:41] dviola: has joined #ruby
[21:12:05] milardovich: has joined #ruby
[21:16:21] patarr: has joined #ruby
[21:17:34] jenrzzz: has joined #ruby
[21:17:34] jenrzzz: has joined #ruby
[21:22:47] ur5us: has joined #ruby
[21:26:02] TessierAshpool: has joined #ruby
[21:29:14] mostlybadfly: has joined #ruby
[21:35:37] nofxx: has joined #ruby
[21:35:52] mydog2: has joined #ruby
[21:38:08] ttilley: has joined #ruby
[21:38:16] enterprisey: has joined #ruby
[21:38:22] ttilley: has joined #ruby
[21:40:37] Tau: has joined #ruby
[21:41:10] agent_white: has joined #ruby
[21:44:07] BSaboia: has joined #ruby
[21:44:26] postmodern: has joined #ruby
[21:47:03] dionysus69: has joined #ruby
[21:47:59] fusta: has joined #ruby
[21:48:36] Patadas: has joined #ruby
[21:48:59] cam27: has joined #ruby
[21:49:20] jak: has joined #ruby
[21:49:28] gix: has joined #ruby
[21:54:46] amperry: has joined #ruby
[21:58:30] jinie: has joined #ruby
[21:58:49] jinie: has joined #ruby
[21:59:43] PaulCapestany: has joined #ruby
[22:01:39] Cohedrin_: has joined #ruby
[22:02:08] amperry: hi folks, I'm trying to connect to a postgresql db using the PG gem, but I need to be able to create a schema (in the postgresql sense of the word) and set my search_path to it.
[22:02:48] amperry: I'm reading a file of psql commands into an array, the first of which are 'create schema if not exists #{legacydb};' and 'set search_path to #{legacydb};' I've already created one schema manually, so the 'if not exists' should guard against creating it.
[22:02:58] jenrzzz: has joined #ruby
[22:02:59] jenrzzz: has joined #ruby
[22:03:20] amperry: As for the second command, my script seems to execute it, but when I go to execute other commands (e.g. 'insert into "TABLE NAME" ...'), I get the error 'relation "TABLE NAME" does not exist', even though it does, in the #{legacydb} schema.
[22:03:50] amperry: I'm guessing, therefore, that I'm not really altering my search_path, or at least, the change doesn't persist between commands.
[22:05:19] amperry: sooo... I guess the question is, is there something that needs to be done to persist the search_path in the same connection, but between commands?
[22:05:29] jackjackdripper: has joined #ruby
[22:07:26] __Yiota: has joined #ruby
[22:13:51] jak: has joined #ruby
[22:13:57] Tau: has joined #ruby
[22:15:46] jak: has joined #ruby
[22:19:13] roamingdog: has joined #ruby
[22:21:47] im0nde: has joined #ruby
[22:22:26] justbleed: has joined #ruby
[22:28:05] workmad3: has joined #ruby
[22:31:21] cam27: has joined #ruby
[22:32:54] bkxd: has joined #ruby
[22:34:44] knight33: has joined #ruby
[22:40:06] bkxd_: has joined #ruby
[22:41:33] meshsmith: has joined #ruby
[22:41:33] meshsmith: has joined #ruby
[22:42:11] nb_bez____: has joined #ruby
[22:45:13] ahrs: has joined #ruby
[22:47:15] agent_white: has joined #ruby
[22:51:27] hahuang65: has joined #ruby
[22:54:00] ur5us: has joined #ruby
[22:54:43] clemens3: first time i learn about search_path, seems to be a feature better living without
[22:55:32] clemens3: never needed it, and if you need it, i don-t know, maybe ur not clear about what you really need / but that-s me..
[23:11:08] zacts: has joined #ruby
[23:11:13] millerti: has joined #ruby
[23:11:15] hkdsun: has joined #ruby
[23:12:08] nobitanobi: has joined #ruby
[23:16:06] eljimmy: has joined #ruby
[23:16:45] ozcanesen: has joined #ruby
[23:19:30] Jameser: has joined #ruby
[23:20:01] pwnd_nsfw: has joined #ruby
[23:25:48] mim1k: has joined #ruby
[23:27:58] jottr: has joined #ruby
[23:30:19] justbleed: has joined #ruby
[23:35:00] amperry: has joined #ruby
[23:37:16] amperry: hi folks, I'm trying to use the 'pg' gem to read and execute a bunch of sql (postrgresql) commands from one or more files. I've determined that when I make the connection I am the right user with the right password, and I've also confirmed that I'm in the right schema. But, no matter what table I try to insert data into, I get the error 'relation "TABLE" not found'. Even though I can confirm its existence in the psql client. Any ideas
[23:37:17] amperry: why this might happen?
[23:38:35] amperry: correction, the error is 'relation "TABLE" does not exist'
[23:39:09] pabs: i'm guessing you've got the table name quoted in your query, a double-quoted identifier in postgres is case-sensitive
[23:39:35] pabs: so if your table is literally named table (lower case), and you're trying to query "TABLE", it won't find it
[23:40:30] amperry: they're uppercase, which is why I have the double quotes
[23:42:04] amperry: it happens regardless of the actual table name, too (although I haven't tried it on a lowercase table... let me check that).
[23:42:22] pabs: remove the double quotes from the name, that's what i'm trying to tell you
[23:42:24] pabs: or fix the case
[23:42:50] pabs: > create table asdf as select generate_series as a from generate_series(1, 5); select count(*) from "ASDF"; select count(*) from asdf;
[23:42:53] pabs: SELECT 5
[23:42:56] pabs: ERROR: relation "ASDF" does not exist
[23:42:58] pabs: LINE 1: select count(*) from "ASDF";
[23:43:28] jak: has joined #ruby
[23:43:36] pabs: notice how the first query (the one with the double quoted relation name) fails with the exact same error you're seeing?
[23:43:37] amperry: the table names are given, and I've tried with and without quotes
[23:43:43] Pepu: has joined #ruby
[23:44:10] chimkan: has joined #ruby
[23:45:27] pabs: amperry: the only things i can think of are your search path might be different, and/or the account your code is connecting as doesn't have the proper permissions to see the table
[23:45:34] pabs: amperry: but i suspect it's the double quotes
[23:45:44] amperry: is there no way to make the pg gem work with a table name that's all uppercase?
[23:46:19] amperry: yeah, I've verified the user has permissions and I'm in the correct schema; I can query the tables from within a psql terminal client.
[23:46:43] pabs: amperry: it's the double quotes around the table name in the query itself, not the pg gem
[23:47:50] Azure|dc: has joined #ruby
[23:49:18] amperry: how do you get postgresql to recognize an all-capital table name without quoting it? The tables pre-exist so I can't rename them.
[23:50:08] pabs: identifiers are case-insensitive in postgres unless they are double-quoted in the query string, so you need to remove the double quotes in the query string itself
[23:50:35] pabs: if you've got 'select count(*) from "TABLE"', it should be changed to 'select count(*) from table'
[23:51:56] amperry: same error, only now in lowercase; the table in question is OCCUPANTS, so (without the double quotes), I get 'ERROR: relation "occupants" does not exist'.
[23:52:07] railswebdev: has joined #ruby
[23:52:37] amperry: with them, I get 'ERROR: relation "OCCUPANTS" does not exist'
[23:52:38] pabs: if that's the case then it could be a search path issue
[23:53:47] amperry: possible, but by everything I can check, it's the right search_path, the right user credentials, and the right permissions.
[23:54:22] pabs: it would help if you could paste the actual query and/or the code that you're using (as a gist or whatever)
[23:54:50] amperry: sure, it'll take a moment...