Activity Graph

Page 1 of 3 | Next »


[00:56:19] raz: *.net *.split


[12:25:55] raz: Ping timeout: 252 seconds
[12:27:08] raz: has joined #RubyOnRails


[13:12:53] raz: has joined #RubyOnRails
[13:12:56] raz: has left #RubyOnRails: ("*fump*")
[13:13:07] raz: has joined #RubyOnRails
[13:13:38] raz: is there a release date for Rails 6, yet?
[13:14:11] raz: (last thing i heard it was gonna come out on Apr 30, but looks like we're not there yet)
[13:49:16] raz: tbuehlmann: thanks!


[21:21:54] raz: Excess Flood
[21:22:31] raz: has joined #ruby


[01:49:07] raz: *.net *.split
[14:47:50] raz: has joined #ruby
[14:49:02] raz: question: the return value from str.force_encoding('UTF-8') and str.force_encoding('UTF-8').dup should behave completely identical, right?
[14:49:16] raz: i think i've run into a ruby bug :(
[14:51:48] raz: hmmm. why would the content differ after being dup'ed?
[14:52:02] raz: (or the encoding...)
[14:52:39] raz: i'm indeed running into encoding errors *unless* i add the trailing .dup
[15:53:03] raz: it's unfortunately hard to reproduce out of context. rails app with ActiveModelSerializer here
[15:53:29] raz: i'm just sticking with my workaround for now
[15:57:17] raz: yep i've done that. dumped it all sorts of ways. the string object looks identical before/after dup. i'm guessing rails/AMS somehow attaches/guesses the encoding in a way that gets stripped by the dup


[15:55:25] raz: has joined #ruby
[15:56:14] raz: hmm. i'd like to monkey-patch Class, so that AnyClass.path returns the filesystem location to the source code (__FILE__). any ideas anyone?
[16:20:28] raz: apeiros: good question. for starters i'd be fine to get any (or all) of the paths in that case
[16:21:24] raz: so far i found it impossible to dynamically get at the path at all (both __FILE__ and caller_locations let me down)
[16:21:54] raz: i.e. it's trivial do hardcode this into _one_ class. i'd like a solution that gives me the method for all classes
[16:29:25] raz: hmm yap, it's tricky


[04:51:50] raz: Ping timeout: 276 seconds


[00:07:28] raz: *.net *.split
[00:15:51] raz: has joined #ruby


[02:47:18] raz: *.net *.split
[02:48:10] raz: has joined #ruby


[12:25:48] raz: *.net *.split
[12:27:17] raz: has joined #ruby
[15:01:19] raz: *.net *.split
[15:03:19] raz: has joined #ruby
[16:10:23] raz: *.net *.split


[04:05:25] raz: Excess Flood


[06:14:22] raz: Ping timeout: 265 seconds
[06:18:50] raz: has joined #ruby
[17:53:51] raz: Ping timeout: 252 seconds
[17:55:19] raz: has joined #ruby
[17:55:19] raz: Changing host
[17:55:19] raz: has joined #ruby


[03:44:44] raz: has joined #ruby
[03:44:44] raz: Changing host
[03:44:51] raz: has joined #RubyOnRails
[03:45:11] raz: anyone know if the latest sql injection exploits also affect postgresql? https://kay-malwarebenchmark.github.io/blog/ruby-on-rails-arbitrary-sql-injection/
[03:48:16] raz: Radar: ah thanks, that's good to know. the exploit description is unfortunately vague in that part


[01:43:32] raz: Quit: *fump*
[03:01:32] raz: has joined #ruby


[23:08:34] raz: has joined #ruby
[23:09:51] raz: when i have a method `def foo(a:, b:, c:)` - is there a away to access the parameters as a hash?
[23:23:01] raz: al2o3-cr: when called as `foo(a: 1, b: 2, b:3)` i would like to get all arguments as a hash { a:1, b:2, b:2 }
[23:23:28] raz: that way one could define a "schema" in the method signature and directly use the provided arguments e.g. in a database call
[23:24:13] raz: like... create_user(email:, password:) { User.create **kwargs }
[23:24:32] raz: (missing a 'def' in front of create_user ;) )
[23:25:28] raz: ok, that looks very hacky and probably slow, but i'm glad there is a way at all ;)
[23:25:59] raz: was hoping there might be an idiomatic shortcut that i had been missing
[23:26:55] raz: if my japanese wasn't so rusty i'd be inclined to propose it
[23:27:42] raz: having to repeat the args in the method body often feels very unruby'ish
[23:29:15] raz: al2o3-cr: nothing special. my example above is the pattern i most often run into. convenience wrappers such as `def create_user(email:, password:) { User.create **kwargs }`
[23:29:41] raz: without the imaginary '**kwargs' (or your crazy reflection stunt) you have to repeat all the kwargs inside the method body
[23:29:52] raz: often more than once, and often there are quite a few more than two...
[23:31:12] raz: yup, i should just learn me some japanese and hit up matz on tinder
[23:31:57] raz: well yes, that's the whole point, to have that minimum of validation
[23:32:11] raz: validation/visibility
[23:32:36] raz: it's much better than anonymous opts-hashes, esp. with multiple people working on the code
[23:33:13] raz: i mean, that's what i do in practice... i downgrade the method to an anonymous opts-hash, and validate that manually
[23:33:59] raz: ending up with effectively the same that your reflection code would do - but in a way that doesn't force me to explain it to a different co-worker every day ;)


