#ruby - 26 June 2019
« Back 1 day Forward 1 day »
[09:01:27] cca4: Hello I'm trying to display console https://github.com/rails/web-console from a container docker with rails and I have this Cannot render console from 172.24.0.1 error! Allowed networks: 127.0.0.0.0.0/127.255.255.255.255, ::1 how can I solve it? Thank you in advance
[12:00:22] ZAJDAN: file_path = Rails.root.join('PDF','KW_list.pdf') is somehow possible in the filename use variable?
[12:19:02] leitz: JS is good for a lot of things; I looked at the MEAN stack a while back and loved the idea.
[12:19:32] Josse: I'm just interested in broadening my understanding of full stack development, honestly
[12:19:33] leitz: What I find most important is how well the language fits me, personally, and secondarily how well it fits the tasks I want to do.
[12:20:37] leitz: Josse, honestly, if you're into full stack I'd do some MongoDB. Mongo uses JS as the "SQL" language, so that's a plus.
[12:21:21] Josse: I've heard about MongoDB, but honestly, why would I want to use something like that compared to my own SQL database?
[12:23:40] leitz: I found my understanding of how much I "knew" changed drastically when I had to do it for a living.
[12:24:16] Calinou: there are many practical use cases for NoSQL databases, but at a small scale, you probably won't notice the difference as much
[12:24:26] Calinou: the fact that many clients want NoSQL because it looks pretty on their PowerPoint also hurts :)
[12:24:42] leitz: My own path has been to add git and TDD. I'm an "Apprentice" in a few C based languages and want to get better.
[12:25:15] leitz: So I'm using Ruby to push towards mastery in programming topics like OOP, introspection, patterns, etc.
[12:26:28] NL3limin4t0r: Josse: Although most developers hate php, me included, it's worth learning for legacy sake. More than 50% of website run a php backend.
[12:27:08] Josse: yeah recently I was looking for developer jobs just out of interest, to see what was out there
[12:27:09] leitz: NL3limin4t0r makes a good point, if you want to get hired for Web, then add PHP and Rails.
[12:27:58] phaul: it's a shame that the good old "expressiveness - succintness" and so on of ruby doesn't come up any more in these discussions.
[12:29:11] phaul: I think the more languages you know especially the more come from different paradigms the better off you are
[12:30:09] leitz: phaul, I'm getting back into Ruby to retain what sanity remains, and finding it much more productive.
[12:31:44] leitz: There's the walk through on golang.org, and Univ of Cali (something) has a free Coursera specialty on it.
[12:33:41] Calinou: PHP isn't just legacy, modern PHP is a pretty decent language to work with in my experience
[12:36:15] NL3limin4t0r: Ruby is a fun language to learn. If you write it well it's one of the more (visually) beautiful languages out there.
[12:36:22] Josse: I believe I'll go with PHP first then, because I've already got really good learning resources
[12:36:51] Calinou: once you get more seasoned in PHP, there's a fun minigame to do here: http://returntrue.win/ :P
[12:37:38] leitz: The coursera course lets you take for free, or you can pay and get a certificate. Which might help employment. PHP, Ruby, and Java have language certs, too.
[12:39:51] NL3limin4t0r: Josse: Another good language to learn is Java. It's not the most requested language, but it does offer a good base for a lot of programming concepts, since everything has to be written out explicitly. Things like classes, inheritance, abstract classes, interfaces, method overloading.
[13:21:36] ZAJDAN: Josse: a few Years I work with PHP ...it is nice language, but now Iam trying RubyOnRails and I have to say....it is perfect
[13:22:40] ZAJDAN: hard to learn, cause community is not so big as in PHP, but when you are patient you will like it
[13:48:19] jokke: it's a document based db. I've yet to see a standard web project that didn't have relational data
[13:49:21] jokke: heh rubyonrails is far from perfect but sure, it solves quite a range of standard problems pretty elegantly (i'm a long time rails dev)
[13:52:26] jokke: ZAJDAN: when it comes to ruby web frameworks, i really like how hanami is approaching things
[14:13:37] ebbflowgo: hey, what's the best way to normalize a compounded fastjson_api serialized hash?
[14:32:02] rubydoc: # => -''-..-''-...-''-..-''-..-''-..-'''-..-''-..-''-..-''-...-''-..-''-..-''-..-[".", "-", "'"] (https://carc.in/#/r/74x0)
[14:33:50] ebbflowgo: i'd like to be able to look at each content object and get the respective lists and user for each list
[14:35:40] havenwood: It looks like you're talking about this? https://www.npmjs.com/package/normalizer
[14:44:37] havenwood: ebbflowgo: It's easy with the stdlib to remove non-ASCII characters or replace them with an arbitrary character. I'd probably use the i18n gem for the transliteration.
[14:49:14] ruby[bot]: ebbflowgo: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[14:56:51] ebbflowgo: perhaps there's a misunderstanding, rather than removing non-ascii characters, i'm looking to return compound objects, ie content and it's lists and lists.user data
[15:03:36] havenwood: ebbflowgo: I'd suggest searching for a gem that does this. I don't really get the "normalization" task. Is it just transliterating non-ASCII characters to their ASCII equivalent?
[15:07:13] havenwood: ebbflowgo: Can you just "normalize" the serialized JSON? Is there anything else going on other than transliterating non-ASCII characters?
[15:08:20] havenwood: I get there's a normalizer node package. I don't know what it does. The top of its docs seem to suggest transliteration.
[15:11:04] havenwood: ebbflowgo: https://freenode.irclog.whitequark.org/ruby/2019-06-26#1561559740-1561559817;
[15:17:17] ebbflowgo: sorry about that too, i've been looking at this all morning. the package text blended together
[15:34:00] ebbflowgo: this package also takes the normalized json and turns it into the nested result :| https://github.com/yury-dymov/redux-object
[15:37:35] havenwood: ebbflowgo: That looks like a tool for a very specific use case. You'll probably need to find a gem or write one to get this in Ruby.
[15:38:58] ebbflowgo: havenwood, yeah.. i'm surprised because the gem fastjson_api seems to be a popular serializer.. so i'm curious as to what others are doing when they have any relationships on their objects
[15:41:31] havenwood: ebbflowgo: Doesn't the fast_jsonapi just support that out of the box? https://github.com/Netflix/fast_jsonapi
[15:45:16] ebbflowgo: havenwood: here are my serializers, if that were the case id expect the data to show up in each data object
[15:52:45] ebbflowgo: as the data displayed in this gist, i believe fastjson_api shows the relationships, but i'd really expect an easy way to grab the relationship data for the content lists and list.user
[17:12:35] duleja: Does it make a difference if I store json data to a file and then read it to a variable and pass that variable to a JSON.parse(variable-here) Or this is the same if I just send my json response to a JSON.parse(response)?
[17:35:37] rokra: Hey, how can I get the value of this variable only if it exists ? p r["interfaces"]["mac_address"] --> I have error <main>': undefined method `' for nil:NilClass
[17:39:06] phaul: there is fetch, for hash and array from built ins. then you have safe navigation &. altrough with addressing  it'sa bit inonvinient. blah&.(index) looks silly but works
[22:15:34] chris349: Trying to setup RVM correctly, lots of steps say something about "$HOME/.rvm/scripts/rvm"
[22:15:59] chris349: What do I do if I do not have that file? I have /usr/local/rvm/bin/rvm instead where would .rvm directory be located?
[22:16:53] havenwood: chris349: That means you have a "global" install of RVM, which isn't recommended.
[22:17:25] havenwood: chris349: Ideally, uninstall RVM, restart your terminal to drop env, and reinstall RVM as a non-root user without sudo.
[22:18:24] havenwood: SeepingN: They don't have RVM installed in the home dir, since they have it installed globally.
[22:18:52] chris349: Maybe a better question, the bundle install fails with this error: usr/bin/env: ruby_executable_hooks: No such file or directory
[22:19:38] havenwood: It's a threshold question, because if you did, you should stop and reinstall locally.
[22:20:05] havenwood: chris349: Okay, so you have a bad install of RVM. RVM isn't meant to work with the root user.
[22:21:43] havenwood: chris349: Alternatively, you can manually work around root issues. The installation instructions advise to not install as root. You'll have an easier time on that path.
[22:21:47] chris349: Also how can I use that \curl -sSL https://get.rvm.io to install a specific version? I always need to run it, add the correct version, and then delete the default version it installed
[22:22:47] havenwood: chris349: Are you installing Ruby for a development or production environment?
[22:23:05] havenwood: chris349: Are you installing Ruby for a development or production environment?
[22:24:39] havenwood: chris349: Okay, a local install is sane in development. Usually, it's advised not to use a version switcher in prod, fwiw.
[22:25:32] havenwood: chris349: Those instructions advise to do a single-user install as a non-root user.
[22:25:52] havenwood: chris349: If a part of those instructions isn't clear, let's fix it so it's clear.
[22:26:04] chris349: havenwood, Lets not debate that. The question is, can I specify the Ruby version from the start?
[22:26:55] havenwood: chris349: The reason I'd want to debate it is I'm one of the maintainers of RVM, so I'd like the instructions to work. Just saying, if you think they're broken, let's fix them.
[22:27:27] havenwood: chris349: By default, installing RVM doesn't install a version of Ruby. Do you want to install RVM and a Ruby of a particular version or something else?
[22:27:46] havenwood: chris349: You can install RVM along with a Ruby if you want. Or do them in separate steps. Up to you.
[22:28:12] havenwood: By default, RVM does not install a Ruby. Normally, you install RVM, then use RVM to install a Ruby.
[22:29:06] havenwood: chris349: I'm unclear whether you want to install a particular version of RVM, or RVM alongside a particular version of Ruby?
[22:29:49] chris349: I would prefer to pass to the \curl -sSL https://get.rvm.io command the version of ruby I want
[22:30:11] chris349: The only way I know how to do it is run that command, install the ruby version, then uninstall the default version
[22:33:28] havenwood: chris349: If you must use an unsupported root install, instructions are here: https://rvm.io/support/faq#i-want-to-install-for-root-only
[22:34:08] havenwood: chris349: Be sure to restart your terminal between uninstalling and reinstalling.
[22:38:48] chris349: This is odd, its trying to install ruby from the system package manager? Installing required packages: ruby...jenkins password required for 'yum install -y ruby':
[22:41:05] havenwood: chris349: I think you'd have had better luck if you asked the channel how to install Ruby in development on your OS. :P
[22:41:06] chris349: Anyways I install as non-root user and in the shell rvm/ruby works fine, but in the Jenkins CI script it still fails: /tmp/jenkins8124905322485742601.sh: line 2: bundle: command not found
[22:44:38] havenwood: Anyhoo if it's CentOS you can use EPEL for Ruby 2.4: https://www.softwarecollections.org/en/scls/rhscl/rh-ruby24/
[22:44:50] chris349: havenwood, I do that but still same error. CentOS 7. I need Ruby 2.1.7 for this
[22:45:35] chris349: I can run the app in production on Centos 7, but I am trying to run these rspec tests under Jenkins CI. Unless theres a better system to use for that
[22:45:35] havenwood: chris349: It's past end of life, so you should use a package manager with LTS to get security backports.
[22:45:55] havenwood: chris349: Ruby 2.1 has known security vulnerabilities that are not patched if you compile it yourself.
[22:46:25] chris349: havenwood, Great. The issue is bundle command is found in my terminal and not found when I try to run this through Jenkins CI under the same user