« Back to channel list

#ruby - 23 January 2018

« Back 1 day Forward 1 day »
[00:00:32] dtzuzu: has joined #ruby
[00:01:16] Fridtjof: has joined #ruby
[00:02:45] jtdoncas_: has joined #ruby
[00:04:09] konsolebox: has joined #ruby
[00:10:40] jaequery: has joined #ruby
[00:11:17] Dykam: has joined #ruby
[00:12:21] roshanavand: has joined #ruby
[00:13:36] mtkd: has joined #ruby
[00:14:20] bronson: has joined #ruby
[00:14:25] priodev: has joined #ruby
[00:15:42] RushPL: has joined #ruby
[00:15:54] claw: has joined #ruby
[00:16:29] apeiros: has joined #ruby
[00:17:04] guacamole: has joined #ruby
[00:17:05] guacamole: has joined #ruby
[00:19:50] eckhardt: has joined #ruby
[00:20:32] dstrunk: has joined #ruby
[00:23:42] jamiejackson: has joined #ruby
[00:23:59] tcopeland: has joined #ruby
[00:25:12] jeffreylevesque: has joined #ruby
[00:25:59] eckhardt: has joined #ruby
[00:26:09] Daemen: has joined #ruby
[00:32:52] catphish: apeiros: i think i've fixed it, embarrassingly after 12 hours of debugging, i believe it was nginx's client write timeout, not a timeout i've ever run into before
[00:33:14] catphish: the client was just hanging receiving the http stream while it did other IO
[00:34:17] apeiros__: has joined #ruby
[00:38:17] sanscoeur: has joined #ruby
[00:39:35] workmad3: has joined #ruby
[00:46:03] alfiemax: has joined #ruby
[00:49:23] jnyw: has joined #ruby
[00:49:36] alfiemax_: has joined #ruby
[00:53:06] darkhanb: When I compile and install Ruby 2, how can get a list of standard modules that didn't get installed?
[00:53:16] x77686d: has joined #ruby
[00:53:42] bmurt: has joined #ruby
[00:55:14] alex``: has joined #ruby
[00:56:26] catphish: i don't know if there's a way to do that, but it's pretty rare that anything is missing in my experience
[00:57:37] darkhanb: for example, when I "make", one of the lines are: configuring gdbm Failed to configure gdbm. It will not be installed.
[00:58:36] ren0v0: has joined #ruby
[00:58:36] darkhanb: I believe if I installed: apt-get install -y libgdbm-dev, it would've succeded
[01:00:47] catphish: yeah, that makes sense there are a couple of things you can miss out on, i don't know how to get the full list, maybe examine the output of configure
[01:00:51] cdg_: has joined #ruby
[01:01:06] catphish: openssl is the other obvious one :)
[01:03:57] darkhanb: yea, I can examine the make output and install those libraries then re-make, I just thought maybe there was a way other than this
[01:04:05] darkhanb: catphish thanks for response
[01:04:46] catphish: there might be i'm afraid i don't know, maybe someone else has a better answer
[01:04:55] chmurifree: has joined #ruby
[01:14:45] riskish: has joined #ruby
[01:15:05] bronson: has joined #ruby
[01:17:19] crankharder: has joined #ruby
[01:18:04] jaequery: has joined #ruby
[01:24:10] Fenhl: has joined #ruby
[01:26:57] jottr: has joined #ruby
[01:26:57] milardovich: has joined #ruby
[01:30:44] jottr_: has joined #ruby
[01:35:42] roshanavand: has left #ruby: ()
[01:43:01] bmurt: has joined #ruby
[01:43:43] alfiemax: has joined #ruby
[01:45:05] veduardo: has joined #ruby
[01:49:16] roshanavand: has joined #ruby
[01:52:29] milardovich: has joined #ruby
[02:04:00] Dark_Arc: has joined #ruby
[02:08:56] camfowler: has joined #ruby
[02:15:58] imode: has joined #ruby
[02:18:10] mtkd: has joined #ruby
[02:22:19] vichib: has joined #ruby
[02:24:52] gothicsouth: has joined #ruby
[02:25:11] xuyuheng: has joined #ruby
[02:39:03] camfowler: has joined #ruby
[02:40:25] workmad3: has joined #ruby
[02:41:36] orbyt_: has joined #ruby
[02:42:41] dstrunk: has joined #ruby
[02:43:40] alfiemax: has joined #ruby
[02:43:49] gizmore|2: has joined #ruby
[02:45:05] headius: has joined #ruby
[02:45:48] howdoi: has joined #ruby
[02:50:46] jsaak: has joined #ruby
[02:53:51] pastorinni: has joined #ruby
[02:55:14] phate408: has joined #ruby
[02:59:25] jrafanie: has joined #ruby
[03:00:21] cadillac_: has joined #ruby
[03:02:20] guardianx: has joined #ruby
[03:12:44] darkhanb: has joined #ruby
[03:14:24] cagomez: has joined #ruby
[03:16:26] bronson: has joined #ruby
[03:16:35] JusticeFries: has joined #ruby
[03:18:03] x77686d: has joined #ruby
[03:18:47] cdg: has joined #ruby
[03:21:59] consti: has joined #ruby
[03:26:46] ptx0: has joined #ruby
[03:39:21] Nicmavr: has joined #ruby
[03:45:30] LenPayne: has joined #ruby
[03:45:39] ur5us: has joined #ruby
[03:46:53] rabajaj: has joined #ruby
[03:52:58] LenPayne: has joined #ruby
[03:53:27] guardianx: has joined #ruby
[03:58:18] mjolnird: has joined #ruby
[03:59:32] cdg: has joined #ruby
[04:03:21] jrafanie: has joined #ruby
[04:06:41] bmurt: has joined #ruby
[04:12:05] JusticeFries: has joined #ruby
[04:14:28] nowhereman_: has joined #ruby
[04:22:46] neo95: has joined #ruby
[04:23:55] neo95: has joined #ruby
[04:24:31] neo95: has joined #ruby
[04:25:42] justinfaler: has joined #ruby
[04:35:44] gix-: has joined #ruby
[04:38:53] armyriad: has joined #ruby
[04:41:18] workmad3: has joined #ruby
[04:42:07] alfiemax: has joined #ruby
[04:46:43] xuyuheng: has joined #ruby
[04:47:47] Emmanuel_Chanel: has joined #ruby
[05:00:36] cdg: has joined #ruby
[05:02:01] Yzguy: has joined #ruby
[05:13:52] Fezzler: has joined #ruby
[05:17:18] bronson: has joined #ruby
[05:19:43] cadillac_: has joined #ruby
[05:21:42] dkphenom: has joined #ruby
[05:28:01] dnmeir: has joined #ruby
[05:30:30] dnmeir: /amsg Attention! If you are using FreeNode, consider that you *must* obey scientific, political and historical beliefs of a small group of people that own that private network, otherwise you will be restricted access, read more: https://gist.github.com/anonymous/0f9852b8aaf409c626d117cc8c9aaa2f
[05:30:31] dnmeir: /amsg Attention! If you are using FreeNode, consider that you *must* obey scientific, political and historical beliefs of a small group of people that own that private network, otherwise you will be restricted access, read more: https://gist.github.com/anonymous/0f9852b8aaf409c626d117cc8c9aaa2f
[05:30:34] dnmeir: /amsg Attention! If you are using FreeNode, consider that you *must* obey scientific, political and historical beliefs of a small group of people that own that private network, otherwise you will be restricted access, read more: https://gist.github.com/anonymous/0f9852b8aaf409c626d117cc8c9aaa2f
[05:32:18] xuyuheng: has joined #ruby
[05:33:25] rabajaj: has joined #ruby
[05:36:57] sidx64: has joined #ruby
[05:37:15] xuyuheng: has joined #ruby
[05:38:17] maum: has joined #ruby
[05:40:18] sidx64: has joined #ruby
[05:41:52] crankharder: has joined #ruby
[05:43:14] havenwood: !spam dman[m]
[05:43:14] ruby[bot]: +bb dman[m]!*@*$#ruby-banned *!*@gateway/shell/matrix.org/x-brpjewgqrslyjbrp$#ruby-banned
[05:43:15] ruby[bot]: ruby[bot] kicked dman[m]: is a bannable offense, see http://ruby-community.com/pages/user_rules
[05:45:11] aupadhye: has joined #ruby
[05:46:23] ur5us: has joined #ruby
[05:46:48] audy: I don't get it
[05:49:32] ChanServ: +o havenwood
[05:49:41] havenwood: -b dman[m]!*@*$#ruby-banned
[05:50:14] ChanServ: -o havenwood
[05:50:28] alfiemax: has joined #ruby
[05:54:47] alfiemax: has joined #ruby
[05:56:18] aguestuser: has joined #ruby
[05:56:52] dinfuehr: has joined #ruby
[05:57:10] nowhereman_: has joined #ruby
[06:01:37] cdg: has joined #ruby
[06:04:04] oleo: has joined #ruby
[06:08:48] alfiemax: has joined #ruby
[06:19:37] Dimik: has joined #ruby
[06:21:33] alfiemax: has joined #ruby
[06:24:08] crankharder: has joined #ruby
[06:27:49] LocaMocha: has joined #ruby
[06:33:35] sidx64: has joined #ruby
[06:35:06] LocaMocha: has joined #ruby
[06:38:16] ndrst: has joined #ruby
[06:41:02] ndrst: has joined #ruby
[06:41:33] darkhanb: has joined #ruby
[06:45:29] noocx: has joined #ruby
[06:46:16] noocx: can someone help me with this? https://pasteboard.co/H4dpWTT.png
[06:47:04] noocx: can you tell me please what are these strategy files, how can I create and use them and where can I learn about it?
[06:47:32] noocx: its openproject, rails based
[06:53:44] nso95: has joined #ruby
[06:54:21] nso95: has joined #ruby
[06:54:24] jokester: has joined #ruby
[06:54:42] sidx64: has joined #ruby
[06:55:17] audy: noocx: maybe this? https://lorefnon.me/2015/01/03/leveraging-strategy-pattern-in-rails.html
[06:55:30] noocx: audy: thank you
[06:58:02] audy: noocx: I think these are kind of like helpers for handling different form types?
[06:58:33] noocx: maybe, I don't know, got some basic rails knowleedge, but I'm a total newbie
[06:58:53] noocx: neither know ruby, only some basic things
[06:59:07] audy: noocx: you know any other object oriented language?
[06:59:12] noocx: but what do they do in the model folder?
[06:59:23] noocx: if they are form helpers
[06:59:27] audy: noocx: not sure why they're in the model dir
[07:00:23] noocx: there are custom fields in openproject with some fix types, I think these are the types
[07:00:33] EvilJStoker: has joined #ruby
[07:00:42] noocx: so you can create a custom field and you need to choose a defined type for it
[07:01:07] noocx: you choose from these custom values
[07:01:12] audy: noocx: sometimes people stick classes in the model dir even though they're not Models. The CanCanCan lib uses an Ability model to define user permissions that goes in models/
[07:01:41] trautwein: has joined #ruby
[07:02:00] noocx: audy: ok its clearer now thanks
[07:02:03] crankharder: has joined #ruby
[07:02:28] znz_jp: has joined #ruby
[07:02:33] noocx: I've got 1 hour to understand openproject's structure, learn ruby and rails and write a plugin:D
[07:02:57] noocx: how should i reach this?:D
[07:03:35] sidx64: has joined #ruby
[07:03:41] nso95: Time travel
[07:04:19] jtdoncas: has joined #ruby
[07:04:42] noocx: am I right if I say this openproject doesnt follow the proper rails way to solve things?
[07:05:17] KeyJoo: has joined #ruby
[07:06:20] noocx: or this is how a complex rails app looks like?
[07:06:36] audy: noocx: I think sticking things in models/ that don't inherit from ActiveRecord is probably not 100% rails way since they can just go in lib/
[07:06:38] darkhanb: has joined #ruby
[07:06:48] audy: noocx: but a lot of people seem to do it so maybe it's a popular convention
[07:07:10] noocx: hm thanks, I learned something now:)
[07:07:11] sidx64: has joined #ruby
[07:07:15] dionysus69: has joined #ruby
[07:07:36] audy: noocx: do any models include these classes? maybe then it makes sense
[07:08:11] audy: noocx: classes that are included into models are now called "concerns" but that's a relatively new thing in rails
[07:08:28] jtdoncas_: has joined #ruby
[07:08:37] noocx: this op uses 5.0.6 rails or something
[07:08:57] audy: noocx: this could have been added long ago before rails 5
[07:12:10] conta: has joined #ruby
[07:12:49] sidx64_: has joined #ruby
[07:15:25] sidx64: has joined #ruby
[07:18:16] bronson: has joined #ruby
[07:21:05] dionysus69: has joined #ruby
[07:22:10] dionysus69: has joined #ruby
[07:24:21] noocx: audy: can you tell me something about line 152? https://pasteboard.co/H4dKazY.png
[07:24:37] noocx: its the view helper
[07:25:03] noocx: where should I look for that Openproject::CustomFieldFormat ?
[07:25:51] audy: noocx: not sure. I usually use the_silver_searcher to find stuff like that
[07:26:32] audy: noocx: https://github.com/opf/openproject/blob/225be7608b3c24747030b9f0f64d910260f82d98/lib/open_project/custom_field_format.rb#L32
[07:26:51] noocx: cool thank
[07:31:06] noocx: what is the config/initializers folder for?
[07:31:18] audy: noocx: it's for initializers ;)
[07:31:38] audy: noocx: usually it's for setting up other gems
[07:31:42] ur5us: has joined #ruby
[07:31:49] kies: has joined #ruby
[07:32:22] audy: noocx: setting options
[07:32:38] audy: noocx: what's your plugin?
[07:32:51] audy: why do you only have an hour to write it?
[07:33:00] noocx: cause i ran out of time
[07:33:19] audy: procrastination?
[07:33:21] noocx: but i wont be able to do this, so
[07:33:49] noocx: yes, something like that and i dont have the knowledge to finish this
[07:36:29] noocx: need to create a plugin which gives some custom fields where you can select data from an external database, need to show dynamic dropdowns with related data on form, etc
[07:36:56] noocx: and you need to be able to use this as a new custom field in openproject
[07:37:11] andikr: has joined #ruby
[07:37:12] audy: noocx: is the external database delivered via API or a separate SQL database?
[07:38:23] noocx: with 3-4 connected tables
[07:38:45] audy: noocx: hmm.. never used multiple DBs with Rails. There's probably a way to connect certain models to certain DBs
[07:39:04] noocx: and you need to be able to add these fields from those tables to a task for example in op
[07:39:29] noocx: yes, that part is easy
[07:39:56] audy: noocx: I would probably create an API endpoint on the app that's running the separate database and then do the rest with javascript + jquery
[07:40:22] audy: .. and not touch much in openproject outside of the views
[07:40:48] noocx: additionally openprojects uses angular
[07:41:07] audy: ah. then I'd use angular instead of jquery maybe
[07:41:15] audy: but still not touch the other app's database directly
[07:46:39] noocx: Ive got zero knowledge with angular too:/
[07:47:10] noocx: and additionally they tell me how to do things, so I think I cant make it that way how you suggest
[07:47:35] audy: noocx: is the other DB another rails app?
[07:47:44] noocx: no, its some php thing
[07:48:02] za1b1tsu: has joined #ruby
[07:48:02] audy: noocx: if the php app's DB schema changes, now you have to update two apps
[07:48:14] noocx: but they messed that up too:D
[07:48:34] noocx: cause they wanted me to just read some data, forget consistency etc
[07:50:11] noocx: they need autocompletion with existing data and additionally they want to be able to add new! data in openproject, but not in the source db..
[07:50:33] noocx: but they want to see the new data to when someone creates a new task or something:)
[07:50:42] noocx: so its a messy thing
[07:50:50] keyjoo_: has joined #ruby
[07:50:52] audy: noocx: so they want the PHP app to read OpenProject's DB as well?
[07:51:03] noocx: thats the point
[07:51:13] noocx: thats why its messy, and cant be solved that way
[07:51:25] noocx: so you cant write back to the source db
[07:51:45] noocx: neither can store in rails db
[07:52:13] noocx: i mean the fields what you need to select from at task creation
[07:52:30] noocx: cause you read that data from the source db
[07:53:50] amatas: has joined #ruby
[07:54:06] Hobbyboy: has joined #ruby
[07:55:21] noocx: ok i lost the project(out of time):D
[07:55:28] noocx: anyway, thanks for your help
[07:58:31] claudiuinberlin: has joined #ruby
[08:10:30] Mia: has joined #ruby
[08:10:31] Mia: has joined #ruby
[08:10:55] KeyJoo: has joined #ruby
[08:12:30] ghoti: has joined #ruby
[08:13:28] TomyWork: has joined #ruby
[08:14:44] burgestrand: has joined #ruby
[08:16:54] aufi: has joined #ruby
[08:18:01] dionysus69: has joined #ruby
[08:21:33] skweek: has joined #ruby
[08:21:59] crankharder: has joined #ruby
[08:23:39] nofxx1: has joined #ruby
[08:23:54] Axsuul: has joined #ruby
[08:24:21] conta: has joined #ruby
[08:24:42] cdg: has joined #ruby
[08:25:20] mark_66: has joined #ruby
[08:32:04] apeiros: has joined #ruby
[08:33:38] mlehrer: has joined #ruby
[08:34:42] rahul_bajaj: has joined #ruby
[08:36:22] _main_: has joined #ruby
[08:37:00] aero-224: has joined #ruby
[08:37:21] _main_: has joined #ruby
[08:38:47] rabajaj: has joined #ruby
[08:41:32] rahul_bajaj: has joined #ruby
[08:42:54] workmad3: has joined #ruby
[08:43:02] bruce_lee: has joined #ruby
[08:43:33] nowhereman_: has joined #ruby
[08:45:47] yohji: has joined #ruby
[08:46:33] alfiemax: has joined #ruby
[08:48:19] alfiemax_: has joined #ruby
[08:51:36] mjolnird: has joined #ruby
[08:58:48] mtkd: has joined #ruby
[09:04:23] careta: has joined #ruby
[09:04:56] thejamespinto: has joined #ruby
[09:05:15] jenrzzz: has joined #ruby
[09:05:15] jenrzzz: has joined #ruby
[09:05:15] nadir: has joined #ruby
[09:05:34] careta: hey guys, I'm using Process.spawn to start this "java -DdebugTrial='ohc' -cp MainClass 'df -h'". However, when using ps to look at what is run, it looks like Ruby is exec'ing without the single quotes
[09:05:55] careta: how can I force it to keep the single quotes when invoking the command?
[09:07:38] mlehrer: has joined #ruby
[09:07:41] za1b1tsu: has joined #ruby
[09:09:48] alex``: has joined #ruby
[09:10:58] crankharder: has joined #ruby
[09:11:33] apeiros: careta: single quotes are evaluated by the shell. they are never really part to what your executable sees.
[09:11:37] sidx64: has joined #ruby
[09:11:44] apeiros: cf. running: ruby -e 'p ARGV' -- -DdebugTrial='ohc' -cp MainClass 'df -h'
[09:13:25] careta: apeiros, but this makes a big difference when invoking programs ; if you pass something between '' the shell will interpret that as a single argument
[09:13:39] apeiros: but it will not pass the quotes
[09:13:45] apeiros: and hence ps won't see it either
[09:13:47] careta: while if I do it within ruby, even including the shell, the quotes will not be preserved, but running on the command line will
[09:14:36] faces: has joined #ruby
[09:15:09] careta: apeiros, to make things simple - how can I invoke the process in ruby in the same way I do it in the shell?
[09:15:40] careta: because if I invoke using the same command line args as in the shell, it will get passed as multiple arguments to the callee, instead of a single one
[09:16:32] apeiros: spawn("java -DdebugTrial='ohc' -cp MainClass 'df -h'") will invoke it exactly the way it'd be invoked when running `java -DdebugTrial='ohc' -cp MainClass 'df -h'` in the shell
[09:17:08] apeiros: you not seeing the quotes in ps is you having wrong expectations. you won't see the quotes in ps if you invoke java this way directly either.
[09:18:15] apeiros: has joined #ruby
[09:19:13] conta: has joined #ruby
[09:19:23] rabajaj: has joined #ruby
[09:19:47] bronson: has joined #ruby
[09:20:44] helpa: has joined #ruby
[09:21:36] careta: apeiros, ok I see. But any idea why this works when called from the command line, but not from ruby, with the exact same command?
[09:21:47] dtzuzu: has joined #ruby
[09:21:58] apeiros: no. mainly because "does not work" is not at all a helpful problem description.
[09:22:23] apeiros: a likely cause is a different env than the env a login shell has.
[09:23:49] careta: the Java class parses the first argument given on the command line; for example with java -DdebugTrial='ohc' -cp MainClass 'df -h', the Java class will see the last arg as 'df -h'. But when calling from ruby, it's only seeing 'df'
[09:24:00] rabajaj: has joined #ruby
[09:26:09] InfinityFye: has joined #ruby
[09:27:33] naprimer2: has joined #ruby
[09:30:17] Mike11: has joined #ruby
[09:33:38] InfinityFye: has left #ruby: ("Leaving")
[09:34:10] tomphp: has joined #ruby
[09:34:58] alfiemax: has joined #ruby
[09:37:20] tomphp: has joined #ruby
[09:37:46] apeiros: careta: I can't tell you why that is. if I run e.g. `spawn("ruby -e 'p ARGV' -- -DdebugTrial='ohc' -cp MainClass 'df -h'")`, I get ["-DdebugTrial=ohc", "-cp", "MainClass", "df -h"] as output. i.e. "df -h" is passed as one argument.
[09:38:19] alfiemax_: has joined #ruby
[09:39:55] yohji: has joined #ruby
[09:40:11] apeiros: I think there's one part of the equation missing in your description
[09:41:32] jenrzzz: has joined #ruby
[09:41:52] tomphp: has joined #ruby
[09:44:42] guille-moe: has joined #ruby
[09:45:38] tomphp: has joined #ruby
[09:55:28] tcopeland1: has joined #ruby
[09:57:49] Beams: has joined #ruby
[10:01:11] tomphp: has joined #ruby
[10:02:59] tvw: has joined #ruby
[10:03:36] Serpent7776: has joined #ruby
[10:08:00] yohji: has joined #ruby
[10:08:20] alfiemax: has joined #ruby
[10:08:32] mkaito: has joined #ruby
[10:08:50] jenrzzz: has joined #ruby
[10:13:08] crankharder: has joined #ruby
[10:14:17] jenrzzz_: has joined #ruby
[10:18:55] Cavallari: has joined #ruby
[10:19:25] marr: has joined #ruby
[10:26:33] vichib: has joined #ruby
[10:26:50] shorberg: has joined #ruby
[10:27:06] jnyw: has joined #ruby
[10:35:18] xuyuheng: has joined #ruby
[10:43:46] workmad3: has joined #ruby
[10:45:50] ldnunes: has joined #ruby
[10:45:54] ltem: has joined #ruby
[10:48:36] sidx64: has joined #ruby
[10:50:30] minas: has joined #ruby
[10:50:40] ur5us: has joined #ruby
[10:58:07] bkxd: has joined #ruby
[11:03:58] mtkd: has joined #ruby
[11:04:36] roshanavand: has joined #ruby
[11:07:18] yohji: has joined #ruby
[11:08:04] cdg: has joined #ruby
[11:08:27] roshanavand: has joined #ruby
[11:10:24] guille-moe: has joined #ruby
[11:12:14] marahin: Hello! What is the most elegant way to parse 60010 to be 600.10, 600 to become 6.00, 50 to become 0.50?
[11:12:25] marahin: (So an integer or a string into a decimal number with two point precision)
[11:12:58] marahin: "#{num/100}.#{num%100}" is the basic one, but it will parse 500 into 5.0 instead of 5.00.
[11:13:02] apeiros: so you mean "60010" and not 60010?
[11:13:25] apeiros: wait… so you also mean the output should be "600.10" not 600.10?
[11:13:30] apeiros: (those differences matter)
[11:13:38] crankharder: has joined #ruby
[11:13:46] apeiros: 60010 -> Integer
[11:13:49] leitz: has joined #ruby
[11:13:52] apeiros: "60010" -> String
[11:13:53] bkxd: has joined #ruby
[11:14:03] apeiros: 600.10 does not exist and is really 600.1 -> Float
[11:16:42] apeiros: ACTION waits for clarification before answering
[11:16:55] tvw: has joined #ruby
[11:19:58] bkxd_: has joined #ruby
[11:20:49] bronson: has joined #ruby
[11:22:07] RougeR: has joined #ruby
[11:23:40] TvL: has joined #ruby
[11:25:54] apeiros: marahin: ok, >10min and not a blip. I'll assume you aren't actually interested in an answer. it's rather rude, though.
[11:26:10] marahin: apeiros I'm very sorry!
[11:26:23] marahin: I threw a question and expected a highlight, as most of the messages here are the join/part ones :(
[11:26:36] apeiros: you got an immediate response…
[11:27:05] marahin: Well, twelve seconds were enough for me to jump into ruby docs again and look for a formatting methods :)
[11:27:24] marahin: I'm sorry again, really didn't mean anything, just tough morning where I'm struggling to focus.
[11:27:42] apeiros: ACTION notes to self to highlight even immediate replies.
[11:27:59] marahin: apeiros input is integer, output could be either float or string (basically anything that can be later casted 'to string', and will be in format of INTEGER_PART.TWO_DECIMAL_POINTS)
[11:28:18] apeiros: well, two decimals isn't float. that's string.
[11:28:27] apeiros: so: int.fdiv(100) will get you the float
[11:28:44] apeiros: `"%.2f" % float` will get you the string with two digits
[11:28:50] marahin: You're correct I suppose. What I mean is that I want to get a number containing two numbers after the integer part.
[11:28:59] marahin: Yeah, that's what I managed right now
[11:29:00] apeiros: >> num = 60010; "%.2f" % num.fdiv(100)
[11:29:01] ruby[bot]: apeiros: # => "600.10" (https://eval.in/940668)
[11:29:11] marahin: sprintf("%0.02f", "#{amount / 100}.#{amount % 100}".to_f
[11:29:18] marahin: this is what I'm having now, and it seems to work fine
[11:29:23] marahin: but I'm wondering if there's any nicer solution :P.
[11:29:38] apeiros: `"#{amount / 100}.#{amount % 100}".to_f` is a rather expensive way of saying `amount.fdiv(100)`
[11:29:52] marahin: that's correct, I'm gonna change that :)
[11:30:44] apeiros: `sprintf format, *args` is the same as `format % args`. I use both. matter of preference. but yeah, that's what I'd use to get the representation you're looking for.
[11:31:47] marahin: I'll stick to sprintf, but it's nice to know that
[11:31:58] marahin: thank you apeiros, I really didn't mean to be rude
[11:32:10] apeiros: it's ok. I'll remember to highlight.
[11:34:25] plexigras: has joined #ruby
[11:51:08] shorberg: has joined #ruby
[11:54:03] shorberg: has joined #ruby
[11:59:39] qba73: has joined #ruby
[11:59:54] shorberg: has joined #ruby
[12:02:33] tomphp: has joined #ruby
[12:04:35] belmoussaoui: has joined #ruby
[12:07:53] nadir: has joined #ruby
[12:16:24] milardovich: has joined #ruby
[12:17:19] yohji: has joined #ruby
[12:17:25] crankharder: has joined #ruby
[12:19:00] JusticeFries: has joined #ruby
[12:20:27] JusticeFries: has joined #ruby
[12:21:02] boshhead: has joined #ruby
[12:21:50] jottr_: has joined #ruby
[12:22:02] creeg: has joined #ruby
[12:22:41] mtkd: has joined #ruby
[12:23:15] ahuman: has joined #ruby
[12:24:25] Nilium: has joined #ruby
[12:30:55] cdg: has joined #ruby
[12:31:36] audy: has joined #ruby
[12:31:52] Guest47493: has joined #ruby
[12:32:18] hurricanehrndz: has joined #ruby
[12:32:29] qba73: has joined #ruby
[12:32:43] segy: has joined #ruby
[12:33:16] careta: apeiros, I've been living in hell for hours now, trying to understand what is going on. All I know is that the command started from the terminal works fine, but when started by ruby it doesn't. I've even edited the Java class to make sure the arguments received are the same, and they are the same.
[12:33:31] careta: so if you have any idea let me know
[12:33:41] careta: maybe some encoding problem?
[12:33:43] careta: black magic?
[12:36:02] apeiros: that's difficult to remote debug. since you managed to rule out argument differences, the remaining main culprit is env differences.
[12:36:16] apeiros: your login shell usually executes a lot of scripts when starting, loading various env variables
[12:36:22] careta: apeiros, I'm going to make a full pastebin to show you. I've even dumped the env, and they are the same
[12:36:31] apeiros: Kernel.spawn however will be a mostly pristine shell
[12:37:00] apeiros: same env and same args, yet still different results. that's weird.
[12:37:20] raynold: has joined #ruby
[12:47:01] careta: apeiros, Jesus Christ, all I needed was a sleep 5
[12:47:07] careta: 4 hours wasted
[12:48:10] apeiros: wait, what?
[12:48:44] apparition: has joined #ruby
[12:48:53] apeiros: what's the purpose of the sleep? wait for the subprocess to terminate?
[12:51:25] ur5us: has joined #ruby
[12:51:32] careta: apeiros, it's because the java command actually starts a server, and as you know java is pretty slow, so takes a while to startup
[12:51:52] careta: the remote host was trying to connect straight away because I did a detach
[12:52:10] careta: and then sending another request - basically the remote host was trying to connect while the java server was still starting up
[12:52:20] careta: so putting a short delay after invoking the java process sorted it out
[12:55:37] VladGh: has joined #ruby
[12:57:58] apeiros: careta: well, it a plain sleep you'll eventually run into timing issues
[12:58:17] sepp2k: has joined #ruby
[12:58:47] sidx64: has joined #ruby
[12:59:17] crankharder: has joined #ruby
[12:59:48] jrafanie: has joined #ruby
[13:07:37] troulouliou_div2: has joined #ruby
[13:07:57] alfiemax: has joined #ruby
[13:11:38] synthroid: has joined #ruby
[13:13:03] synthroid: has joined #ruby
[13:13:07] aufi_: has joined #ruby
[13:15:16] burgestrand: has joined #ruby
[13:16:29] jaruga: has joined #ruby
[13:17:53] nowhereman_: has joined #ruby
[13:21:05] arne: has joined #ruby
[13:21:08] arne: don't you guys think
[13:21:14] arne: there should be a shorthand for
[13:21:21] arne: method { x }
[13:21:31] arne: dminuoso: so meany
[13:21:46] bronson: has joined #ruby
[13:21:51] sidx64: has joined #ruby
[13:22:00] dminuoso: arne: strictly speaking there is a shorthand.
[13:22:07] dminuoso: method(&callable)
[13:22:12] dminuoso: which lets you avoid the explicit block
[13:22:22] arne: well but callable would be
[13:22:27] dminuoso: proc/lambda
[13:22:33] dminuoso: or anything that implements #to_proc
[13:22:33] arne: ->() { x }
[13:22:47] dminuoso: arne: Yeah but you gain a lot of expressivitiy if you stop using blocks.
[13:22:55] dminuoso: blocks are a kind of silly feature if you think about it a while.
[13:23:06] arne: i like them, best thing about ruby
[13:23:12] arne: i want something like $ in haskell
[13:23:13] dminuoso: arne: what do you like about them?
[13:23:19] arne: uhm.. fake-dsls
[13:23:40] dminuoso: arne: you dont need blocks to do that.
[13:23:46] dminuoso: you just need appropriate combinators.
[13:24:34] dminuoso: arne: and in the end, is ->{ so much worse than just { ?
[13:24:40] dminuoso: (you dont need () for a noarg lambda)
[13:24:46] sina: has joined #ruby
[13:24:47] arne: for them too be looking good, i do
[13:24:54] arne: dminuoso: i never said
[13:25:01] arne: imho sometimes
[13:25:17] arne: if(pred) something(); looks better than if(pred){something();}
[13:25:18] govg: has joined #ruby
[13:25:32] dminuoso: arne: that is not a block incidentally.
[13:26:04] arne: yes, same principle
[13:26:05] Psybur: has joined #ruby
[13:26:05] Psybur: has joined #ruby
[13:26:16] arne: if there is only one instruction you don't need {}
[13:26:20] arne: same thing for blocks in ruby
[13:26:22] arne: i'd like
[13:26:25] dminuoso: but yeah I agree, that the less noise the better
[13:26:35] dminuoso: arne: and thats kind of my point incidentally.
[13:26:48] dminuoso: arne: because blocks force you to use ugly and non-expressive {}, and you have to specify points
[13:27:05] dminuoso: f { |a| a.first }
[13:27:13] dminuoso: one is more expressive :)
[13:27:50] arne: well you can do do.. end
[13:27:52] arne: which i like
[13:28:27] dminuoso: arne: for a dsl it's fine sometimes I guess.
[13:28:32] dminuoso: for actual coding its not
[13:28:48] dminuoso: arne: also re $, I fully and whole heartedly agree.
[13:29:11] dminuoso: at least (.) can easily be hacked into ruby without much effort
[13:30:24] nfk: has joined #ruby
[13:30:40] govg: has joined #ruby
[13:31:46] dminuoso: arne: regarding your initial question, you can simply write your own combinator for this.
[13:32:37] arne: well it would look more ugly than the original thing, right?
[13:33:12] dminuoso: not necessarily
[13:33:39] bmurt: has joined #ruby
[13:34:46] Voxxit: has joined #ruby
[13:35:45] dminuoso: arne: Oh I know...
[13:36:14] dminuoso: arne: semantically what you want is x itself to be a proc. then you would just pass it.
[13:36:23] dminuoso: (or better yet lambda, since procs are kind of weird)
[13:36:50] Psybur_: has joined #ruby
[13:36:51] dminuoso: arne: but it would require half of ruby to accept lambdas instead of blocks (bringing us back to my original argument that blocks are bad)
[13:37:04] dminuoso: i.e. would be cool if you could do [1,2,3].map(some_proc)
[13:37:56] dminuoso: dunno, but I suspect this must have been discussed already in a PR.
[13:39:41] Psybur: has joined #ruby
[13:40:58] dminuoso: arne: In my library you can even do that, rigged with * to act as (.)
[13:41:03] veloutin: dminuoso: you mean specifically with a proc? [1,2,3].map(&method(:some_method)) does work
[13:41:11] dminuoso: arne: you can do stuff like [1.2.3].map to_s * double
[13:41:24] dminuoso: veloutin: Thats not a proc.
[13:41:27] dminuoso: veloutin: Thats a block.
[13:42:51] JusticeFries: has joined #ruby
[13:45:22] veloutin: right. I was wondering if it was specifically a proc you wanted, or other "callables" would work.
[13:46:59] veloutin: you can avoid [1,2,3].map{|x| some_method(x)} with &method(...), but not [1,2,3].map{|x| some_proc.(x)}
[13:47:50] dminuoso: veloutin: Well once I find some time Im gonna finish my library and publish it. It will contain some fixups to monkey patch most common functions that accept blocks to also work with lambdas instead.
[13:48:22] dminuoso: But ultimately you get into this rabbit hole where this is not truly useful until you have properly curried lambdas everywhere.
[13:49:08] veloutin: coming from a py background, it's definitely wonkier to try to pass callables around in ruby heh
[13:49:45] dminuoso: veloutin: can you curry lambdas in py?
[13:49:53] dminuoso: And I dont mean manually currying them.
[13:50:03] tobiasvl: python lambdas are pretty useless
[13:50:06] tobiasvl: only one statement
[13:50:23] dminuoso: tobiasvl: the one thing python has going for itself is list comprehensions that were ruthlessly stolen from haskell.
[13:50:32] dminuoso: well technically its just mimicing set builder notation from mathematics so...
[13:50:50] tobiasvl: hehe, yep. but stealing things ruthlessly is fine :)
[13:50:55] marr: has joined #ruby
[13:51:14] dminuoso: I dont think there's any "original" language left still in use other than lisp..
[13:51:31] AJA4350: has joined #ruby
[13:51:36] dminuoso: even that could be debatable if you consider LC
[13:52:55] thejamespinto: has joined #ruby
[13:53:27] JamieD: has joined #ruby
[13:53:31] veloutin: dminuoso: there's a bunch of things you can do with callables, including partial(f, arg1)(arg2) === f(arg1, arg2)
[13:54:24] bawNg: dminuoso: you think procs are kinda weird and prefer lambas? I avoid lambdas at all costs since they have different semantics to blocks/procs and are more limiting
[13:54:39] maufart__: has joined #ruby
[14:01:25] k0mpa: has joined #ruby
[14:02:50] cdg: has joined #ruby
[14:03:22] qba73: has joined #ruby
[14:04:39] bawNg: why on earth did someone decide that warning for uninitialized instance variables by default are a good idea? I usually just ignore warnings like that completely, but now that I want to publish a gem, I don't want to just leave them there
[14:05:37] bawNg: seems like a terrible idea, now we have to choose between having stupid warnings being printed, or having worse performance
[14:06:27] dminuoso: bawNg: If object creation is such a bottleneck that you need this optimization, I would consider it highly unlikely for Ruby to be the best language.
[14:06:34] bawNg: accessing an uninitialized ivar is only about 10% slower than an initialized one, but using defined? @ivar to avoid the stupid warning is 16% slower for uninitialied, and 25% slower for an initialized ivar
[14:06:49] dminuoso: bawNg: Why not simply initialize it./.
[14:07:12] dminuoso: bawNg: The point is not to use `defined?`, in fact it rarely is a good idea to do so.
[14:07:18] dminuoso: The point is to make initialization explicit.
[14:07:19] bawNg: alternatively, you'd have to create the ivar when the object gets created, which means adding the overhead of setting an ivar for every object initialized, even if the ivar only gets used on 0.0001% of those kinds of objects
[14:07:46] bawNg: again, this is just a pointless performance loss for the sake of saving some bad programmer who forgot about their variable some time
[14:07:50] dminuoso: asm>> class C; def initialize; @f = nil; end; end
[14:08:01] dminuoso: bawNg: Have you profiled the code with initializers? =)
[14:08:06] bawNg: I'll just rewrite all this in C++ later to avoid the warning
[14:08:09] dminuoso: Or is that your "feeling" ?
[14:08:36] bawNg: dminuoso: I am about to release a scheduler extension which needs to fire timers with 2 us precision
[14:08:42] bawNg: every nanosecond counts
[14:10:13] qba73: has joined #ruby
[14:10:14] dminuoso: bawNg: setinstancevariable is an optimized iseq.
[14:10:27] dminuoso: bawNg: well op rather.
[14:10:30] cdg: has joined #ruby
[14:10:44] bawNg: basically anything in ruby takes time, no matter what it is
[14:10:50] dminuoso: bawNg: It's really negligeble. And anyway, if your performance constraints are that tight, its unlikely CRuby will be your friend.
[14:11:01] bawNg: you can do a lot more from the native side with the C API
[14:11:03] dminuoso: bawNg: Yes, that's because Ruby has really poor implementations.
[14:11:12] bawNg: I know ivars are faster than most things, but they still take time
[14:11:25] dminuoso: bawNg: If you need that tight control over internal execution, go native.
[14:13:35] bawNg: I've already implemented the scheduler's timing, reactor and timer scheduler in C++, and I plan on rewriting most of the ruby code as native later to reduce the remaining overhead
[14:13:46] bawNg: just don't have time to do that right now
[14:14:16] dminuoso: bawNg: Id say setting an instance variable amounts to no more than maybe 100 cpu instructions, its not that much.
[14:15:05] dminuoso: I wonder whether the real price lies in having an explicit #initialize method
[14:15:11] dminuoso: someone should profile this :D
[14:16:03] dminuoso: bawNg: though.. you can also simply ignore it. make a remark that if people want to "ruby -w" your code, they have to live with those warnings.
[14:16:05] rwb: has joined #ruby
[14:16:18] dminuoso: I mean if you have legit reasons to use implicit initializations, then go for it.
[14:16:36] bawNg: I did profile it, and it appears that setting the ivar is ~14% faster than using defined? @uninit, but the big catch is to benchmark it has to repeat the same ivar
[14:16:49] bawNg: so you can't truely measure how long it takes to initialize an uninitialized ivar
[14:17:04] bawNg: it's likely not much faster than using defined?, if it's faster at all
[14:17:08] dminuoso: bawNg: do you already have an initialize method?
[14:17:13] rrutkowski: has joined #ruby
[14:17:18] dminuoso: bawNg: it absolutely is faster.
[14:17:40] bawNg: the thing is, that ivar would almost never get used
[14:18:09] bawNg: so it would make the most sense to leave it uninitialized until it actually is needed in rare cases
[14:18:10] dminuoso: bawNg: the reason has to do with how defined? works, setinstancevariable has almost no indirection and amounts to a few dozens lines of C code.
[14:18:16] dminuoso: but defined? is really really weird.
[14:18:34] dminuoso: bawNg: indeed.
[14:18:41] bawNg: the other big catch is, that is 1 less ivar that I can use
[14:18:49] catphish: has joined #ruby
[14:19:04] bawNg: if you go over like 3 or 4 ivars, the ivars are allocated on the heap instead of inlined in the VALUE
[14:19:13] bawNg: so then the whole object is considerably slower
[14:19:26] bawNg: since there is indirection for the ivar lookups
[14:20:01] bawNg: but it'll be fine for now, I'll reimplement it all in C++ at some point and avoid using ivars completely
[14:20:09] dminuoso: bawNg: Im not very familiar with the internals of Truffle, but you should probably try that as well.
[14:20:26] bawNg: for the timers I store everything in a native struct already, so there is no overhead of having to setup ivars on ruby objects
[14:20:28] jaruga: has joined #ruby
[14:20:53] bawNg: when ruby needs to check something, it makes a native call which checks the struct, which is way more efficient
[14:21:13] rrutkowski: has joined #ruby
[14:21:54] bawNg: I'm only supporting MRI with this extension for now, have no plans on supporting other VMs anytime soon
[14:22:15] bawNg: I personally only use MRI, and I wrote this extension for an open source project based on MRI
[14:22:21] dminuoso: bawNg: Is your project an open source project? Or is it some closed source project?
[14:23:03] bawNg: I'm going to publish the initial alpha as a gem today, just about finished cleaning it up and making it into a gem
[14:23:22] dminuoso: Be sure to give me a ping, interested in what you are writing. :)
[14:23:27] apeiros: "ivar only gets used on 0.0001%" sounds like a bad use case for an ivar
[14:23:28] vichib: has joined #ruby
[14:23:59] Psybur_: has joined #ruby
[14:26:58] DLSteve: has joined #ruby
[14:27:05] rrutkowski: has joined #ruby
[14:27:34] dminuoso: apeiros: Dunno whether frequency is relevant. It's just relevant whether that ivar is part of the objects internal state.
[14:28:49] apeiros: frequency alone is not
[14:29:07] trautwein: has joined #ruby
[14:29:09] apeiros: but if you have a ton of very infrequently used ivars, you might be better off with a single ivar + hash
[14:29:59] apeiros: but if you're after the last little bit of performance, then indeed IMO go native
[14:30:08] Guest47493: has joined #ruby
[14:31:27] Rapture: has joined #ruby
[14:31:33] jaruga_: has joined #ruby
[14:31:49] bawNg: I think I have everything ready to publish the gem now, I don't usually do gems
[14:32:11] bawNg: https://github.com/bawNg/actuator
[14:32:12] apeiros: but kudos for removing all warnings before publishing. wish all gems did that.
[14:32:21] bawNg: dminuoso: ^
[14:32:26] apeiros: I have warnings disabled because too many gems don't :<
[14:32:52] bawNg: well I have gotten very used to ignoring warning completely, but I imagine they annoy a lot of people who actually care about them
[14:33:02] bawNg: to me, warnings serve no purpose what so ever
[14:33:20] bawNg: I've been using Ruby since before there were pretty much any of these warnings
[14:33:20] apeiros: yeah. I think warnings are not thought through.
[14:33:50] qba73: has joined #ruby
[14:33:53] apeiros: I think unused ivar warning exists for over a decade now
[14:34:06] apeiros: *uninitialized
[14:34:21] apeiros: at least I'm pretty sure it was in 1.8.0 when I started using ruby
[14:34:41] apeiros: (I may of course be mistaken, and I no longer have a 1.8 installed to test)
[14:34:43] bawNg: yeah the amount of warnings that I have in a typical large application means that they all just become a blur that my brain automatically ignores and I scroll past
[14:34:58] bawNg: this is the first time I've actually paid attention to warnings in years
[14:35:08] sidx64: has joined #ruby
[14:37:16] apeiros: it'd be nice if we at least could scope warnings and e.g do something like "disable all warnings from 3rd party code".
[14:37:31] amatas_: has joined #ruby
[14:38:24] pwillard: I get this error, and I don't recall changing anything. "C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-4.0.3/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now"
[14:38:56] pwillard: (well, ok "warning")
[14:40:36] shorberg: has joined #ruby
[14:41:35] apeiros: pwillard: changed the ruby version?
[14:41:47] rabajaj: has joined #ruby
[14:42:12] bawNg: had to fight with hoe to get the gem to publish, it doesn't like parsing URLs from a markdown readme
[14:42:23] bawNg: but it's published now
[14:42:30] jrafanie: has joined #ruby
[14:42:41] pwillard: I didn't think I did... changing ruby version is non-trivial, right?
[14:43:07] apeiros: pwillard: depends. for me it's `rvm use <version>`, which I'd say is trivial :)
[14:43:23] apeiros: or even just cd into a project with a .ruby-version file.
[14:43:49] pwillard: I've just never seen that warning before
[14:43:53] bawNg: if anyone needs high precision timers or wants to replace native threads with light weight jobs which run in pooled fibers (along with replacements for common threaded functionality like #join, #kill, sleep, mutexesa nd conditional variables), you can take a look at the repo I linked above
[14:44:06] apeiros: https://github.com/rails/rails/commit/2ce5e08e620c3cfcf1ede3ae26e6faf4e954d2be#diff-5d2e9c268014410b2ee9e86bccbd88db
[14:44:13] apeiros: that's the cause of the warning btw.
[14:44:14] pwillard: gem install activesupport
[14:44:17] apeiros: (looooong fixed)
[14:44:42] rrutkowski: has joined #ruby
[14:44:42] apeiros: bawNg: that actually sounds quite interesting
[14:44:55] bawNg: I created the high precision scheduler specifically so that I can replace hundreds of native threads in an open source project with light weight fibers, the functionality included with the gem allowed me to almost swap out all the threads directly with few additional changes
[14:45:26] workmad3: has joined #ruby
[14:45:42] bawNg: I plan on refactoring the project later, since a lot of synchronization and other overhead is how redundant without native threads, but it's nice to be able to swap things out and have them work with as few changes as possible
[14:45:54] apeiros: bawNg: do you have any benchmarks wrt performance gains?
[14:45:58] bawNg: (the open source project I'm referring to is Sonic Pi)
[14:46:29] bawNg: it no longer supports low end hardware like first and second generation Raspberry Pi's, I hope to be able to change that in the future
[14:47:26] pwillard: Ok. Updating activesupport from 4.0.3 to 5.1.4 made warning go away
[14:47:47] bawNg: apeiros: it's hard to compare performance when there is a ton of overhead in the code base itself, I imagine the performance gain will be reasonable small on high end hardware with the direct port, but once I refactor and remove all the remaining stuff that was needed for threads, it will be considerably faster
[14:48:22] bawNg: I need to optimize the remaining bottlenecks in the code base itself too, but most of that requires heavy refactoring which I need to find time to work on
[14:48:29] xuyuheng: has joined #ruby
[14:51:16] bawNg: also, if anyone here uses OSX and would like to try build the gem and run the tests, I'd appreciate that
[14:51:31] bawNg: I don't have OSX to test with, but I did implement high precision timer support for OSX
[14:51:54] ur5us: has joined #ruby
[14:52:29] dminuoso: bawNg: Ill do that when Im home :)
[14:52:29] rabajaj: has joined #ruby
[14:52:57] bawNg: dminuoso: thanks, just drop me a ping whenever you get around to it
[14:53:04] qba73: has joined #ruby
[14:53:17] apeiros: bawNg: there's no gemspec? o0
[14:53:19] apeiros: oh, hoe…
[14:53:32] rippa: has joined #ruby
[14:53:46] bawNg: yeah I have mixed feelings about hoe, but it works, so good enough
[14:54:16] apeiros: you might want to consider to add a Gemfile, helps developers with getting all dev gems installed
[14:54:35] apeiros: alternatively if it's possible with hoe, a built gemspec, since that can contain dev deps too
[14:54:45] bawNg: I can do that, hoe allows you to generate one to include in a repo
[14:55:01] apeiros: which gems do I need to have installed to build it?
[14:55:12] bawNg: only dependency is minitest
[14:55:24] apeiros: that does not seem correct
[14:55:35] bawNg: well and rake-compiler
[14:55:56] bawNg: well that's a given, haha
[14:56:32] apeiros: ok, rake test is running now.
[14:57:18] bawNg: maybe one day I'll be able to find time to wrap libuv and add IO support to this gem, then I can use it instead of eventmachine for many applications, but I doubt I'll get to that anytime soon
[14:57:21] apeiros: hm, is rake test not self-contained? "Could not find 'actuator' (>= 0) among 118 total gem(s)"
[14:57:47] bawNg: oh damn, I forgot to revert my test change
[14:57:57] bawNg: check the top of setup_test
[14:58:12] bawNg: I'll push a fix for that just now
[14:59:27] apeiros: couple of warnings while building. gist: https://gist.github.com/apeiros/b376d04469b558a8dce9f46fab5ff771
[15:00:13] bawNg: I published a fix for the tests
[15:00:17] tcopeland: has joined #ruby
[15:00:26] oleo: has joined #ruby
[15:00:51] bawNg: I'm not too worried about warnings in the C/C++ compilation, they should all be harmless
[15:01:05] bawNg: I'll try reduce the amount of warning spam when I rewrite more ruby into native
[15:01:23] shinnya: has joined #ruby
[15:02:20] apeiros: that's fine. the tests are expected to take a while to run?
[15:02:50] apeiros: asking because "000000.000 WARN Timer::Schedule() called before delay was set" is the only output for the last 2min
[15:03:16] bawNg: that sounds very broken
[15:03:19] bawNg: are you on OSX?
[15:03:23] apeiros: yes, high sierra
[15:03:33] apeiros: ruby 2.5.0
[15:03:38] bawNg: damn, that sucks
[15:03:52] bawNg: I will have to try figure out why that is broken, without being able to reproduce and test
[15:04:00] apeiros: ctrl-C interrupts at actuator/lib/actuator.rb:11:in `start'
[15:04:08] dminuoso: bawNg: You naughty.
[15:04:14] dminuoso: All those C style casts. :(
[15:04:29] bawNg: I use as little C++ as possible :P
[15:04:40] bawNg: this is the most C++ I've used in years actually
[15:04:51] dminuoso: bawNg: Well if you do, please use static_cast instead. :-)
[15:04:53] bawNg: I can't wait for Jai to be released, so that I can use it instead of C and C++
[15:04:57] dminuoso: C style casts are the best way to hide bugs.
[15:05:57] Gnukpd: has joined #ruby
[15:06:17] bawNg: apeiros: what you can try do for me, is enable debug log level and set a debug log file so that it goes to the file instead of spamming stdout
[15:06:27] apeiros: tell me how and I'll do
[15:06:39] bawNg: the debug log level will spam a lot, but hopefully it'll include something useful, otherwise I'll have to add even more
[15:06:41] ltem: has joined #ruby
[15:06:41] dminuoso: bawNg: Ill send a PR later :)
[15:07:08] bawNg: Log.file_path = "actuator.log"
[15:07:16] bawNg: Log.level = :debug
[15:07:33] bawNg: I didn't test any of that, since I added it just for the gem, hopefully it works :P
[15:08:04] thejamespinto: has joined #ruby
[15:08:10] apeiros: where do I put that code? test/setup_test.rb?
[15:08:38] bawNg: yeah you can just put it at the top after the gem is required
[15:08:42] cagomez: has joined #ruby
[15:09:19] bawNg: Jai is a systems programming language that aims to be a C/C++ replacement that is ideal for game devs, it allows you to write code that is even more efficient than C++, it has no headers, it compiles a full game and engine in 500ms instead of an hour like C++
[15:09:47] bawNg: it has insanely powerful compile-time metaprogramming and polymoric support that puts all other languages to shame
[15:09:53] Guest47493: has joined #ruby
[15:10:01] bawNg: it will hopefully be released by this time next year
[15:10:19] dminuoso: bawNg: I find it very unlikely that an implementation that can compile a full game engine in 500ms to produce more effective code than an equivalent engine written in C++.
[15:10:27] apeiros: uh, Log is native? it raises :D
[15:10:37] bawNg: well it's done, I've been tracking the development of it for a while now
[15:10:38] apeiros: it wants a symbol instead of a string for file_path=
[15:10:45] bawNg: the game engine will be open sourced with the language
[15:10:49] dminuoso: bawNg: Part of the reason why compilation is so slow is just the monstreous optimization passes the compiler has to go through.
[15:11:06] dminuoso: Also, people should stop using C++ and start using Rust.
[15:11:09] bawNg: almost all developers don't write efficient code these days
[15:11:16] darix: dminuoso: c++ templating and stuff makes compile time explode easily
[15:11:19] bawNg: compiler devs are apparently no different
[15:11:32] bawNg: but even C++ vtables are slow due to indirection and cache invalidation
[15:11:36] bawNg: Jai doesn't have that problem
[15:12:31] bawNg: Rust forces everyone to learn new ways of writing code that ensure you can't make a mistake, all the safety introduces overhead and the learning curve of learning all the different ways of doing things requires time
[15:12:53] bawNg: Jai gives you the power to do things however you like, you can be unsafe and break things, there are no training wheels
[15:13:14] dminuoso: You can also do unsafe things in Rust.
[15:13:15] bawNg: but that means that you can write insanely efficient code, which works very well with the CPU caches
[15:13:25] pastorinni: has joined #ruby
[15:13:41] bawNg: Jai will even support transparent SoA out of the box
[15:14:41] dminuoso: darix: I guess its not ideal yeah.
[15:14:53] thejamespinto: has joined #ruby
[15:15:20] dminuoso: If only Rust had higher kinded types.. =)
[15:15:27] bawNg: I'm really excited about a lot of the problems that Jai solves, many of which most programmers and languages don't even consider to be problems
[15:16:16] bawNg: these days writing inefficient software that wastes CPU cycles is just considered normal, hardware is big enough to handle it in many cases, but you could do so much more in so much less time if you actually did things efficiently
[15:16:52] darix: bawNg: all those safety restrictions make your code faster
[15:17:40] bawNg: some do, but many things introduce overhead, and all that overhead adds up
[15:17:47] aonemd: has joined #ruby
[15:18:21] dminuoso: bawNg: I find that a lot of self-proclaimed "game developer experts" have managed to get stuck in the infinite premature optimization trap, thinking too much in terms of "how vtable indirections are expensive".
[15:18:59] bawNg: dminuoso: do you know who Jonathan Blow is?
[15:19:02] dminuoso: Not only do compilers employ devirtualization optimizations, but the actual penalty is really small. It's far more likely that programmers write shit algorithms.
[15:19:09] kapil___: has joined #ruby
[15:19:27] bawNg: he's created almost all of Jai, the engine and the game written in it
[15:19:29] dminuoso: bawNg: Your new hero! :-)
[15:19:39] dminuoso: bawNg: Just like my hero is Simon Marlow!
[15:19:51] bawNg: he created Braid and The Witness
[15:20:06] bawNg: I've never played The Witness, but Braid was a serious work of art
[15:20:21] ruby[bot]: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related topics. Thanks!
[15:20:51] dminuoso: Lets move it to -ot
[15:20:56] darix: lets talk about using mruby in jai engine?
[15:21:28] bawNg: mruby needs some serious optimization because it will be feasible to use it in any large scale game
[15:21:44] bawNg: hopefully it gets a JIT after MRI
[15:21:51] dminuoso: bawNg: 3.0 will get things.
[15:21:58] dminuoso: bawNg: Also truffle has a proper JIT.
[15:22:16] dminuoso: bawNg: But all of this is happening 8 years too late.
[15:22:20] moei: has joined #ruby
[15:22:42] bawNg: I would love to be able to use mruby for game server scripting, I've been using C, C++, C# and SourcePawn for the last 10 years
[15:22:56] bronson: has joined #ruby
[15:23:01] darix: not python?:P
[15:23:03] bawNg: I've been hoping to be able to use mruby since Matz just started working on it, but it's still not fast enough
[15:23:12] arne: dminuoso: interesting.. i get different behaviours for calling a method without arguments
[15:23:15] arne: and just sending it
[15:23:19] arne: i guess you're the right person for that
[15:23:45] dminuoso: arne: got an example?
[15:23:48] bawNg: definitely not python, it's even slower than ruby, and any language which isn't native to the engine is pointless since the overhead of a bridge and serialization is way too much
[15:23:54] arne: dminuoso: not really, it's huge
[15:24:02] arne: it's a class << self;...;end defined class method
[15:24:04] arne: does that matter?
[15:24:16] dminuoso: arne: no. just gist the callsite for both invocations.
[15:24:20] bawNg: I used LuaJIT for one engine a few years ago, not the best language but reasonably fast at least
[15:24:40] dminuoso: arne: note that strictly speaking Ruby doesn't have "class methods". a "class method" is also just an instance method, just on a different class.
[15:24:45] dminuoso: which is why this is really not relevant.
[15:25:02] arne: i know, but it seems to matter
[15:25:04] arne: CPlus::Model::Realm._my_create
[15:25:07] arne: CPlus::Model::Realm._my_create
[15:25:16] arne: CPlus::Model::Realm.send(:_my_create)
[15:25:45] dminuoso: arne: what observable difference do you have?
[15:25:57] apeiros: try __send__ (only matters if somebody has send overwritten)
[15:26:23] dminuoso: Also one possible observable difference is that .send will bypass visibility restrictions. Just in case _my_create is private
[15:26:33] apeiros: also try in reversed order (in case your different result is because you'd also get a different result when calling it twice)
[15:26:50] dminuoso: public_send should be your default
[15:26:59] apeiros: ah right. send will ignore method_missing if a private method is present.
[15:27:49] mtkd: has joined #ruby
[15:27:53] bawNg: #send could have been named better, it gets replaced by IO related methods in a lot of libraries
[15:28:02] arne: weird it works now
[15:28:10] arne: guess i mispelled something
[15:28:11] arne: sorry false alarm
[15:29:33] apeiros: bawNg: agreed. also I still want an Introspection module.
[15:29:51] anisha: has joined #ruby
[15:29:56] apeiros: so you can do stuff like `obj = BasicObject.new; Introspection.ivars(obj)`
[15:30:31] bawNg: how would that be different from #instance_variables?
[15:30:42] nfk: has joined #ruby
[15:30:57] bawNg: apeiros: oh I missed what you said about #file_path earlier, are you sure it rejects a string?
[15:31:45] bawNg: I copied the string check from the ruby core code base, since the STRING_P macro is defined in a different header
[15:32:03] bawNg: (RB_TYPE_P(path, T_STRING) && CLASS_OF(path) == rb_cString) should allow a string
[15:32:17] apeiros: bawNg: yes, I am
[15:32:32] apeiros: actuator/test/setup_test.rb:65:in `file_path=': wrong argument type String (expected Symbol) (TypeError)
[15:32:47] apeiros: that line is `Log.file_path = "actuator.log"`
[15:32:55] bawNg: ah, the symbol check macro must raise an exception if false
[15:33:03] bawNg: that's stupid, I'll figure out what macro just returns false
[15:34:30] bawNg: no, I mean to check if a value is a symbol
[15:35:03] bawNg: looking at the macro in the core, I don't see why SYMBOL_P would raise an exception
[15:35:16] bawNg: that argument type error definitely isn't coming from my code
[15:35:30] bawNg: unless SYMBOL_P returns true on a string too
[15:37:38] apeiros: iirc there was a check macro, SYMBOL_T or T_SYMBOL or somesuch
[15:39:38] bawNg: oh I just made a stupid mistake with the implementation
[15:40:00] xuyuheng: has joined #ruby
[15:40:42] dviola: has joined #ruby
[15:42:55] bawNg: apeiros: I've published and pushed a new version
[15:43:27] aonemd: has joined #ruby
[15:43:37] apeiros: ok, test runs
[15:43:53] apeiros: I'll let it run for a minute, then abort and gist the logfile
[15:44:13] bawNg: you can just kill it when it starts spamming warnings
[15:44:18] bawNg: since that means something is very wrong
[15:45:17] apeiros: meanwhile I'll be having fun generating some ~1KB of plsql from ruby 😵
[15:46:05] mordof: has joined #ruby
[15:46:17] bawNg: plsql does not sound very fun
[15:46:45] apeiros: bawNg: added actuator.log to https://gist.github.com/apeiros/b376d04469b558a8dce9f46fab5ff771
[15:46:50] apeiros: bawNg: it isn't.
[15:47:16] apeiros: something as simple as `some_string.split(" ").include?(word)` is ~30 lines of code. I hate a good bit of it.
[15:47:30] apeiros: and that sql and plsql are two different engines with different capabilities doesn't help either.
[15:48:25] rrutkowski: has joined #ruby
[15:50:16] bawNg: I guess getting the clock time on OSX is failing completely then
[15:50:29] bawNg: I wish I had a mac to test with
[15:50:59] bawNg: do you know if __APPLE__ is defined when you compile an extension?
[15:51:44] apeiros: iirc there are various __DARWIN* flags, but don't really know those eithers
[15:52:05] bawNg: looks like the ruby core source is full of __APPLE__ #ifdefs, so it probably should be defined
[15:52:46] a_duck: has joined #ruby
[15:53:13] rrutkowski: has joined #ruby
[15:54:13] bawNg: I don't see any #ifdef's that include DARWIN in the ruby core source, and the only OSX one is MACOSX_DYLD, which seems like something specific that isn't relevant
[15:54:38] apeiros: eh, I'm probably not the best person to talk with in that regard 0:-)
[15:54:51] bawNg: but it seems most likely that you're somehow compiling without __APPLE__ being defined, since that would explain 0 being returned for the clock
[15:56:16] dminuoso: 16:26 apeiros | also try in reversed order (in case your different result is because you'd also get a different result when calling it twice)
[15:56:16] dminuoso: apeiros: This is so priceless!
[15:56:52] dminuoso: Equational reasoning / referential transparency is priceless.
[15:57:05] yohji: has joined #ruby
[16:01:07] apeiros: dminuoso: hm?
[16:01:18] Afro: has joined #ruby
[16:01:45] apeiros: are you going to tout functional language advantages now? :D
[16:01:52] bawNg: everything points to __APPLE__ being the correct define, I guess I could detect OSX in the extconf and add my own define, but that doesn't seem like the best solution
[16:02:25] dminuoso: apeiros: I would never do that.
[16:02:30] dminuoso: I just subtly hint at them.
[16:03:16] dminuoso: apeiros: Im honestly on the brink of making a PR of Proc#*
[16:03:20] arne: "sublty"
[16:03:30] dminuoso: This should be a thing.
[16:05:08] cagomez: has joined #ruby
[16:05:35] bawNg: apeiros: what compiler are you using? apparently __APPLE__ will likely only work on gcc, clang and intel compilers
[16:05:47] zautomata: has joined #ruby
[16:05:53] bawNg: so your ruby must have been compiled with one of those, but maybe you are compiling extensions with a different compiler?
[16:05:54] zautomata: has joined #ruby
[16:06:02] dminuoso: arne: something like this: Proc.class_eval { def *(f) ->(*args) { self[f[args[0]]].curry[*args[1..-1]] } end; }
[16:06:02] dminuoso: or without the currying
[16:06:02] dminuoso: Either way.
[16:07:06] dminuoso: arne: The non-currying way would be Proc.class_eval { def *(f) ->(*args) { self[f[*args]] } end; }
[16:07:12] dminuoso: Simple and plain function composition.
[16:08:01] zautomata: has joined #ruby
[16:08:14] dminuoso: so: `f * g` in ruby corresponds to `f ◦ g` in mathematics.
[16:08:34] apeiros: bawNg: clang I'd say. whatever comes with current xcode.
[16:09:12] a_duck: i get 'incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError) when using the report_builder gem. Trouble is i'm not sure which files it's got problems with
[16:09:20] apeiros: I installed ruby using rvm. xcode might actually ship with both, gcc and clang. not sure what rvm uses to compile.
[16:09:42] bawNg: hmm, strange
[16:13:02] apeiros: a_duck: not sure whether there was a question hidden in that statement, but it seems to me that your first step should be to narrow the issue down…
[16:13:30] alfiemax: has joined #ruby
[16:13:42] armando1: has joined #ruby
[16:14:17] cagomez: has joined #ruby
[16:15:24] LastWhisper____: has joined #ruby
[16:15:43] a_duck: apeiros: yeah, that was a masquerading questions sorry. i'm trying to narrow it down with pry, but i'm not having much luck
[16:17:13] apeiros: a_duck: if you have the backtrace, just add a begin/rescue binding.pry; end around it
[16:17:36] a_duck: so the stack trace ends in 'erb', which sounds like it's a templating thing? when i enter the debugger there pry doesn't seem to be able to tell me much
[16:20:27] apeiros: do you generally try to give as little information as possible?
[16:20:45] apeiros: and yes, erb is a templating engine
[16:20:49] a_duck: not trying... just not familiar with the environment. sorry.
[16:22:04] lcarlson: has joined #ruby
[16:22:49] qba73: has joined #ruby
[16:24:03] a_duck: https://github.com/rajatthareja/ReportBuilder/blob/master/lib/report_builder/builder.rb#L45
[16:24:51] a_duck: that's where it's failing, if i enter pry just before that line and evaluate get('report').result(binding) i get the encoding error...
[16:26:11] a_duck: but i can't see what binding is or where it comes from
[16:26:30] apeiros: in https://github.com/rajatthareja/ReportBuilder/blob/master/lib/report_builder/builder.rb#L84 check the encoding your template has after reading the file
[16:27:07] apeiros: I'd assume it'll be utf-8. and then you probably have some expression in your template which evaluates to a binary string. so you have <%= some_binary_string %>, and that fails when interpolating.
[16:27:16] apeiros: but just a wild guess due to lack of detailed info
[16:27:23] apeiros: ACTION afk for a bit
[16:27:51] a_duck: great, thanks. i'll take a look. again, happy to give any info i can but i'm mostly in the dark here
[16:28:36] a_duck: the template should be from the report_builder library itself i think, it builds an html report from cucumber test runs
[16:28:50] tlaxkit: has joined #ruby
[16:29:50] apeiros: bawNg: honestly, I think in your place I'd just polish the gem for your use, state in the readme that you'd love to work with somebody on osx compat, but that it's currently not there
[16:30:18] bawNg: apeiros: it's something so small that is needed, will be worth getting to the bottom of it
[16:30:37] troys: has joined #ruby
[16:30:38] apeiros: bawNg: heh, ok. I wish you luck :)
[16:30:39] bawNg: I'm 99% sure that the code in the extension will just work on OSX, if that define was there
[16:31:03] bawNg: so I'll probably just have to detect OSX and add my own define from extconf
[16:31:14] bawNg: it's just shit to not be able to test it myself
[16:31:44] qba73: has joined #ruby
[16:31:44] milardovich: has joined #ruby
[16:31:53] bawNg: but ideally I'd really like to know why __APPLE__ isn't defined on your system, with your compiler
[16:32:01] bawNg: since everything seems to say that it should be
[16:32:12] bawNg: http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#OSXiOSandDarwin
[16:32:55] synthroid: has joined #ruby
[16:32:59] noobineer: has joined #ruby
[16:34:26] synthroid: has joined #ruby
[16:34:32] jottr_: has joined #ruby
[16:38:30] bawNg: apeiros: I added support for the __MACH__ define and made compilation fail if no clock support is found, you can try build it again whenever you get a chance
[16:38:45] bawNg: if that doesn't work, I'll have to just try hack the detection into extconf
[16:44:25] mtkd: has joined #ruby
[16:45:12] bawNg: apeiros: nevermind, I was just being dumb, there was a missing line for OSX that I didn't notice, should hopefully be working now
[16:45:35] dionysus69: has joined #ruby
[16:46:18] workmad3: has joined #ruby
[16:46:54] cagomez: has joined #ruby
[16:49:12] apeiros: bawNg: two green dots
[16:49:24] apeiros: log is being spammed. letting it run :)
[16:50:18] bawNg: oh, you should have probably disabled the log, that will slow it down
[16:51:09] [Butch]: has joined #ruby
[16:51:35] apeiros: oy, "average timer precision is worse than 200 us (707.65 us)"
[16:51:43] apeiros: ACTION hands bawNg a µ
[16:52:05] anisha: has joined #ruby
[16:52:10] bawNg: that's either because your machine is loaded, or the log is slowing it down too much
[16:52:18] bawNg: it'll retry the precision test a bunch until it passes
[16:52:22] apeiros: I restarted without the log
[16:52:34] ur5us: has joined #ruby
[16:52:37] apeiros: and by "loaded", do you mean under heavy load? it's not really. and it's a relatively fast machine.
[16:53:00] apeiros: says >90% idle
[16:53:29] bawNg: well, if theres no CPU time available exactly when a timer is due, the scheduler thread will wake up late, so a moderate load
[16:53:41] bawNg: but that's probably just the log file slowing it down
[16:54:02] leitz: In this bit of code, show_number uses number but is passed nothing. If Receiver.show_number is called on a separate line it fails. Does this mean Receiver.new(num) passes its initialized value to show_number? https://gist.github.com/LeamHall/a645ab94f9ac1cb6963c6829f42a09c1
[16:54:10] apeiros: as said, logfile is disabled
[16:54:29] bawNg: I made the the precision test much more relaxed than it should really be, so that it passes on really low end hardware
[16:54:34] apeiros: and even while running the tests, CPU load is reported as >90% idle.
[16:54:42] bawNg: it passes on a raspberry pi v1, which is really slow
[16:55:03] bawNg: yeah it has a very small footprint, the test should use almost no measurable CPU
[16:55:14] bawNg: most of the CPU used is the ruby code in the test itself
[16:55:15] apeiros: yeah, this machine's 2.9 GHz i7 should definitively beat a raspi
[16:56:06] bawNg: let me know what the precision results are like on OSX with plenty of free CPU time
[16:56:21] bawNg: will be interesting to see if it's better or worse than the clock on Windows
[16:56:58] apeiros: hovers around 700µs
[16:57:12] bawNg: the median?
[16:57:38] bawNg: that seems really high, so either the clock is inaccurate, or the thread sleeping is
[16:57:41] Xiti: has joined #ruby
[16:58:04] apeiros: https://gist.github.com/apeiros/b376d04469b558a8dce9f46fab5ff771
[16:58:19] ogres: has joined #ruby
[16:59:27] bawNg: this is the result on my windows 7 desktop which is reasonably loaded - Total: 5000, Over 1ms: 1, Low: 0.4 us, High: 1172.4 us, Median: 2.2 us, Variance: 20.4 us
[16:59:40] bawNg: my machine is using > 50% CPU constantly
[16:59:55] apeiros: yeah, mine is mostly on idle. so I doubt load is the issue
[17:00:01] bawNg: which accounts for the single sample over 1ms
[17:00:28] apeiros: ACTION afk for a longer time now
[17:01:32] bawNg: thanks for the results, definitely should be better, I'll have to put some thought into it and come up with some more tests for you to run
[17:01:46] bijan_: has joined #ruby
[17:01:51] [Butch]: has joined #ruby
[17:02:36] bijan_: Hey Guys, how do I iterate over all values of a hash that has n-levels of nested hashes?
[17:02:59] bijan_: my_hash.values only gives me toplevel values
[17:03:00] dminuoso: bijan_, what exactly do you want to iterate over?
[17:03:06] dminuoso: bijan_, the leaf values?
[17:03:15] dminuoso: bijan_, is the hash of uniform depth?
[17:03:17] bijan_: yes to the lowest level
[17:03:27] dminuoso: bijan_, do you want to map (i.e. transform) or just iterate for effects?
[17:03:38] bijan_: transform the values
[17:04:15] dminuoso: bijan_, are there only hashes or other containers (Array or other) involved?
[17:04:42] dminuoso: bijan_, also regarding uniformity of depth?
[17:04:56] bijan_: actually I wrote a converter for Rails I18n language files to ember-i18n and this forces me to do some changes on the template strings deeply nested in my hash (that is then exported to json)
[17:05:28] bijan_: hashes that include n-levels of hashes that have ultimate string values
[17:06:09] dminuoso: bijan_, are you on Ruby 2.5?
[17:06:09] bijan_: {"level_1" => {"level_2" => "string_value"}}
[17:06:17] bijan_: Unfortunately 2.3.4
[17:06:40] bijan_: does 2.5 have a nice solution in place?
[17:07:02] dminuoso: bijan_, well Ruby 2.5 does have transform_values which you could trivially use in a simple deep_transform_values method you would have to add
[17:08:12] bijan_: so actually I'll be recursively traversing each "leaf" and as soon as my value is a string I'll do my string-transformation
[17:08:17] bijan_: you would do the same?
[17:08:42] wilbert: has joined #ruby
[17:09:06] orbyt_: has joined #ruby
[17:09:10] guacamole: has joined #ruby
[17:09:11] guacamole: has joined #ruby
[17:09:20] dminuoso: bijan_, yeah - I would just generalize it as focusing on whether its a hash.
[17:09:55] bijan_: okay I thought I might overlook a method in the stdlib but then this is the way to go
[17:09:56] rrutkowski: has joined #ruby
[17:10:20] cagomez: has joined #ruby
[17:10:23] dminuoso: bijan_, in pre 2.5 you can simply use .map you just have to to some .to_h to make it hashes again
[17:11:39] bijan_: http://api.rubyonrails.org/classes/Hash.html#method-i-transform_values <= lets see if this supports deep hashes
[17:12:19] dminuoso: bijan_, it doesn't. Just check the source "show"
[17:12:24] lcarlson: has joined #ruby
[17:12:39] bijan_: dminuoso: they have it for keys o_O
[17:12:42] dminuoso: bijan_, 2.5 just provides a native implementation of that.
[17:12:51] alfiemax: has joined #ruby
[17:12:56] npgm: has joined #ruby
[17:13:10] havenwood: dminuoso: bijan_: nobu did a `recursive: true` implementation that might make it into 2.6
[17:13:27] dminuoso: Ah cool, good to know.
[17:13:51] havenwood: https://github.com/ruby/ruby/commit/b1583b423c3a26ccc22775174315f074bf73553e
[17:14:02] bijan_: Ruby spoiled me so I'm not used to implement those things by myself anymore
[17:15:05] bijan_: I guess I have to step my c-game up again to be able to contribute to ruby core :/
[17:15:22] dminuoso: bijan_, in a way I think it's really bad. There's a lot of great intuition that comes from implementing trivial problems with recursive algorithms.
[17:15:31] dminuoso: Took me so long to wrap my head around `fix`
[17:16:07] dminuoso: And by that I dont mean to say that Ruby is bad, but I think this kind of "looking for a library to solve your problem" kind of does make you forget how simple some problems are.
[17:16:45] bawNg: yeah these days people use libraries for the most simple things that can be implemented with a single line of code
[17:16:45] dinfuehr: has joined #ruby
[17:16:52] reber: has joined #ruby
[17:17:01] dminuoso: bijan_, there's nothing complicated about the C used in Ruby. It's just that the vast majority of Ruby's internals are utterly and completely undocumented.
[17:17:21] cdg: has joined #ruby
[17:17:25] dminuoso: bijan_, So the main effort comes from deciphering what some of the terribly named, non-descript, bad-japanese-english-mix-named things are.
[17:17:45] bijan_: That's true... I wrote lots of Go code until a year ago and starting from then worked ruby and js and now I got burned so many times for implementing something that is somewhere hidden in the batteries anyways
[17:17:57] bawNg: once you get past the names of things, working with ruby from C isn't really that much different from ruby itself
[17:18:10] zipace: has joined #ruby
[17:18:24] bawNg: you work with ruby objects pretty much the same way, everythings just a VALUE in C, just like everythings an objects in ruby
[17:18:35] dminuoso: bawNg, yup. You just have to understand a lot of the subtleties of the various subsystems. For example you have to understand how the GC works exactly in order to now crash things left and right.
[17:18:46] dminuoso: Or what caches exist, and when they have to invalidated and what not.
[17:18:58] bawNg: yeah, handling GC properly is one thing that is easy to mess up
[17:19:18] bawNg: and can be rough to track down, but once you get a handle on it, it's not all that bad
[17:19:37] dminuoso: Indeed. But say modifying the compiler is really easy once you understand what the names mean. :)
[17:19:50] bijan_: Languages that are now implemented in themselves definitely have an edge when it comes to contribution
[17:19:52] cadillac_: has joined #ruby
[17:20:15] bijan_: (looking at go and crystal)
[17:20:26] dminuoso: bijan_, you can only do that if the language has the ability to produce native machine code somehow.
[17:20:40] bijan_: dminuoso: I know...
[17:21:35] eckhardt: has joined #ruby
[17:22:07] ruby[bot]: has joined #ruby
[17:22:07] ChanServ: +o ruby[bot]
[17:22:21] dminuoso: bawNg, "rough" heh. Especially if you crash in completely unrelated code regions. =)
[17:23:20] bawNg: yup, that's when GC usually kicks in, at some completely random time haha
[17:23:56] bronson: has joined #ruby
[17:24:26] dminuoso: It's like when you overflow in a malloc'ed buffer and accidentally overwrite its internal metadata - and it crashes in a completely different code region when some completely unrelated code using the same bucket tries to free, and then bam..
[17:25:11] bawNg: absolute hell to track down
[17:26:36] dminuoso: Not really. You just valgrind it.. :P
[17:26:48] dminuoso: But that requires having something valgrindable, not like Ruby on OSX.
[17:27:12] bijan_: https://github.com/rubinius/rubinius <= ruby written in ruby... kind of
[17:28:17] chrisseaton: bijan_: TruffleRuby has a much higher percentage in Ruby https://github.com/graalvm/truffleruby
[17:28:28] chrisseaton: (Probably depends a lot on how you count it)
[17:28:42] dminuoso: chrisseaton, curious, Rubinius is on your highlight list as well? =)
[17:29:13] chrisseaton: No I was actually here just about to ask a question this time!
[17:29:20] bijan_: Ah I starred truffle ruby on github some time ago but totally forgot it exists
[17:29:40] chrisseaton: Does Ruby have any way to define a 'virtual' global variable? As in it looks like one but you supply your own callbacks to give the value? I'm sure I remember it does, but can't find it now.
[17:29:56] dminuoso: chrisseaton, natively or with a patch?
[17:30:02] dminuoso: If its the latter, then yes.
[17:30:12] chrisseaton: Is the patch somewhere online?
[17:30:12] dminuoso: chrisseaton, set_trace_func
[17:30:15] dminuoso: (Or Tracepoint)
[17:30:23] dminuoso: chrisseaton, yeah in Ox0dea's gists somewhere.
[17:31:49] dminuoso: chrisseaton, he basically rigged the underlying mechanism for those $1 type of variables (which are not really global variables - I think they are called svars)
[17:32:06] chrisseaton: Yeah we're writing something up on all these 'global' variables
[17:32:41] nickjj_: has joined #ruby
[17:32:42] darkhanb: has joined #ruby
[17:34:17] dminuoso: chrisseaton, https://github.com/0x0dea/viva
[17:34:25] dminuoso: oh it was "virtual variables"
[17:34:27] chrisseaton: Thank you very much!
[17:36:16] stormpack: has joined #ruby
[17:36:30] bijan_: dminuoso: I came up with this https://gist.github.com/gobijan/637ed4a65969393d0d9e98ee1742425c what do you thing?
[17:36:56] alfiemax: has joined #ruby
[17:37:31] dminuoso: bijan_, yup. It would be a bit more Rubyish if you tested for .responds_to probably.
[17:37:48] dminuoso: bijan_, also you probably should make this also work with blocks.
[17:38:04] bijan_: dminuoso: that's what I'm currently changing in the code :D
[17:39:29] xuyuheng: has joined #ruby
[17:39:31] bijan_: dminuoso: can you elaborate on the responds_to?
[17:39:40] nickjj__: has joined #ruby
[17:41:29] bawNg: dminuoso: if you ever have a segfault problem, you can always just install neversaydie, haha
[17:41:57] dminuoso: bawNg, oh man its from tenderlove - I dont know whether its a troll repo or not!
[17:42:10] bawNg: I don't think we will ever know for sure
[17:42:11] dminuoso: I remember about this one.
[17:42:25] nickjj: has joined #ruby
[17:42:30] bawNg: I think it's hilarious
[17:42:54] dminuoso: bawNg, oh wait. I remember him talking about this one in one of this troll moments.
[17:43:40] dminuoso: bawNg, maybe Ill write the opposite: HardRealTimeRuby that simply reboots the machine on any exception.
[17:44:08] bawNg: might as well reboot when there is a warning too
[17:44:20] bawNg: ruby warnings are serious business
[17:45:05] dminuoso: bijan_, you could think of "transform_values" as "transform_leaves". So when you're at that point, what would { a: someTreeObj }.transform_leaves { ... } do?
[17:46:45] dminuoso: bawNg, Oh man I remember some old rubyland hacks that would allow you to catch that without a native extension!
[17:46:57] dminuoso: I think you can still do it.
[17:47:18] bawNg: I've seen some really dodgy things built with Pry
[17:47:19] dminuoso: The trick revolved around monkey patching the printing code for the crash dump screen
[17:47:36] alfiemax: has joined #ruby
[17:47:48] dminuoso: apeiros, you remember this?
[17:47:58] nickjj_: has joined #ruby
[17:48:42] dminuoso: It was from some RubyConf a while back IIRC.
[17:49:30] bawNg: I've watched quite a few RubyConf videos over the years, never saw that though
[17:50:05] dminuoso: bawNg, https://www.youtube.com/watch?v=3ROuTjbdkPk
[17:50:12] guacamole: has joined #ruby
[17:50:13] guacamole: has joined #ruby
[17:50:26] dminuoso: bawNg, the first 2 have long been fixed though.
[17:50:37] sanscoeur: has joined #ruby
[17:51:17] apeiros: lol, charlie going to a rubyconf with a php t-shirt
[17:51:31] apeiros: sad he isn't as active in ruby anymore as he used to be
[17:51:34] bawNg: ah, an AU RubyConf
[17:52:34] dminuoso: YouTube thinks that watching Erik Meijers Functional Programming video next is a good thing. Clearly YouTube knows whats best for a programmer.
[17:53:09] apeiros: it's personalized. I get a talk by tenderlove as next video.
[17:53:43] dminuoso: So my focus is on FP, yours is on trolling!
[17:53:55] apeiros: no. puns and cat pictures.
[17:54:06] dminuoso: But its funny, I didnt even pay attention to his t shirt.
[17:54:25] bawNg: apeiros: so I did a bit of research, and it seems like it's possible that the clock returned by that system call on your version of OSX could not be so high precision, but most likely it is the thread sleeping that is causing the precision loss, and it sounds like the only way to solve that is to set the threads scheduling priority to real-time on OSX
[17:54:47] bawNg: but there is conflicting information and benchmark results online, so it's hard to say for sure
[17:56:06] bawNg: the one results show that OSX is more precise with thread sleeps than both linux and windows, and didn't mention anything about thread priority, but the official apple docs say that high priority is needed for good precision, and that more than 500 us without load is considered a serious error with high priority
[17:56:27] bawNg: so that makes me wonder what the expected precision even is with high priority
[17:57:08] bawNg: it seems like solving this will require some testing, trial and error, so I'm probably going to have to just leave OSX with worse precision for now
[17:57:09] apeiros: well, I don't have any idea :D
[17:57:16] apeiros: but I can rerun tests whenever you want.
[17:57:25] bawNg: hopefully someone with OSX can look into it and make a patch for it
[17:57:29] apeiros: that's fine too
[17:57:55] bawNg: otherwise I'll have to put together some tests for you or someone else with OSX to run at some point
[17:58:05] bawNg: remote debugging is never fun
[17:58:28] apeiros: I think it's absolutely fine to make this a contributor thing
[17:58:57] bawNg: maybe dminuoso can have a look at it at some point
[17:59:33] xuyuheng: has joined #ruby
[17:59:46] dminuoso: My knowledge about anything related to OSX is scoped to how ridiculously expensive the new iMac Pro is.
[18:00:23] bawNg: well you have access to OSX, and know C, so you're in a better position than anyone else I know
[18:00:33] bawNg: it shouldn't be hard to solve this, it'll just require some testing
[18:01:08] bawNg: need to figure out if the system call which returns the clock is accurate, and test making the thread real-time
[18:01:18] bawNg: https://developer.apple.com/library/content/technotes/tn2169/_index.html
[18:01:24] dminuoso: bawNg, I wouldn't presume to make a patch in that area when I dont understand the underlying kernel and subsystems at all.
[18:01:43] orbyt_: has joined #ruby
[18:02:58] bawNg: dminuoso: there's basically just 3 things that could be the issue, so I just need test results to figure out which is to blame
[18:04:05] bawNg: either the clock being returned by mach_absolute_time() is inaccurate, which is unlikely. else the thread is not waking up soon enough, and that is either because of the threads priority not being set to real-time, or because the ruby API is not calling the same thing are mach_wait_until() which is documented at the link above
[18:05:40] jeffreylevesque: has joined #ruby
[18:08:58] kies: has joined #ruby
[18:09:23] cdg: has joined #ruby
[18:12:32] GodFather: has joined #ruby
[18:12:57] marxarelli: has joined #ruby
[18:13:34] Mitaka89: has joined #ruby
[18:15:55] Mitaka89: has joined #ruby
[18:18:13] Mitko_: has joined #ruby
[18:20:11] apeiros: got to go. bye :)
[18:21:01] nowhereman_: has joined #ruby
[18:26:41] raynold: has joined #ruby
[18:27:02] dionysus69: I want to include module in a pretty ruby way without require "./someFile.rb"
[18:27:23] dionysus69: and that require line only works if I run the main file from that current dir
[18:27:34] bawNg: require_relative 'some_file'
[18:27:46] dionysus69: I have heard of that too
[18:27:56] bawNg: that is relative to the file requiring, instead of the working directory
[18:27:57] dionysus69: but trying to do something like rails does with autoloading
[18:28:44] bawNg: autoload is commonly used by some gems, it seems easy enough to use, I don't personally ever use it though
[18:28:58] plexigras2: has joined #ruby
[18:29:12] bawNg: I create my own custom loading system for cases where I want dynamic module loading
[18:29:16] dionysus69: ok I ll google around for some autoload, seems worthy of time investment
[18:29:29] dionysus69: I don't like require lines, reminds me of c :D
[18:30:00] dminuoso: dionysus69, autoloading is not rails specificy.
[18:30:11] dminuoso: dionysus69, the ruby you have already has autoloading out of the box.
[18:30:17] dminuoso: albeit a slightly different one, but you have it nevertheless.
[18:30:19] bawNg: autoload is a stdlib yeah
[18:30:40] dionysus69: ok I guess i ll google ruby autoload stdlib x)
[18:31:19] selim_: has joined #ruby
[18:31:30] biberu: has joined #ruby
[18:31:32] dminuoso: bawNg, not stdlib, its in core
[18:31:43] dminuoso: &ri Module#autoload
[18:31:43] `derpy: http://ruby-doc.org/core-2.4.1/Module.html#method-i-autoload
[18:32:00] dminuoso: adaedra, when you find the time, please update to 2.5 :)
[18:32:27] bawNg: oh right, it's literally on module
[18:32:31] bawNg: couldn't be easier to use
[18:32:48] dionysus69: thanks to both of you :)
[18:33:02] dminuoso: dionysus69, however, explicit requires are the way to go nevertheless.
[18:33:12] dminuoso: Personally I consider autoloading to be a kind of misfeature.
[18:33:22] dionysus69: ok fine :D let it be require_relative
[18:33:42] dminuoso: Adding require does not cost much time, but it makes dependencies obvious and avoid weird errors down the road.
[18:34:21] bawNg: yeah, I don't like autoload very much for a bunch of reasons
[18:34:29] belmoussaoui: has joined #ruby
[18:34:38] jeffreylevesque: has joined #ruby
[18:34:50] dminuoso: If only Ruby had a proper module system where you could explicitly export and import symbols..
[18:34:54] nchambers: is there a ruby equivalent to python's twisted?
[18:35:01] bawNg: sometimes implicit module loading in long running modular applications makes sense, but then I end up having to build a full dependency management system along with plugin loading, since with implicit loaded modules, dependency modules and super classes need to be loaded first
[18:35:25] dminuoso: nchambers, EventMachine
[18:35:34] bawNg: I've done exactly that in a few languages over the years, probably at least 4 different times in ruby alone
[18:35:43] dminuoso: nchambers, its a bit more general than twisted.
[18:35:51] nchambers: dminuoso: perfect. thank you!
[18:35:55] nchambers: (general is what I wanted anyways)
[18:36:21] bawNg: EventMachine is your best option for async IO
[18:36:56] bawNg: I'd love to add IO support to my reactor eventually, so that I can use it instead of EM, since EM is not implemented anywhere near as efficiently as it could be
[18:37:15] bawNg: but it's good enough for pretty much any normal use case
[18:37:19] nchambers: yeah, it sounds perfect. thanks guys
[18:37:40] Azure: has joined #ruby
[18:37:49] hfp_work: has joined #ruby
[18:38:03] bawNg: almost all the ruby applications I have built for the last 8 years are EM-based
[18:38:08] kenichi: celluloid::io is a reactor as well
[18:38:39] bawNg: I didn't like celluloid very much when I looked at it years ago, can't remember exactly why
[18:38:43] dminuoso: kenichi, sadly no longer maintained though.
[18:39:05] cadillac_: has joined #ruby
[18:39:18] bawNg: but I have also built so much EM-related code up until this point, that changing to some other reactor doesn't make sense unless it's really worth it
[18:40:14] bawNg: I have monkeypatched more gems than I can count to be EM-based and/or fibered, and I've implemented even more protocols from scratch for EM applications
[18:40:15] kenichi: EM does .. involve itself :)
[18:40:22] dionysus69: in order to use Gemfile/bundler in ruby app, I required rubygems and bundler but still doesn't include gems
[18:40:45] havenwood: dionysus69: Prefix `bundle exec` to your command.
[18:41:24] dionysus69: i am running a file
[18:41:33] dionysus69: ruby main.rb
[18:41:37] bawNg: I personally use require 'bundler/setup'; Bundler.require(:default)
[18:41:41] bawNg: instead of bundle exec
[18:41:47] kenichi: ACTION peeks in #celluloid, hmm 7 people..
[18:41:50] havenwood: dionysus69: https://i.imgur.com/2Hlpoov.png
[18:41:57] jamesaxl: has joined #ruby
[18:42:20] havenwood: kenichi: https://github.com/socketry/nio4r
[18:42:33] dionysus69: bundle exec right, but I am not running a ruby task I am executing a ruby file
[18:42:45] dminuoso: havenwood, sadly rails trains people to not know this by doing this inside that magic shim.
[18:43:05] bawNg: I'd probably just wrap libuv if I ever find the time to add IO support to my reactor
[18:43:07] dminuoso: dionysus69, `bundle exec ruby file`
[18:43:47] bawNg: I wrapped libuv in C# which I use for async IO embedded in game servers and other server-side applications
[18:43:57] bawNg: it's what nodejs is built on
[18:44:56] kenichi: havenwood: ah that's where it got to
[18:45:41] desperek: has joined #ruby
[18:47:08] workmad3: has joined #ruby
[18:47:40] havenwood: It looks like Thribers (not going to be named that) are coming along nicely (they wrap kqueue and epoll): https://bugs.ruby-lang.org/issues/13618
[18:47:47] alfiemax: has joined #ruby
[18:48:07] havenwood: LightThread? HeavyFiber? :-P
[18:48:20] havenwood: Threadlet isn't too bad.
[18:48:31] havenwood: How about Routine?
[18:48:34] guille-moe1: has joined #ruby
[18:48:41] dminuoso: havenwood, they finally decided against that horrid name?
[18:48:42] bawNg: the auto fibers are an interesting idea, maybe if that works out soon enough, I can just use that and not have to implement IO reactor support at all
[18:48:48] dminuoso: It was almost sad.
[18:48:49] havenwood: Kinda like a goroutine without the go.
[18:48:57] havenwood: dminuoso: Yeah, hah.
[18:49:02] havenwood: dminuoso: No Thribers or Freds.
[18:49:08] bawNg: I just want to be able to do IO and high precision timers in a single thread
[18:49:14] dminuoso: havenwood, honestly I would name it "HonestThread"
[18:49:33] dminuoso: Think we had this discussion before where I pointed out that these Thribers kind of already exist in the form of threads (in the context of modern operating systems)
[18:49:39] bawNg: I didn't even want to write my own reactor, but I profiled a bunch of ruby reactors like EM and a libuv wrapper, and they all have insanely bad timer precision
[18:49:40] havenwood: dminuoso: RedThread
[18:49:46] mtkd: has joined #ruby
[18:49:58] dminuoso: havenwood, know what we really need?
[18:50:00] dminuoso: havenwood, STM.
[18:50:17] havenwood: dminuoso: We already have it via JRuby and RedBridge to Clojure! :-P
[18:50:18] dminuoso: though concurrenty-ruby has TVars
[18:50:35] havenwood: I actually have used STM that way, heh. >.>
[18:50:36] bawNg: whatever the name ends up being, it's going to confuse a lot of people
[18:50:36] dwickern: has joined #ruby
[18:50:57] dminuoso: havenwood, kind of reminds me how we planned to bolt our rendering frontend into ruby through .NET through IronRuby.
[18:51:01] ur5us: has joined #ruby
[18:51:08] bawNg: most people already can't wrap their heads about a fiber, now they are going to have to know the difference between 3 different kinds of stack based interactions
[18:51:17] dminuoso: bawNg, no they just have to understand how Threads really work.
[18:51:23] dminuoso: bawNg, a thriber is just a more explicit thread.
[18:51:39] nchambers: does eventmachine have an irc channel?
[18:52:01] dminuoso: It's no different, except the yield point is not implicitly every syscall, but has to be picked explicitly. And there's no preemption.
[18:52:02] bawNg: nchambers: it's never really been active, you can ask here for advice about EM
[18:52:09] nchambers: ok thanks, will do
[18:52:46] dminuoso: bawNg, or rather.. its exactly like threads without preemption (which happens really rarely to be important anyway)
[18:52:55] bawNg: dminuoso: but I mean, fibers are even more simple, in that there is nothing automagically happening at all
[18:53:08] dminuoso: bawNg, with threads most of the time nothing automagic happens either.
[18:53:19] dminuoso: because most context switches are cooperative in form of syscalls.
[18:53:24] bawNg: but a lot of people can't even seem to wrap their heads around how a fiber/coroutine works, including people who use the things
[18:53:41] havenwood: I think Erlang, Haskell, Go and Crystal have shown good use of such a light, green thread.
[18:53:57] TomyLobo: has joined #ruby
[18:54:34] dminuoso: Linux has what, a default timer frequency of 250Hz?
[18:54:47] bawNg: 1 ns precision
[18:54:55] dminuoso: Yeah but by default is preempts every 4ms.
[18:54:57] bawNg: windows is 250ns
[18:54:58] dminuoso: Which is horrid.
[18:55:05] bawNg: OSX is who knows
[18:55:06] dminuoso: For any realtime application
[18:55:31] nchambers: if I'm reading these right: https://github.com/eventmachine/eventmachine/wiki/Code-Snippets, I implement each protocol in a module or class, then in an EM.run block, I connect/run all of the client/servers I want to run?
[18:55:37] dminuoso: And yet you have context switches many dozen times per 4ms.
[18:55:53] dionysus69: bawNg: your bundler require helped a bit but now I get `require': cannot load such file -- pp/room (LoadError)
[18:55:55] eckhardt: has joined #ruby
[18:56:04] dionysus69: i require bundler/setup with Bundler.require(:default)
[18:56:14] dionysus69: and I have pp gem inside gemfile
[18:56:22] bawNg: yeah, games use nano second sleep, which must introduce so much unnecessary overhead with all the context switches
[18:56:34] cdg: has joined #ruby
[18:56:38] justinfaler: has joined #ruby
[18:56:58] bawNg: dionysus69: did you run `bundle` first?
[18:57:01] hahuang65: has joined #ruby
[18:57:02] dminuoso: bawNg, I think software developers should write a toy kernel once.
[18:57:03] dionysus69: yes of course
[18:57:06] dionysus69: there's gemfile.lock
[18:57:09] dminuoso: bawNg, every single one.
[18:57:33] dminuoso: Right until you have a userspace.
[18:57:52] dionysus69: interesting, always wanted to do stuff like that dminuoso
[18:58:08] dminuoso: dionysus69, then do it. There's a buttload of great resources at https://wiki.osdev.org/Expanded_Main_Page
[18:58:09] dionysus69: is there a guide for that?
[18:58:17] dminuoso: dionysus69, and equivalently #osdev here on freenode.
[18:58:42] dionysus69: would give it a shot when I on a sysdev mood xD
[18:58:47] dminuoso: It forces you to completely understand how stuff works. How memory works. How the CPU works. What processes are. How compilers work. How linkers work.
[18:59:06] bawNg: dminuoso: there are some parts of the kernel that should actually be implemented in user space, it's 2018
[18:59:22] dminuoso: bawNg, oh boy. Here comes the "best kernel architecture" discussion again!
[19:00:11] bawNg: large companies like google use network drivers implemented in user space, which minimizes latency and saves on all the copies of buffering the data that the kernel would do, there are a bunch of other advantages too
[19:00:38] bawNg: game servers should be using user space networking, but we're still using kernel space stuff from the 70s
[19:00:45] dminuoso: bawNg, it kind of depends on having a performant IPC architecture.
[19:00:45] WA9ACE: there's also the fact that parsing anything sent from somewhere else in kernel space is inherently dangerous
[19:01:21] bawNg: yeah, security is one of the other big things
[19:01:23] eckhardt: has joined #ruby
[19:01:30] Guest47493: has joined #ruby
[19:01:42] WA9ACE: I mean, Windows had a vuln based on Font loading being done in kernel space
[19:01:49] tomphp: has joined #ruby
[19:01:56] bawNg: the recent major exploits that are currently being patched by all the kernels can compromise networks in a huge way
[19:02:00] OyoKooN: has joined #ruby
[19:02:05] bawNg: that wouldn't be an issue if it was in user space
[19:02:37] WA9ACE: I though spectre and meltdown were a big deal because it meant you could run things in userspace and access memory in someone else's space
[19:03:04] dminuoso: WA9ACE, meltdown is a big deal. Spectre 1/2 kind of depends and is much more limited in the attack surface.
[19:03:10] dionysus69: so what about my error :D cant get gemfile/bundler to import gems in my app :S :D
[19:03:20] bawNg: you can, but it depends on a bunch of factors
[19:03:52] bawNg: the performance loss caused by patching the exploits will affect all software pretty badly
[19:04:19] bawNg: in some cases, over 35% worse performance, just because of heavy use of vtables in C++, and various other things
[19:04:26] WA9ACE: I'm holding out a new mac for when the expandable Mac Pro comes out 2018*
[19:04:35] tAn: has joined #ruby
[19:04:38] WA9ACE: but now I'm not certain I want it if it doesn't use AMD
[19:04:38] bawNg: we basically just lost many years of CPU hardware advances due to the patches
[19:04:48] dminuoso: No we did not lose many years of CPU hardware advances.
[19:05:02] pelegreno: has joined #ruby
[19:05:34] WA9ACE: here's the PoC I saw for reading memory https://www.youtube.com/watch?v=RbHbFkh6eeE
[19:05:42] oleo: has joined #ruby
[19:06:02] bawNg: when software is compiled with the patched compilers, all caches will be invalidated constantly to prevent the exploit, which destroys performance in many cases
[19:06:14] drakko: has joined #ruby
[19:06:15] dminuoso: WA9ACE, yeah that's meltdown. Luckily its trivially fixable from the OS.
[19:06:24] bawNg: when all OS kernels have been patched, that introduces a bunch more overhead
[19:07:10] dionysus69: dminuoso: interesting https://os.phil-opp.com/ :D
[19:07:17] dminuoso: And by trivially I mean that KPTI is implementable - you just lose the benefits of sharing TLB entries when switching to kernel space.
[19:07:34] dionysus69: good way to learn both rust and kernel at once xD
[19:08:08] dminuoso: dionysus69, there are rust related resources on the osdev wiki too.
[19:08:26] dminuoso: dionysus69, and there's some people in #osdev who are working on rust based kernels.
[19:08:26] dionysus69: i did ctrl f rust and nothing popped :S
[19:08:32] dionysus69: ill search deeper I guess
[19:08:51] OyoKooN: Hello there! I got an issue with HMAC. I have to sign a form before sending it to a bank. They only provide an example in PHP. I have a hex key to sign my data. In the PHP exemple, they do `$binKey = pack('H*', $key) before signing the data. Should I do something similar too with my key? I use: `digest = OpenSSL::Digest.new('sha512') ; signature = OpenSSL::HMAC.hexdigest(digest, ENV['HMAC_KEY'], msg)`. Thanks for you help! :)
[19:08:54] dminuoso: dionysus69, you dont really need any specific resources.
[19:09:06] dminuoso: dionysus69, just go through the initial examples and it will very rapidly become obvious.
[19:09:19] dionysus69: kk thanks dminuoso
[19:09:30] dminuoso: dionysus69, I wrote my entire kernel in C++ but didnt need any C++ specific articles. Most of what I needed was readily found in GCC manuals.
[19:10:37] eam: kpti is part of the story, a bigger problem is disabling branch prediction in critical sections
[19:10:46] sameerynho: has joined #ruby
[19:10:48] dminuoso: eam, yeah that's spectre 2 though.
[19:10:55] eam: 1 and 2, yeah?
[19:12:20] dminuoso: eam, mm yeah.
[19:12:48] eam: re: user space drivers above - I haven't seen anyone doing that with network devices. I think it's mostly about USB "drivers" and they're still brokered by the kernel
[19:13:30] eam: I don't think you could implement a high performance network device driver from user space
[19:13:35] dminuoso: eam, Mach for example places network into userspace.
[19:13:35] dionysus69: dminuoso: you just seem more talented :D
[19:14:28] dionysus69: I cant handle dry docs, not enough patience :S I prefer guides xD
[19:14:45] dminuoso: dionysus69, this is part of what makes osdev great. It _forces_ you to read docs. In doing so you become a better developer./
[19:15:16] dminuoso: If I want to understand how things in the CPU work, I know fairly where to look in the intel manuals for example.
[19:15:24] dminuoso: *fairly well
[19:15:38] eam: I wrote a usb device driver in ruby a year or two ago
[19:15:40] dminuoso: I still suck at it, but at least I know where to look =)
[19:15:59] bawNg: eam: there are open source user space network stacks
[19:16:11] dminuoso: dionysus69, and this whole thing translates onto other parts because you begin to learn that everything can be understood. Since then Ruby has stopped being scary.
[19:16:13] eam: sure, but they're not performant
[19:16:16] bawNg: large companies like google use user space stacks almost exclusively
[19:16:33] eam: bawNg: I would be surprised to learn that
[19:16:42] dminuoso: bawNg, care to take this into #osdev?
[19:16:47] dminuoso: bawNg, because I know there's a kernel developer from Google right there.
[19:16:55] dionysus69: they are dissing ruby in #osdev, come help! xD
[19:16:56] Dimik: has joined #ruby
[19:17:25] krawchyk: has joined #ruby
[19:17:29] bawNg: I'd need to figure out where my source for that information came from
[19:17:37] desperek: has joined #ruby
[19:17:43] eam: pushing certain components into userspace can make sense in certain scenarios, but there's basically no chance that the hardware driver is moved there, for example
[19:18:20] eam: for example, when I wrote a USB device driver in ruby it basically just involved reading and parsing data from the bus. Very high level
[19:18:49] eam: not really any different than reading and parsing data from a socket
[19:19:20] dminuoso: Part of the reason why USB drivers are commonly done in user space is because there's tons of idiotic developers out there. So to avoid badly written drivers for gazillion of devices to crash your kernel left and right..
[19:19:42] eam: yeah. In my case, I needed to write something in short order for a custom device
[19:19:45] bawNg: example of why kernel based network stack is bad: https://www.epicgames.com/fortnite/forums/news/announcements/132642-epic-services-stability-update
[19:20:11] dminuoso: eam, okay in your case it's less the "idiotic case" but rather the "I dont have the time to prove correctness of my code"
[19:20:22] eam: oh no, I agree
[19:20:47] eam: it's the same issue from a different angle. I just wanted to take like a week and write something to do a firmware load
[19:20:48] bawNg: also a good example of the CPU performance impact of patching the exploits
[19:21:04] dminuoso: bawNg, honestly - lets take this into #osdev
[19:21:04] eam: for a prototype board
[19:21:15] dminuoso: bawNg, because there's plenty people who could make arguments from experience.
[19:21:21] dminuoso: There's even one of the lead developers of Fuchsia there.
[19:21:28] nchambers: is it possible to run a server with eventmachine and a client from the same EventMachine.run block?
[19:21:38] bawNg: Fuchsia seems promising
[19:22:00] bawNg: nchambers: you can run any number or servers and clients from a single reactor
[19:22:03] eam: bawNg: the penalties of entering kernel space are going to be paid by a userspace networking driver as well (and possibly more than once)
[19:22:08] nchambers: bawNg: ok thanks
[19:22:18] dminuoso: eam, and with KPTI the penalties have gone up considerably. ;-)
[19:22:18] eam: context switching between two processes has the same kind of cost
[19:22:26] bawNg: eam: https://github.com/snabbco/snabb
[19:22:38] dminuoso: eam, I think its a full TLB flush on every syscall now?
[19:23:01] eam: yes, and most people aren't running the newer microcode which will enable the branch prediction hit as well
[19:23:35] eam: so that's an additional whammy
[19:23:49] bawNg: the overhead just keeps piling on
[19:24:11] eam: bawNg: the thing to remember is that these costs exist whether insulating between user/kernel, or user/user
[19:24:39] eam: eliminating separation for performance can speed things up, but you lose the function of a multi-user system
[19:24:45] bronson: has joined #ruby
[19:25:09] eam: and if you're ok with that, heck, just disable kpti and the msr twiddles and go back to how things were
[19:25:39] eam: (and on some servers, that's probably safe to do)
[19:26:08] dminuoso: eam, though I guess you could get away without KPTI if you were in a single user situation.
[19:26:21] bawNg: maybe we really need a mostly-but-not-totally userspace network stack
[19:26:35] dminuoso: But its just a random thought. Really need to ponder on this.
[19:26:36] eam: yeah, if you don't care about leaking information, and a lot of dedicated systems don't, then it's fine
[19:26:47] bawNg: if the kernel could just control handling over connections to a userspace stack, that could take care of the separation
[19:26:49] nchambers: one last question... is there a good guide on how you should structure a ruby project?
[19:27:01] dminuoso: nchambers, if you are unsure, do as others do.
[19:27:06] eam: the real problem are the parts of our software architectures which allow sandboxed remote code execution -- aka javascript in browsers
[19:27:12] nchambers: dminuoso: what do others do?
[19:27:12] dminuoso: nchambers, take any popular project and take inspiration from that.
[19:27:13] bawNg: nchambers: it really depends on the project
[19:27:25] nchambers: I'll just browse around on github then
[19:29:28] glow2: has joined #ruby
[19:30:43] bawNg: eam: well at least you now know that userspace networking can be performant
[19:30:44] John_Ivan: has joined #ruby
[19:30:44] John_Ivan: has joined #ruby
[19:30:48] dminuoso: nchambers, you can take this one: https://github.com/rspec/rspec-core
[19:30:59] dminuoso: It's clean.
[19:31:00] bawNg: I personally didn't know about that open source stack until a couple months ago either
[19:31:16] nchambers: thanks dminuoso. I'll look at that
[19:35:31] rubycoder38: has joined #ruby
[19:36:15] eam: bawNg: kinda. You've gotta realize this isn't a driver that you could effectively use to run an application server
[19:37:10] eam: as I said above there are limited scenarios (like building a router or firewall or other networking device which only pushes packets) where this can make sense, but you wouldn't ever use this to drive the networking stack underlying another application
[19:37:32] bawNg: you could, it may just require some effort
[19:38:00] bawNg: I'm fairly sure companies are using inhouse userspace stacks built on that exact open source toolkit
[19:38:03] eam: if you have a multi-user system, the cost becomes identical or greater
[19:38:14] bawNg: sure, it's not ideal for that use case
[19:39:02] bawNg: but large high performance latency-sensitive services are generally hosted on dedicated hardware, where it would make sense to have a dedicated network stack
[19:39:04] havenwood: rubycoder38: hi
[19:39:23] eam: if it's a service (like a database or an app server) then there's no gain
[19:39:55] eam: these kinds of frameworks are useful if you're doing something like writing say, an SNAT load balancer
[19:40:05] eam: or maybe even a traffic router
[19:40:32] bawNg: if there is a huge amount of throughput, then the gain is in avoiding all that redundant copying for kernel buffers, and all the CPU time needed by the kernel to do that
[19:40:40] rubycoder38: I have an api that returns an array of 'courses', I need to write a script to listen for when new courses are added to the api and after a new one is added I need to send that data somewhere else... I'm a bit confused about how to check for new courses
[19:40:50] rubycoder38: and should I just use a loop?
[19:41:17] bawNg: rubycoder38: what kind of API?
[19:41:27] rubycoder38: this is the api: https://api.eadbox.com/
[19:41:44] bawNg: and what kind of application are you building?
[19:42:48] eam: bawNg: if you're merging your network driver and application into the same process, sure. But if you want to spin up, say, a high performance mysqld you're still going to end up copying between it and your driver regardless of where the driver lives
[19:43:06] dminuoso: bawNg, anyway. To understand why most dont go for userspace stacks requires understanding kernel architecture.
[19:43:22] tomphp: has joined #ruby
[19:43:34] dminuoso: bawNg, in order to make a true userspace stack work fast, it requires a well developed micro kernel architecture with a really low latency high throughput IPC architecture.
[19:43:34] d^sh: has joined #ruby
[19:43:36] rubycoder38: bawNg: it needs to be a standalone ruby script that does just that, check for new courses and advertise the new courses to another app
[19:43:46] dminuoso: bawNg, and Linux simply does not have it.
[19:44:25] eckhardt: has joined #ruby
[19:44:31] dminuoso: bawNg, in fact any high performance stack on Linux is always a) in kernel, but b) out-of-tree.
[19:44:37] dminuoso: *high performance network stack
[19:44:56] dminuoso: Because the in-tree stack is really poor and can barely deal with 40gbe or even 100gbe
[19:44:59] bawNg: rubycoder38: then you could just use a simple loop with a blocking HTTP request and appropriate response/error handling, or you could use EventMachine to register a timer and have the request asynchronously
[19:46:23] bawNg: dminuoso: most boxes don't have that amount of throughput, but sure kernels could support it better
[19:46:44] kekolodeon: has joined #ruby
[19:47:10] rubycoder38: I'm a bit confused about how to keep track of which courses are new and which ones I already advertised
[19:47:48] bawNg: rubycoder38: store their information in a Hash using some unique info as a key
[19:48:00] bawNg: like an ID or something else unique
[19:49:07] tomphp: has joined #ruby
[19:49:16] dminuoso: eam, I suppose realistically meltdown and spectre are not that big of an issue in high performance situations. I mean ultimately you dont let untested and unverified code run on such hardware anyway.
[19:49:28] guille-moe: has joined #ruby
[19:49:33] dminuoso: So you might as well forego any microcode patches, KPTI implementations and compiler changes.
[19:49:41] bawNg: biggest impact by far is cloud services
[19:49:44] kekolodeon: Hi guys! I'm a baby rubyist. I'm coming from a low level background (C/ASM/RE/Binary Exploitation) and I've decided to learn a scripting lang and thought I'd give ruby a go. I'm amazed by how quickly I found resources on its internals such as the C implementation behind MRI. My question is, is there a way to inspect the C representation of ruby programs via a debugger?
[19:49:53] dminuoso: And if you do, any of these mitigations will help you if the code is bad..
[19:50:01] rubycoder38: bawNg: thanks
[19:50:23] dminuoso: kekolodeon, yes!
[19:50:25] eckhardt: has joined #ruby
[19:51:04] kekolodeon: dminuoso: I've found this but not sure if it's the right way to go http://silverhammermba.github.io/emberb/c/
[19:51:05] dminuoso: kekolodeon, you might want to understand the basics of the ruby virtual machine (Ruby under a microscope gives a good and quick introduction, although its a bit dated)
[19:51:08] bawNg: kekolodeon: the MRI internals aren't nearly as bad as people make them out to be
[19:51:20] dminuoso: kekolodeon, that book is pretty great for writing native extensions, not so much for understanding the abstract execution model.
[19:51:27] kekolodeon: dminuoso: that's actually the book I'm reading atm and it's awesome!
[19:51:55] kekolodeon: I don't know if Pat Shaughnessy is here but I'd like to thank him for his blog/book
[19:51:59] dminuoso: kekolodeon, indeed. Beyond that, check out https://robots.thoughtbot.com/using-gdb-to-inspect-a-running-ruby-process
[19:52:05] kekolodeon: I admine people who go in such depth
[19:52:34] kekolodeon: dminuoso: sweet, thanks! :D
[19:52:38] dminuoso: kekolodeon, which basically gives you sort of repl access inside gdb - which is a pretty slick combination.
[19:53:20] dminuoso: kekolodeon, keep in mind that the book is a bit dated, so dont use it if you inspect the kernel. Check out the actual ruby source code, because a lot of details have changed.
[19:53:28] kekolodeon: I used to hate high level langs and their OOP since I could barely find any resources on explaining their C implementation underneath and damn ruby has so many refs on it
[19:53:31] dminuoso: A lot of the layout has been improved, nested, etc.
[19:53:32] goatish: has joined #ruby
[19:53:57] dminuoso: (Conceptually the book is still spot on though)
[19:54:07] bawNg: kekolodeon: also make sure you look at the ruby source for the version you are using, if you're not using 2.5, since things change
[19:54:31] kekolodeon: bawNg: I've found that pry tool to be handy for that
[19:54:43] bawNg: yeah, pry is useful
[19:55:35] AspiringIRCUser: has joined #ruby
[19:55:46] guacamole: has joined #ruby
[19:55:46] guacamole: has joined #ruby
[19:55:55] bawNg: I've added to the known issues for Actuator that timer precision on OSX is shit, hopefully someone who has OSX and knows a little C will be able to investigate further
[19:56:02] kekolodeon: as for the langs itself, I really don't want to go through resources which teach basic syntax -- any decent books which explain the ruby-ish way of programming?
[19:56:17] dminuoso: kekolodeon, Eloquent Ruby.
[19:56:35] dminuoso: kekolodeon, it quickly races through the basics in the first 20 pages or so, and then it's just how to write elegant ruby code.
[19:57:02] dminuoso: And its probably the most recommended book in this channel.
[19:57:20] zleap: which book is that
[19:57:21] dminuoso: Right next to Well Grounded Rubyist, which is better for newcomers.
[19:57:31] zleap: i am learning with codecademy at the moment
[19:57:31] eam: dminuoso: yeah, the tricky part is that things like browsers or mobile are performance critical (not in terms of throughput, but in terms of UX latency and power)
[19:57:32] kekolodeon: perfect, I'll combine it side by side with the ruby hacking guide and the microscope one to get up to speed
[19:57:33] dminuoso: zleap, https://www.amazon.com/Eloquent-Ruby-Addison-Wesley-Professional/dp/0321584104
[19:59:09] kekolodeon: dminuoso: that gdb link you mentioned, does it debug the ruby processes as if they were written in MRI's C implementation?
[19:59:33] dminuoso: kekolodeon, yes.
[19:59:33] al2o3-cr: has joined #ruby
[19:59:48] dminuoso: kekolodeon, Ruby is just a C program. And methods can be invoked directly from C functions.
[20:00:07] dminuoso: The method dispatch ultimately makes use of those exact C functions, so you can use them directly from gdb.,
[20:01:08] kekolodeon: dminuoso: awesome! the sooner I escape this abstraction, the better :p If I can't C, I feel handicapped
[20:01:28] dminuoso: kekolodeon, what exactly are your goals here?
[20:02:47] kekolodeon: dminuoso: well I'm currently really into linux binary exploitation and recently got the feeling that my knowledge is getting too specialized and I've barely touched anything high level. I figured ruby could improve my toolset and I'm also really interested in lang theory as a subject -- as in how they are truly implemented -- let's just say I love knowing internals
[20:02:47] Psybur: has joined #ruby
[20:03:38] kekolodeon: dminuoso: I'm also into code auditing (only C atm and some ruby skills won't be that)
[20:04:23] nowhereman_: has joined #ruby
[20:05:28] ur5us: has joined #ruby
[20:05:51] elcontrastador: has joined #ruby
[20:08:19] bkxd: has joined #ruby
[20:09:04] bkxd: has joined #ruby
[20:09:10] rrutkowski: has joined #ruby
[20:10:17] ltem_: has joined #ruby
[20:17:21] tomphp: has joined #ruby
[20:22:17] bkxd_: has joined #ruby
[20:25:53] bronson: has joined #ruby
[20:26:32] ltem_: has joined #ruby
[20:26:55] jaruga: has joined #ruby
[20:30:04] shorberg: has joined #ruby
[20:32:17] vichib`: has joined #ruby
[20:33:58] synthroid: has joined #ruby
[20:34:26] kekolodeon: has left #ruby: ("WeeChat 1.4")
[20:35:45] konsolebox: has joined #ruby
[20:41:35] orbyt_: has joined #ruby
[20:43:22] jamiejackson: has joined #ruby
[20:44:50] shorberg: has joined #ruby
[20:48:01] workmad3: has joined #ruby
[20:48:33] bkxd: has joined #ruby
[20:48:49] baweaver: Program Ruby like Ruby and C like C.
[20:49:48] bkxd: has joined #ruby
[20:50:36] dminuoso: A tautology is just a tautology.
[20:52:56] claw: has joined #ruby
[20:54:06] jottr_: has joined #ruby
[20:57:06] imode: has joined #ruby
[21:00:00] nopolitica: has joined #ruby
[21:00:39] baweaver: one would like to think so :)
[21:06:12] orbyt_: has joined #ruby
[21:07:03] justinfaler: has joined #ruby
[21:07:15] tomphp: has joined #ruby
[21:08:53] sepp2k: has joined #ruby
[21:09:37] guacamole: has joined #ruby
[21:09:37] guacamole: has joined #ruby
[21:11:08] tomphp_: has joined #ruby
[21:11:49] nowhereman_: has joined #ruby
[21:12:06] SeepingN: has joined #ruby
[21:13:23] nopolitica: has joined #ruby
[21:15:15] LenPayne: has joined #ruby
[21:17:59] eckhardt: has joined #ruby
[21:18:12] plexigras: has joined #ruby
[21:20:41] kurko_: has joined #ruby
[21:20:43] tomphp: has joined #ruby
[21:23:31] tycoon177: has joined #ruby
[21:24:01] tycoon177: has left #ruby: ()
[21:26:35] nchambers: for EventMachine::Connection#post_init, is there any way to get the ip address of the entity connecting?
[21:26:44] bronson: has joined #ruby
[21:27:17] eam: has joined #ruby
[21:28:30] sanscoeur: has joined #ruby
[21:29:21] leitz: ACTION notes his Ruby code looks a lot like Python. So does his C.
[21:29:45] tomphp_: has joined #ruby
[21:30:05] sanscoeur: has joined #ruby
[21:38:35] LenPayne: has joined #ruby
[21:40:34] audy: how do you make C look like Python?
[21:41:35] dminuoso: baweaver, have you noticed that we have not conversed or interacted otherwise for quite some time?
[21:41:56] dminuoso: In fact there does not appear to have been a causal connection between us in the past few weeks.
[21:43:02] havenwood: dminuoso: Oh no! Quick, interact!
[21:43:28] baweaver: Oh no oh no
[21:44:03] dminuoso: havenwood, oh I know how to do that in a pure manner!
[21:44:27] dminuoso: By interact, do you mean (String -> String) -> IO () ?
[21:45:11] pastorinni: has joined #ruby
[21:48:47] pastorinni: has joined #ruby
[21:49:14] havenwood: dminuoso: Does interaction have to have side effects? Hmm.
[21:50:23] justinfaler: has joined #ruby
[21:51:43] cdg: has joined #ruby
[21:52:06] tvw: has joined #ruby
[21:53:24] _main_: has joined #ruby
[21:54:28] alfiemax_: has joined #ruby
[21:55:26] _main_: has joined #ruby
[21:58:55] k0mpa: has joined #ruby
[22:03:00] tipyn: has joined #ruby
[22:04:04] cdg_: has joined #ruby
[22:06:51] sanscoeur: has joined #ruby
[22:06:59] jottr_: has joined #ruby
[22:08:59] minimalism: has joined #ruby
[22:09:16] k0mpa: has joined #ruby
[22:10:19] alfiemax: has joined #ruby
[22:10:50] EXCHGR: has joined #ruby
[22:10:55] Rapture: has joined #ruby
[22:14:38] EXCHGR: has joined #ruby
[22:15:19] camfowler: has joined #ruby
[22:18:40] krazyj: has joined #ruby
[22:21:27] rwb: has joined #ruby
[22:22:16] nopoliti1: has joined #ruby
[22:22:39] guacamole: has joined #ruby
[22:22:39] guacamole: has joined #ruby
[22:22:47] krazyj: has joined #ruby
[22:26:49] elcontrastador: has joined #ruby
[22:27:36] bronson: has joined #ruby
[22:31:50] jenrzzz: has joined #ruby
[22:34:42] veduardo: has joined #ruby
[22:39:39] PaulCapestany: has joined #ruby
[22:42:55] Nicmavr: has joined #ruby
[22:44:23] orbyt_: has joined #ruby
[22:45:40] krazyj: hi folks…i have a noob question. i’m trying to print a value from a Hash. but when i print it, it prints the *whole* hash. however, in the scope of the function where i pull the value out of the has, it prints just the value. code: https://gist.github.com/anonymous/3a3ba8925570bb3fd5d623cd98755f8a#file-foo-rb-L14
[22:46:01] krazyj: notice on line 19, when i print the output, it prints the entire JSON blob
[22:48:01] dminuoso: krazyj, methods return the value of the last statement.
[22:48:13] dminuoso: krazyj, your last statement comprises of a method call Fastlane::Actions::GithubApiAction.run
[22:48:14] BTRE: has joined #ruby
[22:48:20] dminuoso: krazyj, so the return value of that method itself is what is returned.
[22:48:44] workmad3: has joined #ruby
[22:48:51] krazyj: ill change that… thanks dminuoso!
[22:54:51] mtkd: has joined #ruby
[22:58:00] elcontrastador: has joined #ruby
[22:59:54] justinfaler: has joined #ruby
[23:02:45] ltp_: has joined #ruby
[23:05:55] ltp: has joined #ruby
[23:15:37] jnyw: has joined #ruby
[23:17:27] Asher: has joined #ruby
[23:21:22] rouge: has joined #ruby
[23:25:39] Asher1: has joined #ruby
[23:27:51] sanscoeur: has joined #ruby
[23:28:31] bronson: has joined #ruby
[23:30:17] sanscoeur: has joined #ruby
[23:30:36] RougeR: has joined #ruby
[23:31:21] dstrunk: has joined #ruby
[23:32:08] RougeT430: has joined #ruby
[23:32:08] griffindy: has joined #ruby
[23:32:43] eckhardt: has joined #ruby
[23:34:37] baroquebobcat: has joined #ruby
[23:36:24] Asher: has joined #ruby
[23:36:37] alfiemax: has joined #ruby
[23:38:16] justinfaler: has joined #ruby
[23:39:36] haiku3v: has joined #ruby
[23:42:36] tcopeland: >> class Foo < String ; def gsub(*args) ; super ; end ; end ; Foo.new("hey").gsub(/e/) { $&.fiddle }
[23:42:37] ruby[bot]: tcopeland: # => undefined method `fiddle' for nil:NilClass (NoMethodError) ...check link for more (https://eval.in/940991)
[23:43:21] tcopeland: that’s a bummer… I don’t see a way to proxy calls to String#gsub
[23:44:08] nullobject: has joined #ruby
[23:44:19] tcopeland: good discussion of this issue at https://www.ruby-forum.com/topic/198458
[23:46:08] tcopeland: background is I was hoping to write a thing that, at runtime and in the context of a rails app, would detect code like “heyo”.gsub(/yo/, ‘’) and suggest replacing it with “heyo”.remove(/yo/)
[23:46:41] jeffreylevesque: has joined #ruby
[23:47:53] orbyt_: has joined #ruby
[23:58:00] guacamole: has joined #ruby
[23:58:01] guacamole: has joined #ruby
[23:58:10] hahuang65: has joined #ruby