[11:07:52] raz: has left #ruby: ("*fump*")


[02:26:59] raz: Ping timeout: 246 seconds
[02:27:05] raz: has joined #ruby


[15:43:44] raz: has joined #ruby
[15:44:18] raz: can someone explain to me why ++i is a legal statement?
[15:44:52] raz: even the how would already make me happy ;)
[15:45:25] raz: well, it returns the value of i
[15:46:08] raz: i == ++i
[15:46:10] raz: is true
[15:47:36] raz: ohhh.. now it starts to make sense
[15:50:10] raz: still think that stuff should throw a syntax error
[15:50:22] raz: unless someone can think of a real world use-case for e.g. +-+-1 ;)
[16:17:16] raz: banisterfiend: no and yes :)
[16:17:58] raz: or is there a reason for why it should *not* be a syntax error?
[16:18:36] raz: well, not necessarily your example, but definitely mine, which is a boobytrap for C-family programmers
[16:19:19] raz: they are used to writing ++i and having it do something specific. ruby breaks their expectation without that expression being useful in any other way.
[16:22:30] raz: your expression behaves the same in C and ruby, mine doesn't
[16:22:40] raz: ACTION hands banisterfiend back his strawman
[16:23:19] raz: and ++i is *not* the same as in ruby
[16:24:03] raz: yes. which i confirmed 3 times now...
[16:24:23] raz: the point about ++i is that this one does *not* behave the same in C and ruby
[16:24:30] raz: your example is unrelated
[16:27:55] raz: banisterfiend: yes, that's what i'm saying
[16:28:02] raz: and yea i know it's unlikely to happen
[16:29:49] raz: being consistent for a case that nobody needs doesn't seem a worthwhile goal when it causes actual problems for some people ¯\_(ツ)_/¯
[16:30:23] raz: yea, in the end it's not a big deal as it's probably unlikely to introduce subtle bugs anyway
[16:34:24] raz: i think you are wrong, in this case
[16:34:40] raz: but my japanese is very rusty, so you don't have to be afraid of me convincing anyone to implement it :P
[16:37:23] raz: banisterfiend: yet another reason to make it illegal :)
[16:38:44] raz: why would anyone do that, except to deliberately confuse people?
[16:39:44] raz: no. but any feature that doesn't have any *other* legitimate use-case.
[16:39:58] raz: yes, that's exactly what nobody wants in ruby
[16:40:58] raz: uh huh. suure.
[16:41:36] raz: banisterfiend: homework: grep all ruby code on github and find one example to back up your case.
[16:41:42] raz: just one
[16:43:57] raz: that's ivory tower bs
[16:44:04] raz: i'll back up my case: https://stackoverflow.com/questions/6509423/ruby-parenthesis-syntax-exception-with-i-i
[16:44:26] raz: that's ~5k people falling into the i++ / ++i trap and looking it up on stack overflow to figure it out
[16:44:40] raz: a syntax error would have saved them a few minutes of their lives ¯\_(ツ)_/¯
[16:46:08] raz: only if it also plays a tooting siren sound while it displays the warning
[16:46:30] raz: the ecto1-horn would be adequate
[16:47:36] raz: havenwood: ideally displayed in multiple languages! :D
[16:49:58] raz: banisterfiend: i doubt there are many other traps like ++i
[16:50:25] raz: havenwood: that may be somewhat true. the only problem being... nobody comes from smalltalk ;)
[16:50:32] raz: banisterfiend: like what?
[16:53:17] raz: banisterfiend: so what would someone coming from swift accidentally write that would be comparable to ++i?
[16:53:41] raz: .. and ... sounds interesting
[16:57:22] raz: Changing host
[16:57:23] raz: has joined #ruby
[17:04:14] raz: havenwood: yup agreed


