#ruby - 11 July 2019
« Back 1 day Forward 1 day »
[07:14:56] ytti: http://nakedsecurity.sophos.com/2019/07/09/backdoor-discovered-in-ruby-strong_password-library/
[07:15:42] ytti: anyone know what is going on here? Where is that library even used? Why did someone bother owning rubygems to troyan it? And how did they own rubygems
[07:15:59] ytti: seems like a lot of bother for library i don't immediately see being particularly popular
[10:06:00] ruby[bot]: Bish: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `' for nil:NilClass
[10:24:19] balo: not sure about your exact problem you are trying to solve. for me `[*1..49].sample(6)` seems to do something similar
[11:24:36] NL3limin4t0r: Bish: It retreives 6 random elements from the array. It's not simply an array with 6 random numbers.
[11:54:07] ytti: which says ' unique indices into the array in order to ensure that an element doesn't repeat itself unless the array already contained duplicate elements.
[12:01:27] havenwood: Bish: You can implement #sample for a lazily sized Enumerator, but for an unsized one you have to iterate the entire collection just to count it anyways.
[12:01:59] havenwood: &>> sized_enumerator = 1.upto(50); sized_enumerator.drop(rand(0...sized_enumerator.size)).first
[12:08:35] havenwood: I did a PR to change the output of #yield_self/#then to be a sized Enumerator, which meant teaching Ruby objects their size is one. :P
[16:27:34] ytti: many things in python obviously shout that it wasnt designed with coherent picture at mind
[16:28:23] ytti: map/reduce are 2nd class citizens later added on by someone who missed them from proper languages
[16:29:20] ytti: and yet the general impression is that ruby is bit of a web toy language, while python is more grown up
[16:29:31] ytti: nothing could be further from the truth to anyone with cursory understanding of both languages
[16:30:52] Inside: I'm using python because it definitely has better graphing/ui/data analysis stuff, but am posting results to a RoR server
[17:55:14] leitz: Now and again I e-mail people who have written Ruby books. I'll politely point out that a new version of their book, timed with the release of Ruby 3, might be opportune.
[19:15:39] caduguedess: Hi, I've installed a Ruby on Rails project (OpenStreetMapWebsite https://github.com/openstreetmap/openstreetmap-website ). I can access it through localhost:3000 but I'm not receiving the confirmation email after signing up. I can only activate accounts through the Rails Console. I tried to follow RoR tutorials but couldn't figure it out. How could I set the mailer to make it work? I appreciate any help .
[19:16:55] caduguedess: It comes with some erb files that seems to be used to send the emails, but I don't know how to set them to work, thats why I couldnt follow a tutorial because the tutorials teach how to make them from scratch
[19:17:33] havenwood: caduguedess: Looks like that project uses delayed_job for its worker queue. I'm assuming email is using that queue.
[19:20:47] caduguedess: I dont know if I'm running it, I just run "bundle exec rails server" to make it work
[19:22:41] havenwood: It looks like neither script/delayed_job nor bin/delayed_job were generated, for whatever reason
[19:23:18] caduguedess: I did run bin/rails jobs:work and tried to re-send the email, but not received yet
[19:26:46] havenwood: caduguedess: sudo apt-get update && sudo apt-get install -y redis-server && sudo systemctl start redis-server.service
[19:28:04] havenwood: caduguedess: Ah, looks like delayed_job supports multiple backends - not just Redis: https://github.com/collectiveidea/delayed_job/wiki/Backends
[19:29:29] havenwood: caduguedess: I don't see Redis listed as a dep, actually: https://github.com/openstreetmap/openstreetmap-website/blob/master/INSTALL.md
[19:30:29] havenwood: caduguedess: https://github.com/openstreetmap/openstreetmap-website/blob/master/app/mailers/notifier.rb
[19:30:33] caduguedess: in the folder /app/mailers/ there are the files notifier.rb and application_mailer.rb
[19:31:53] adam12: havenwood: I love redis but I feel like it's introduced wayy too early for a lot of projects.
[19:32:15] havenwood: caduguedess: I may have led you on a wild goose chase as it seems they're not using jobs for mail...
[19:33:33] havenwood: caduguedess: It's been a while since I've used ActionMailer. If you haven't read the docs recently, they're probably worth a read: https://guides.rubyonrails.org/action_mailer_basics.html
[19:34:22] caduguedess: Actually I did read, but couldn't figure it out which file I have to modify, since the tutorials says to create files and the project already have the files with different names
[19:39:12] havenwood: sudo systemctl stop redis-server.service && sudo apt-get purge -y redis-server &&
[19:40:33] havenwood: caduguedess: Or, maybe a bit better: sudo systemctl stop redis-server.service && sudo apt-get purge --auto-remove redis-server
[23:54:11] havenwood: This is something I've been wanting lately. Great to see an experimental go ahead!
[23:56:00] havenwood: `while message in connection.read` has none of the funkiness of `while (message = connection.read)`