#ruby - 01 June 2018
« Back 1 day Forward 1 day »
[01:31:19] havenwood: eam: interesting: https://github.com/ankane/the-ultimate-guide-to-ruby-timeouts#nethttp
[01:47:21] eam: maybe in my copious free time I can send over a version that opens the socket nonblocking and selects
[05:22:29] sparc: I think that should be zero, but even according to https://ruby-doc.org/core-2.1.8/Process/Status.html
[05:34:49] ruby[bot]: sparc: we in #ruby do not like irccloud.com, it has no syntax highlighting, distracting formatting and loads slowly for most. Please use https://gist.github.com
[05:38:53] sparc: I have both, i'm just specifying the full path to /bin/false, because I don't know if %x is going to send the command through a shell
[06:41:07] b100s: hi2all; is there reason to use return? e.g. `def foo return 'foo' end;` or `def foo 'foo' end`.
[10:25:46] Furai: Hey, is there a way to tell bundler to install all the stuff locally? the same as "bundle install --path vendor/ruby"? Maybe add it somehow to the Gemfile? I did some quick googling but couldn't find definitive answer. Forgive me if, but I don't understand much of it yet
[10:28:47] dminuoso: Furai: Im not sure what you are asking, since that's precisely what you already mentioned.
[10:40:55] apeiros: "Copy all of the .gem files needed to run the application into the vendor/cache directory."
[10:44:41] Furai: I'm new here, I thought that process like that makes sense: you checkout repo, do `bundle install` and you're done. No need for any extra parameters. By default it seems it wants to install the gems globally, at least on linux. I thought it could be avoided by specifying where to install policy per project, somewhere in Gemfile or something.
[10:45:56] apeiros: that will depend on how you installed ruby. if you installed ruby to have gems for all users, then bundler will do that too iirc. I haven't had a non-user ruby in a long time so I'm not entirely sure.
[10:46:41] havenwood: Furai: I don't like that this is the case, but Bundler's --path is a "remembered" flag. Once set, it'll persist in your .bundle/config as the BUNDLE_PATH.
[10:47:19] havenwood: Furai: Bundler will install to $GEM_HOME if you don't pick a path, so you can just set that where you'd like.
[10:48:42] apeiros: as dminuoso & havenwood said, you can tell bundler to install gems not system-wide.
[10:50:10] havenwood: Furai: It's normal in dev to install gems from multiple projects to GEM_HOME, then use prefixing `bundle exec` or setting RUBYGEMS_GEMDEPS=- to use just the gems specified in the Gemfile.lock for a particular project.
[10:50:42] havenwood: Furai: You don't have to have them in different locations to ensure you get exactly the right versions for the project.
[10:51:39] havenwood: Furai: It's true you checkout a project and just run `bundle install` or just plain `bundle` is the same.
[10:52:00] havenwood: Furai: Then to make sure you're using exactly and only the gems from the Gemfile.lock, prefix commands with: bundle exec
[10:52:49] dminuoso: Furai: Think about responsibilities. It may make more sense to defer this to the user.
[10:53:05] dminuoso: Furai: That is, if the user wants to install them locally thats their decision. Dont pin a specific installation path to your project.
[12:02:08] arne: i mean if i write a xml doc with nokogiri i would like to get the same value out that i put in, don't i?
[17:37:07] Sylario: I have a net/http error and I am not sure if it is from my code or from my system (I also asked on #rubyonrails) : https://stackoverflow.com/questions/50648477/i-cannot-use-http-net-on-my-dev-machine
[17:56:14] headius: the size/count feature was added relatively recently and you need to explicitly populate it everywhere you enumeratorize
[18:02:04] havenwood: headius: maybe to sanity check your size? that's the only reason I can think of. otherwise it totally makes sense to just optimize it to the know size
[18:04:05] eelster: Zarthus: the size of `int` in C isn't standard. You can find out how big it is on your system by compiling and then running this program https://hastebin.com/fahapazohu.c
[18:05:19] eelster: Or you should probably use "%lu" instead of "%d" in the specifier, but it doesn't really matter as the number isn't going to be that large, but that's bad practice on my part.
[18:06:33] headius: our count aggregates with an int...now should I change it and have some weirdo report it as a bug?
[18:12:57] dminuoso: eelster: the size of int in C is well defined. `int` is (historically) at least as large as a short.
[18:13:01] Zarthus: >One takes for granted that integers will be promoted into bigints in Ruby when needed.
[18:14:16] dminuoso: headius: Heh yeah. I frequently see int promotion as a primary problem for optimizations. :(
[18:15:47] dminuoso: `int` is basically an antiquated `int_fast16_t` but the meaning was never enforced well
[18:18:30] dminuoso: headius: Why not go the speculative optimization route? HotSpot and Graal do this rather well
[18:18:52] dminuoso: I mean if you use the hotspot technique, then the deopt trap becomes just a simple load
[18:19:02] headius: at this point we get a lot of that magic for free by just running JRuby on Graal
[18:20:07] headius: so yeah we lean on deopt and safepoints heavily in standard JRuby, and the VMs are starting to catch up with what we need
[18:25:27] headius: aw man is there no bundle viz that doesn't require all the gems to be installable?
[18:46:38] michaelmeep__: Is there a replacement for `xargs file` in ruby? (I.e parsing a file type without relying on the extension?)
[18:59:58] michaelmeep__: I initially gem install filemagic (which oddly requires rails) instead of gem install ruby-filemagic
[19:01:55] Eiam: There has been a file command in every UNIX since at least Research Version 4 (man page dated November, 1973). The System V version introduced one significant major change: the external list of magic types. This slowed the program down slightly but made it a
[19:03:31] apeiros: tbqh, I still think abandoning the metadata part of files was a stupid move by apple
[19:05:07] apeiros: but yes, resource forks was the way the used to store metadata. and xattrs is not the same. that's bound to the FS, not the file. it's not transported.
[19:06:14] Eiam: i did an analysis a year ago cause I had to and most places I looked had default support for xattrs or were heading in that direction..
[19:06:30] apeiros: so if you have special tooling maybe. that's great, so 0.001% of all ways to transmit files support it. awesome :-p
[19:07:16] apeiros: but yeah, great, so only ~20y after having dropped metadata, we finally get a part of it back
[19:07:55] Eiam: headius: I like to think of magic numbers as being magical to people when they first discover their existence
[22:12:12] aruns: Hi, does Ruby provide anything by default for creating and maintaining user sessions?