[13:16:14] raz: i found https://github.com/Codcore/amethyst very refreshing
[13:16:27] raz: that might become the new rails for me


[17:26:06] raz: Ping timeout: 258 seconds
[17:33:09] raz: has joined #RubyOnRails


[13:11:49] raz: has joined #RubyOnRails
[13:12:05] raz: i would like to use ULIDs 9
[13:12:46] raz: i would like to use ULIDs (https://github.com/alizain/ulid) as the ids for all my models. anyone know how to invent a custom id-type (akin to the built-in :uuid)?
[14:52:09] raz: vedu: nope
[14:54:50] raz: vedu: not UUIDs, ULIDs
[14:58:39] raz: vedu: np, 1 letter difference, easy to miss ;)
[15:35:25] raz: well, all ids must always be treated as opaque strings
[15:35:52] raz: that part is easy, but how do i pass a proc into the rails id generator so it actually generates the ids i want?
[15:37:18] raz: would be great if it was as easy as 'create_table id: Proc.new { ULID.generate }' - but that's wishful thinking :/
[15:41:13] raz: ule: any more info or a tutorial? :) googling this is hard, everyone only ever refers to the builtin UUID...
[15:41:29] raz: hrm.. that sounds dirty...
[15:42:02] raz: yes, i use uuid everywhere, but i want ulid now, that's why i'm asking here ;)
[15:46:05] raz: yes, that's what i would use
[15:46:37] raz: well, but what callback(s). i'd rather like to do exactly what the uuid code does.


[13:53:40] raz: has left #RubyOnRails: ("*fump*")


[07:53:48] raz: has joined #RubyOnRails
[07:54:05] raz: what is the best column type to store ip addresses (ipv4 and ipv6) with postgres? it seems :ip_address is not supported (anymore?). google gives me conflicting info...
[07:59:22] raz: Andr3as: thx
[07:59:39] raz: matthewd: yep, apparently :ip_address used to(?) map to inet
[08:00:07] raz: http://stackoverflow.com/a/17918118
[08:00:37] raz: but if i try to use it in a migration right now, it just generates invalid SQL (tries to put ip_address verbatim as the column type)
[08:00:55] raz: and yep, this is for manipulation. i'd like a type that magically maps to IPAddr (or such) in rails
[08:01:06] raz: but maybe i'm wanting too much here
[08:02:14] raz: anyway, i'll try where 'inet' gets me :)
[09:10:11] raz: ugh... rubycop should never recommend String#casecmp over foo.downcase == 'x'
[09:11:28] raz: casecmp is extremely dangerous because people expect it to return a boolean, when in reality it returns and int *and nil*
[09:11:44] raz: dminuoso: most of the defaults seem reasonable to me, but not this one
[09:12:33] raz: the language implies it, yes
[09:13:14] raz: if foo.casecmp('bar') ...
[09:13:26] raz: ^ that's the bug i'm seeing for the nth time
[09:14:14] raz: it's true whether it matches or not...
[09:14:22] raz: because casecmp returns an int, remember? ;)
[09:15:09] raz: yea well.. not just you... that's why i'm lamenting here ;)
[09:15:40] raz: principle of least surprise much violated there
[09:16:41] raz: yes, definitely. or a warning.
[09:17:55] raz: yup, might do that sometime
[09:21:52] raz: exactly
[09:22:13] raz: especially with casecmp being a trap


