#ruby - 19 March 2016
« Back 1 day Forward 1 day »
[00:30:14] Nikesh: Radar: Ah thanks, taking a look. I didn't install it on this machine, it's a Vagrant box that someone else built
[01:22:43] bronson: I'm getting times from an FTP site... The times have my local time zone, but it's clear they're actually GMT.
[01:23:07] bronson: Can't figure out how to just force an existing Time to switch its zone, but leave everything else alone.
[04:43:53] clorisu: whats the difference between a method and an action? (eg 'home' in 'def home end' inside a controller)
[05:14:13] pipework: clorisu: An action is an instance method on a controller that is public. One could assume any defined methods on a controller class are actions, but they'd be wrong, which is sad. It's essentially a controller method that's usually routable.
[05:56:27] xybre: clorisu: in Ruby, technically nothing, but "actions" are called by the Rails framework.
[08:10:33] ruby[bot]: noService: https://www.ruby-toolbox.com is a website which lists lots of gems, topically organized
[08:20:04] Ox0dea: clorisu: It's ill-advised to try to learn Rails before you have the rudiments of Ruby.
[10:05:43] ruby[bot]: +bb ohaibbq_!*@*$#ruby-fix-your-connection *!*@2601:643:8100:fdf1:fcc9:395b:8974:eb45$#ruby-fix-your-connection
[10:41:03] tobiasvl: to be pedantic (since you're askin): they're called parameters btw, not arguments ;)
[10:41:20] tobiasvl: parameters are in the method definition, arguments are the values that are passed to the method when called
[10:41:53] nano-: drbrain: Humm.. just built rdoc from git, and installed via moving to pkg directory in rdoc after rake package, and issuing "gem install --local rdoc-0.borked.gem". I still see the problem of missing constants if I include both .c and .rb files.
[10:49:58] nano-: drbrain: not sure how to tell if it conflicts with my system wide installed rdoc though.
[11:29:43] nano-: drbrain: I just hacked my system wide installed one with your changes and that worked fine. Would be nice to know how to let the ~/.gem/ installed rdoc take precedence though.
[11:51:18] djellemah: And just for fun, a pfind to go with pmap https://gist.github.com/djellemah/cbc1d350547f043c1b70
[12:06:05] ruby[bot]: +bbb $a:ohaibbq$#ruby-fix-your-connection ohaibbq!*@*$#ruby-fix-your-connection *!*@2601:643:8100:fdf1:c65:fdec:ac1f:ee74$#ruby-fix-your-connection
[12:06:08] ruby[bot]: -bbb *!*@gateway/web/freenode/ip.18.104.22.168$#ruby-banned cwong_on_irc*!*@*$#ruby-fix-your-connection phreakocious!*@*
[14:03:04] thegunbuster: Hey I'm having trouble with a C extension. What happens is that on running repeatedly the performance goes downhill really fast
[14:04:30] thegunbuster: Gen: https://rubygems.org/gems/pcg_random Source: https://github.com/vaibhav-y/pcg-random
[14:15:24] Hanmac: thegunbuster: i think https://github.com/vaibhav-y/pcg-random/blob/master/ext/pcg_random/pcg_seed.c#L87-L98 might need to optimised, so you have the '+' and '*' stuff done in C without funcall, i think that would make it a bit faster
[14:16:15] thegunbuster: I agree, but I don't think that is the core problem (although it is one part of it)
[14:18:34] thegunbuster: Here's the gist: https://gist.github.com/vaibhav-y/2c06e87ee1f0d9cd0a05 The format is: method \n time
[14:19:41] thegunbuster: It starts with comparable performance and then just dives into trenches unknown
[14:22:46] Hanmac: hm my first idea is to find a way to keep the creation of ruby objects inside this functions at a minimum (Fixnum do not count) ... same goes for funcall ... means a good way would be to have the unpack in c too if possible
[14:23:58] thegunbuster: ok, I'll try that first. I have an idea for replacing the funcalls but pack would be hard (since I can't call ruby's pack_unpack() )
[14:41:29] Hanmac: thegunbuster: how can i build the libpcg lib so it can be used with your ruby gem? because i get "relocation R_X86_64_PC32 against Symbol `pcg_advance_lcg_64' can not be used when making a shared object; recompile with -fPIC"
[14:59:58] Hanmac: thegunbuster: yeah i got it working (shitty code) and now i need your "new_seed_bench.rb" for testings
[15:04:12] thegunbuster: I didn't use benchmark because it seemed to take too long to run. Here's the bench: https://gist.github.com/vaibhav-y/ae2b152e3bbbd93060d7
[15:04:40] thegunbuster: I had to fallback to that ^ because it was taking so long to run 1k iterations :/
[15:05:39] thegunbuster: hanmac, how so is there some issue with the pcg_random lib itself? like some random numbers taking longer than others to get generated ?
[15:06:05] thegunbuster: I check the source for pcg, it's just reading /dev/random, so I don't think it should be slow at all D:
[15:07:02] Hanmac: thegunbuster: hm no i am not there yet, i only think that pcg (the c lib) is shitty to build
[15:54:54] arup_r: I have some API's from which I will pull data into my app.. What gem is good to use?
[15:59:54] pipework: arup_r: It was a joke. You have API's but haven't described the transport, the payloads, the serialization, anything about them.
[16:12:11] pipework: slash_nick: Net::HTTP requires patches for security that are a lot more hacky than the fixes for faraday which are, by and large, wholly compatible between versions of faraday. go figure.
[16:12:54] slash_nick: pipework: wow i think i'd like to learn more about that... standard net/http has unpatched vulnerabilities?
[16:27:36] pipework: Slow goings, but I'm working on a nice gem for configuring TLS in clients and servers for things like mutual auth and cert pinning. Others are supported too.
[16:28:01] slash_nick: arup_r: i have no doubt... as i said, i'd like to learn more about that... did you find something?
[16:28:23] pipework: Too many of the people I've worked for ask for it. Actually every single one for more than a few years back, come to think about it.
[17:35:43] ceej: afternoon. is PStore thread safe? if you're running unicorn with multiple process, what happens if each process is trying to write to the same file?
[17:37:37] ceej: I'm basically wanting to cache html templates that are created when the files are initially loaded. I'm just using File right now with flock
[17:44:05] nohitall: hi, can someone explain to me what the p is in front if this example "p Resolv.getaddress "www.ruby-lang.org"" ?
[17:45:08] forcer: nohitall: Kernel::p, a method that prints its arguments to stdout: http://ruby-doc.org/core-2.2.2/Kernel.html#method-i-p
[17:45:37] nohitall: ceej: I dont have ruby installed and all online interpreter failed to load resolv :/
[17:49:12] nohitall: /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- Resolv (LoadError)
[17:52:21] nohitall: well no clue about online interpreter, maybe they dont allow require, I tried ideone & co, none worked
[18:28:28] nohitall: didnt try yet, didnt find anything about that yet, only how to use '' and system
[18:31:32] nohitall: I only have to use ruby because some script I need uses it and I have to adapt it, dont want to spend days learning ruby, as shitty as that sounds, so thanks for the help
[18:31:34] Papierkorb: nohitall: have a look at the rest-client or the typhoeus gem. If all you want to do is doing a simple GET request and get its body, try rest-client first.
[18:32:06] Papierkorb: nohitall: Well then, do you want to capture the output from curl, or just call it?
[18:33:30] nohitall: pretty sure there are better ways etc. but understanding all that probably takes a bit of time
[19:26:58] nohitall: in some examples they use '' instead of "", also in my script it uses ''. but then ruby breaks and I have to replace with "" to make it work
[19:30:54] ruby[bot]: nohitall: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[19:42:57] nohitall: what I never understood with dev stuff, why everybody has to use different words for same things
[19:44:25] forcer: Mainly because they're usually not really the *same* things, just similar. And A being similar to B, and B being similar to C, does not mean that A is similar to C.
[19:59:17] forcer: I was looking for RSS feeds or feed aggregators about ruby, but found mainly RSS feed parsers and generators :-D planetrubyonrails seems dead, too. Are there any around still?
[20:37:08] a11: Is there anyway I could simplify this? https://gist.github.com/anonymous/d6037a4b4b7e278d7ff5
[20:42:01] tobiasvl: not sure why the feelings are sets when they only contain unique feelings anyway
[20:42:30] a11: tabiasvl: sorry, it's something that people would use as an insult back from when i was in high school
[20:45:08] a11: there won't be duplicates in either the criteria or input. that's why i chose to go with sets
[21:13:02] shevy: you end up having some weird ' ' space characters all over the place just to indent properly
[21:15:03] a11: shevy: new hash syntax..you mean : instead of hash rocket; did you mean the script was terse or my ? about hashes?
[21:15:10] pipework: a11: I usually just sort the keys automatically and align by the first character.
[21:15:54] pipework: For hashes that span more than one line, I put the first key on a new line indented 2 spaces in and then follow with each after that, closing with a paren.
[21:46:45] Nuck: There was a blog post a few weeks ago talking about the fact that every gem seems to pull in their own HTTP library and it's stupid, but I can't find it right now. Anyone know the one I'm talking about
[21:48:46] Nuck: If nobody knows the blog post, I'd be interested to hear thoughts on how to best handle HTTP in a gem without resorting to pulling in something like Typoheous or using a crappy wrapper like open-uri
[21:50:22] Nuck: rik: Always use MD5(password) without salt or pepper, and never use HTTPS. I redirect HTTPS to HTTP, just to be sure
[21:51:50] RIK: i'm debating throwing the site behind a certificate, and using HTTPS so that I can transmit the password unhashed, but still encrypted in flight.
[21:52:05] ruby_newbie: I have 2 subprocesses, one has to check if another one is still runing and respawn if necessary
[21:52:26] Nuck: If you hash on the client, you have to expose your pepper to the client *and* you can't reasonably salt it
[21:55:02] Nuck: At the very least it's probably better than anything you can come up with, since it's been battle-tested on the billions of websites which use it
[21:55:34] havenwood: nuck: then send your MD5s via JWT (alg: 'none'): https://gist.github.com/havenwood/3b98192d6122a4c9b1a4
[21:56:31] havenwood: ruby_newbie: maybe worth taking a look at what eye or some of the other process monitors in Ruby are doing: https://github.com/kostya/eye
[21:56:32] RIK: i don't need to use http auth, i'm using SSL. I can just use an app-level pretty login. that'll work nicely.
[21:57:11] havenwood: speaking of mperham: https://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/
[21:58:03] Nuck: It was already good advice thanks to systemd, but now with Docker it's 500x more relevant
[21:58:30] al2o3-cr: why require 'base64' when pack('m') is encode64 and/&& pack('m0') is strict_encode64 go pack them boxes
[21:59:00] Nuck: One command per docker container, logging to stdout/err, with all log aggregation handled by the Docker daemon
[22:02:41] Nuck: But the benefit of having all daemons log to stdout and respond to sigint and sighup in standard ways... it's huge!
[22:06:18] forcer: nuck: A lot of the recommendations for 12factor apps are useful even outside of the web context. Not sure why that is not general best practice yet. :-)
[22:06:53] Nuck: forcer: I think one of the problems is that 12factor was, for a while, kinda hard to do without expensive stuff like Heroku
[22:07:39] Nuck: The expansion of Docker (especially the recent improvements in their networking system) has brought Heroku-quality deployment to the masses
[22:08:09] Nuck: I can now hook up AWS CodeDeploy w/ GitHub and have it do a downtimeless deploy of some docker container
[22:08:41] al2o3-cr: all these gems (bar) c extension is fucking possible in ruby alone. further deepness like the pacific ocean...
[22:09:09] havenwood: al2o3-cr: I need RFC 4648 not RFC 2045. Also TIMTOWTDI and `.pack('m').chomp("\n")` doesn't seem as clear to the reader.
[22:09:20] forcer: Though you can do some of that stuff - log to stdout, config via environment, etc. - quite easily with systemd already. I keep telling people writing new-style daemons for systemd is ten times easier than anything before, but I keep getting blank stares. :-D
[22:09:32] Papierkorb: nuck: Well it basically "connects" docker machines to act as one, right? Well, try to remove a node from that set up at runtime.
[22:09:51] Papierkorb: nuck: Or see what happens when a node just dies how long it takes docker swarm to notice
[22:10:45] Nuck: (incidentally, I'm gonna be using ECS w/ docker-compose for deploying this app I'm working on)
[22:10:51] Papierkorb: nuck: Why on earth can I add a node, at runtime, but not remove one? There's nothing a provider can "fix" in there.
[22:11:26] Nuck: Papierkorb: Eh, it's young. I'm sure they'll fix it soon enough. I mean, remember that until like December they didn't even have real networking support in Docker
[22:12:29] Nuck: forcer: I've been pushing for systemd for years. But Docker is so much better for deployments. I can write a Dockerfile for a rails app in all of 1 line
[22:12:45] Papierkorb: nuck: Let's just say, with all of dockers faults, docker swarm is the most disappointing part of our deployment stack. Good thing it's not in production yet and we can actually wait
[22:13:28] Papierkorb: Consul: Great. Docker: well .. don't look harsh and it will work (it may however eat your virtual memory, and your kittens, if you're not careful).
[22:14:33] Nuck: Papierkorb: Docker works great in my experience, as long as you avoid the recent additions. Compose is mature enough that I trust it, but Swarm is extremely young, and rather novel
[22:15:44] Papierkorb: Yeah the docker base stuff is *mostly* okay-ish (although they sometimes break the API). But their response time on severe issues is really through the roof
[22:16:38] Papierkorb: There are plenty issue tickets, like memory leak ones, which have threads longer than a novel from affected people, yet you're lucky to see even one response from a Docker Inc. person
[22:17:18] Nuck: Sure it's important for the docker daemon to be fast and concurrent, so Go or Erlang is a good fit
[22:19:36] Papierkorb: nuck: Consul is written too in Go, but tbh my guess is that the HashiCorp guy just wanted to get experience with Go, which atm is everywhere in "micro services" land for some weird reason
[22:20:25] Nuck: Go is honestly great for concurrent and distributed systems, since it's mostly a rehash of Erlang
[22:22:22] Nuck: Papierkorb: Frankly I think Go was the right choice for the daemon, but wtf why not use Ruby or (dare I say it) Python for the client, for Swarm, for basically anything except the data-shuffling bits!?
[22:23:08] Papierkorb: nuck: A too small one for what they do with Docker Engine, Docker Swarm, Docker Machine, Docker kitchensink
[22:25:53] Nuck: Papierkorb: They're trying to build a whole ecosystem around Docker, but I think they may be going too wide. I think Docker+Compose+Swarm+Hub+Machine is all you really need
[22:26:48] Papierkorb: I get why they're trying, but IMO having a few products which really work well and are stable and everything is superior than having tons of products which are lacking in the QA department
[22:27:24] Papierkorb: nuck: Huh iirc Docker Machine was their linux distribution to quickly deploy swarm servers, Boot2Docker is afaik its own thing?
[22:27:56] Nuck: docker-machine is also able to provision remote servers just as easily as it provisions a VM
[22:29:55] Nuck: It's kinda like how CouchDB managed to keep their git repo when they joined Apache instead of switching to SVN
[22:49:30] mallu: can you please tell me why I am getting out 'true" instead of the parameter I passed in? https://gist.github.com/anonymous/59934caf63b090b82e55
[23:01:26] adaedra: To tell it that the -a/--ami option takes an argument, otherwise it's just a boolean switch