[13:00:53] raz: has left #ruby: ("*fump*")
[13:00:56] raz: has left #RubyOnRails: ("*fump*")


[09:29:22] raz: hmm, is this a safe thing to do in initialize(): raise StandardError, self ? (i.e. i'd like to return the partially initialized instance along with the exception - so the caller can inspect what went wrong)
[09:30:23] raz: dminuoso: thanks!
[09:30:46] raz: yea i thought so, but sometimes it feels better to ask ;)
[10:25:49] raz: has anyone had any success with vcr + webmock + excon? i'm travelling various github issues and am just wtf'ing that this still seems to be unfixed (with excon being one of the most popular http libraries :/ )
[10:46:12] raz: has anyone had any success with vcr + webmock + excon? i'm travelling various github issues and am just wtf'ing that this still seems to be unfixed (with excon being one of the most popular http libraries :/ )
[10:46:51] raz: sevenseacat: it's not recording cassettes for me. are you saying it just works for you?
[10:47:25] raz: sevenseacat: could you kindly share me your output of 'gem list excon vcr webmock'? :)
[10:48:16] raz: sevenseacat: all gems on the latest version. VCR configured via config.hook_into :excon - nothing special really. but it simply doesn't record cassettes. there are various github issues documenting this problem as well.
[10:49:18] raz: sevenseacat: pardon hook_into :webmock above (been trying various things)
[10:49:36] raz: sevenseacat: what question you mean?
[10:51:01] raz: ok sorry
[10:51:30] raz: so, vcr recognizes the excon requests, logs '[excon] Identified request type (recordable) for [get ...' - but does not actually record anything (no yml file is created)
[10:52:21] raz: that is with hook_into :excon
[10:52:30] raz: with hook_into: webmock - it doesn't seem to even recognize the requests at all
[10:54:08] raz: webmock (2.1.0), vcr (3.0.3), excon (0.50.1)


[14:05:23] raz: is there an easy way to add custom rules to rubocop? i'd like to ban ENV[] from our code-base (force people to use ENV.fetch)


[17:49:07] raz: hmm anyone here happen to know how to wrap PTY.spawn, so a spawned 'stty size' will return terminal dimensions other than '0 0'? (because the latter screws with many tty-expected programs, which kinda defeats the purpose of using PTY to begin with :/ )
[17:50:12] raz: i've tracked it down to an ioctl TIOCGWINSZ that PTY.spawn apparently doesn't patch up (on purpose? by oversight? am i doing this wrong?)
[18:01:00] raz: al2o3-cr: ruby -r pty -e 'PTY.spawn("stty size") { |r, _w, pid| puts r.read }'
[18:01:07] raz: when you run this, it will print '0 0'
[18:01:17] raz: when you run 'stty size' directly, it will display your current terminal size
[18:02:24] raz: i need the command running inside PTY.spawn to think it's running in a terminal that has a size that is not 0 0 (because many programs can't deal with that zero-size and crash) :)
[18:36:27] raz: al2o3-cr: yup. i found winsize= in io/console now. but i can't figure out how to use it.
[18:37:36] raz: al2o3-cr: well, i tried all kinds of variants of creating an IO and feeding that to spawn, but nothing works. this stuff is not very well documented ;)


[10:56:25] raz: ugh, avoid puppet
[10:56:29] raz: and chef
[10:58:21] raz: so does terraform
[10:58:29] raz: but both suck significantly less than chef/puppet
[11:00:19] raz: ansible/tf are relatively bad impls of solid concepts. chef puppet are not just bad impls but broken by design on top of that.


[10:39:28] raz: has joined #RubyOnRails
[10:39:41] raz: what's the best ruby on rails books?
[10:40:37] raz: GarethAdams: being able to recommend it to someone who asked me for a book and hearing a happy thank you from him next week ;)
[10:40:50] raz: ACTION never reads tech books, so wouldn't know
[10:45:13] raz: fox_mulder_cp: thanks
[11:06:31] raz: has joined #ruby
[11:06:41] raz: yay, rubocop -a just broke my code
[11:11:38] raz: yep, curiously i can not reproduce it with a simple test-case, though. maybe they fixed that in rubocop in the past few days.
[11:11:48] raz: it changed $? != 0 into $CHILD_STATUS != 0
[11:11:55] raz: but the two are not the same
[13:32:50] raz: can anyone think of a SaaS service targeting developers with really good on-boarding on the homepage (curl examples and everything)?
[13:33:08] raz: i know i have seen a few, but now that i want to take some cues, i can't remember a single one :D


[01:53:59] raz: has left #ruby: ("*fump*")


[14:34:49] raz: nah trillions seems accurate, tho i'll admit i didn't research the number
[14:35:22] raz: but thinking about strings/symbols probably costs me an hour or so a month. for newbs the number is much higher. multiply by number of ruby users. it adds up.
[14:36:03] raz: apeiros: you know that doesn't work, why do you keep suggesting it!
[14:36:15] raz: why must you dilute my beautiful sunday rant!
[14:39:36] raz: i'm suggesting to fix a wart on a nice language and you tell me to go use an awful language instead
[14:39:46] raz: i guess that's the nerd version of 'fu'
[14:41:16] raz: improving syntax has nothing to do with 'dumbing down'
[14:42:19] raz: that was a secondary subject, and yes that's not dumbing down either, that's fixing a design bug
[14:43:08] raz: ignorants huh
[14:43:34] raz: you still haven't explained the purpose of symbols in ruby, in contrast to lisp and smalltalk
[14:45:02] raz: well, i have educated myself. why don't you enlighten me?
[14:45:13] raz: if i replace all symbols in my code with strings, somehow it still works
[14:45:17] raz: what am i missing?
[14:46:23] raz: or maybe you just don't have an argument huh? ¯\_(ツ)_/¯
[14:55:23] raz: and strings are staged to be immutable by default
[14:55:24] raz: ACTION chuckles
[14:55:32] raz: (from 2.3)
[14:56:42] raz: apeiros: but i already won, you can stop flailing :P
[14:58:31] raz: ACTION wonders about the difference between an immutable string and a symbol
[14:59:57] raz: i like your way of arguing without arguments :D
[15:00:55] raz: apeiros: so what's the performance difference between these immutable strings and symbols... why don't you help the ignorant :(
[15:02:02] raz: apeiros: but.. don't they use the same code-path in the vm?
[15:02:09] raz: ACTION so confused :(
[15:03:33] raz: only if they speak japenese!
[15:08:40] raz: well, matz himself *wanted* to scrap symbols for 1.9
[15:08:52] raz: but he couldn't, too much legacy code broke
[15:09:10] raz: the new immutable string default is probably meant to be a slower take on the issue
[15:09:16] raz: p1k: exactly
[15:09:47] raz: p1k: yea python is a good example here. their ongoing py2/py3 debacle is the prime argument against aprupt major syntax changes.
[15:10:24] raz: p1k: i wouldn't even mind retaining the symbol syntax, they should just behave as strings (i.e. indifferent access) where it matters
[15:10:33] raz: i.e. just make :foo syntactic sugar for 'foo'
[15:11:00] raz: p1k: getting rid of the whole symbolize_keys and related mess
[15:11:27] raz: p1k: removing one blocker from the road to dot-notation hash access
[15:12:24] raz: p1k: well yes and yes. there simply is no reason for ruby to expose symbols as something special. they were a mistake, i think matz said that himself.
[15:13:09] raz: hm, like how?
[15:14:13] raz: yea as said, i don't even mind to retain the syntax (doing away with that isn't realistic anyway)
[15:14:33] raz: but hashes shouldn't get on my neves when i access [:foo] as 'foo'
[15:15:35] raz: hm, not sure what you're going at there :)
[15:16:03] raz: when in interpolated (via to_s) they already look the same.. which is one of the problems with them
[15:16:31] raz: p1k: oh, you're talking about the performance difference now?
[15:17:44] raz: Mon_Ouie++
[15:22:20] raz: ACTION mumbles something about static, ordered set