Activity Graph

Page 1 of 23 | Next »


[22:39:22] jokke: has left #ruby: ("WeeChat 2.5")


[17:06:40] jokke: hey there
[17:06:56] jokke: i'm trying to figure out how to write c bindings for ruby
[17:07:15] jokke: i'm struggling a bit with methods
[17:08:14] jokke: so from the docs i gathered that the function i pass to the rb_define_method function will be called with the ruby instance of the object the method was called on
[17:09:45] jokke: the question is, how can i get the initializer to store a pointer to the instance on c level.
[17:10:08] jokke: and how can i access that pointer from the function i pass to rb_define_method
[17:11:04] jokke: what i'm actually trying to do is write something in crystal and use it from ruby
[17:11:33] jokke: crystal too is object oriented so i'd need to call methods on an instance of the corresponding crystal class
[17:12:08] jokke: what i'm struggling with is how to associate the crystal instance with the ruby instance
[17:13:43] jokke: havenwood: ah no, i don't mean it that way
[17:13:53] jokke: i want to be able to use my crystal classes from ruby
[17:14:23] jokke: havenwood: no, haven't heard of fiddle
[17:17:07] jokke: yeah but FFI is meh


[13:47:20] jokke: leitz: mongodb is terrible
[13:47:43] jokke: people using it as a general purpose db is a real pain
[13:48:19] jokke: it's a document based db. I've yet to see a standard web project that didn't have relational data
[13:49:21] jokke: heh rubyonrails is far from perfect but sure, it solves quite a range of standard problems pretty elegantly (i'm a long time rails dev)
[13:49:50] jokke: i haven't used it in a long time though
[13:50:11] jokke: still being high on crystal ;)
[13:50:39] jokke: the language, not the drug :)
[13:52:26] jokke: ZAJDAN: when it comes to ruby web frameworks, i really like how hanami is approaching things


[12:48:34] jokke: has joined #ruby
[12:49:59] jokke: ah nevermind
[12:50:11] jokke: i was too quick to give up researching
[13:41:25] jokke: hm okay it seems that my issue is with celluloid::io
[13:41:56] jokke: i'm trying to setsockopt SO_REUSEPORT
[13:42:33] jokke: but i still get Errno::EADDRINUSE
[13:43:24] jokke: ah ok it seems that it raises the error already on the initialization of the TCPServer
[13:43:57] jokke: i'm assuming it tries to bind immediately
[14:14:28] jokke: ugh ok this is annoying. Celluloid::IO::TCPServer can be instanciated with a BasicSocket, but this has to be a TCPServer
[14:14:44] jokke: and TCPServer doesn't seem to allow setting SO_REUSEPORT before binding
[14:21:40] jokke: i'm just trying to patch in this feature to an existing project
[14:22:06] jokke: it's a server for some embedded devices that stream data to it
[14:22:21] jokke: i'd like to be able to use the kernels own load balancing for socket
[14:22:36] jokke: so that i can spawn up as many instances of the server as i like
[14:33:01] jokke: because otherwise i can't bind
[14:33:10] jokke: because the port is already in use
[14:51:23] jokke: is there any way i can instanciate a TCPServer with a Socket?
[14:51:45] jokke: i already discovered that it's all c code
[14:51:58] jokke: so i can't monkey patch the initializer either
[14:57:32] jokke: yes, but the surrounding code expects to be working with a TCPServer so it calls methods like #closed? on it
[14:59:19] jokke: it's another issue then
[15:01:34] jokke: right now i'm doing
[15:01:42] jokke: but now i'm getting the following errors
[15:01:45] jokke: E, [2019-06-24T17:00:52.044449 #28550] ERROR -- : !!! System Call Error while accepting new connection: #<Errno::EINVAL: Invalid argument - accept(2)> / Invalid argument - accept(2)
[15:02:32] jokke: ah forgot to call listen
[15:02:35] jokke: let's see
[15:03:15] jokke: alright, looking good
[15:15:25] jokke: doesn't seem to be working with Celluloid::IO::SSLServer
[15:50:08] jokke: havenwood: it was
[15:58:54] jokke: i guess i'll open an issue with Celluloid::IO then
[15:59:25] jokke: it's unmaintained


[01:10:52] jokke: Quit: WeeChat 2.3


[16:53:04] jokke: has joined #ruby
[16:53:09] jokke: hey there o/
[16:53:38] jokke: i'm trying to set the temp dir to be used for Tempfiles under ruby 2.4.2
[16:53:47] jokke: it seems that Dir.tmpfile doesn't yet exist
[16:54:02] jokke: and setting the TMPDIR env var doesn't have any effect
[16:55:58] jokke: ah never mind
[16:56:03] jokke: i had to require 'tempfile'


[23:29:56] jokke: Read error: Connection reset by peer


[03:26:47] jokke: Ping timeout: 272 seconds
[04:00:52] jokke: has joined #ruby


[22:40:05] jokke: Ping timeout: 268 seconds


[08:21:27] jokke: Ping timeout: 252 seconds
[08:33:54] jokke: has joined #ruby


[23:01:14] jokke: Ping timeout: 272 seconds
[23:02:59] jokke: has joined #ruby


[14:48:24] jokke: hi! i'm using anyenv with rbenv on my system and i have a gem that i want to uninstall. This gem provides an executable that is put into rbenv/shims by rbenv. uninstalling it wont' work though. the gem command just doesn't do anything and the gem is still there (and so is the shim also after rehashing)
[14:48:46] jokke: i also tried this: for version in $(rbenv versions | cut -c3- | awk '{print $1}'); do rbenv shell $version; rbenv exec gem uninstall fogtrack; done
[14:49:08] jokke: didn't help either
[14:52:57] jokke: rbenv whence fogtrack tells me 2.3.1
[14:53:40] jokke: oh now it worked...
[14:54:17] jokke: well, case closed. Thanks! :)


[07:42:39] jokke: Ping timeout: 268 seconds
[08:08:58] jokke: has joined #ruby


[09:09:11] jokke: Ping timeout: 256 seconds


[18:04:14] jokke: Ping timeout: 245 seconds


[09:14:47] jokke: has joined #RubyOnRails
[09:16:04] jokke: hey, i'm supposed to maintain this old rails app and recently it was put behind https. now there's a mailer which sends out a link using polymorphic_url. the resulting url has http scheme but port 443.. any idea what might be going on?
[09:16:40] jokke: this is the call: <%= polymorphic_url([:confirm, @application], token: @application.token) %>
[09:25:39] jokke: config.action_mailer.default_url_options ?
[09:25:59] jokke: do i have to specify host?
[09:26:20] jokke: as in, is it merged with the action_controller default_url_options/
[09:27:12] jokke: the host has been correct thus far
[09:30:46] jokke: i will. thanks a lot!
[09:31:22] jokke: good point


[15:00:01] jokke: Quit: WeeChat 2.1


[22:50:59] jokke: Ping timeout: 260 seconds
[22:51:26] jokke: has joined #RubyOnRails


[14:20:33] jokke: has joined #RubyOnRails
[14:21:23] jokke: according to EU law you now need to inform your users that you're using cookies on a site. Are there any easy methods for opt-in session usage for rails?
[14:22:37] jokke: as in: only use a session cookie if the user has confirmed that it's okay to do so via an ajax request to some route or sth
[14:23:53] jokke: well all sites i've seen have a button you'll have to click to "dismiss" the banner
[14:24:04] jokke: and until you do, no cookies are set
[14:47:29] jokke: yeah you're right
[14:47:32] jokke: just checked


[14:04:33] jokke: Quit: WeeChat 2.1


[13:18:06] jokke: had the same experience
[13:18:21] jokke: i like the concept, but it turned out not to work in practice
[13:19:27] jokke: not only ruby


[14:51:08] jokke: has joined #RubyOnRails
[14:51:35] jokke: how do i enforce trailing slashes on every path generated by path helpers?
[14:51:42] jokke: in rails 5
[14:52:02] jokke: config.action_controller.default_url_options = { :trailing_slash => true } doesn't seem to work
[14:55:26] jokke: hm yeah that's one part of it
[14:55:44] jokke: but i wouldn't want each and every link i generate to result in a permanent redirect
[14:56:12] jokke: i just have to read the whole thing :P
[14:57:26] jokke: but this looks like would have to add trailing_slash: true to each and every call of a path helper...
[15:02:01] jokke: pwnd_nsfw: you mean monkeypatching the helpers?
[15:02:13] jokke: i wouldn't see that as beauty
[15:02:25] jokke: (don't get me wrong, i love ruby)
[15:02:53] jokke: thanks for the gem tip
[15:03:27] jokke: i still don't see how this would affect any rails helpers
[15:03:30] jokke: it's a rack gem
[15:18:44] jokke: pwnd_nsfw: yeah i'm gonna do the redirecting on nginx level but i still have to generate correct links


[15:22:48] jokke: has joined #ruby
[15:23:03] jokke: any ideas how to reduce the cyclomatic complexity for this?
[15:24:27] jokke: yeah. i'll try it out first
[15:27:41] jokke:
[15:42:24] jokke: but that would give me sth like [60, nil]
[15:42:42] jokke: so it'd be find { ... }.last or so
[15:42:46] jokke: which i don't like
[15:59:46] jokke: havenwood: ummm
[15:59:56] jokke: havenwood: how do you mean?
[16:00:14] jokke: 31_536_000 would be a year
[16:00:26] jokke: 60 * 60 * 24 * 365


[09:09:39] jokke: Quit: WeeChat 2.0.1


[08:04:26] jokke: Ping timeout: 276 seconds
[08:05:47] jokke: has joined #RubyOnRails
[08:05:49] jokke: has joined #ruby


[18:29:04] jokke: hi! i have a rails 4 project and want to use respond_to / respond_with. I need to customize the rendering for json though. Here's what i've tried:
[18:29:24] jokke: this doesn't however affect the output of the json format at all


[12:10:32] jokke: Ping timeout: 276 seconds
[12:16:07] jokke: has joined #RubyOnRails
[12:16:09] jokke: has joined #ruby
[12:31:18] jokke: Ping timeout: 240 seconds
[12:47:35] jokke: has joined #RubyOnRails
[12:47:37] jokke: has joined #ruby


[10:27:58] jokke: has joined #ruby
[10:28:22] jokke: is it possible to do lookups on a set/hash just with the hash of a contained element?
[10:30:47] jokke: i'm trying to figure out how to implement an array, which dedups the elements. i need to be able to access the elements by index so set is not an option because << with an existing element does nothing
[10:31:58] jokke: references it once
[10:32:05] jokke: well that's not a problem
[10:32:22] jokke: references arent' big
[10:32:26] jokke: the data is
[10:33:00] jokke: no you're absolutely right
[10:33:04] jokke: of course
[10:35:59] jokke: alright, so lets say i have a data structure that implement #hash, how would i keep track of all existing elements and if i were to create an equal element, how would i get the reference of the element i created before
[10:40:04] jokke: that sounds about right
[10:41:29] jokke: dminuoso:no i can't
[10:41:52] jokke: because i will need to add it to an array
[10:42:05] jokke: so something like objects = (foo[bar] ||= bar)
[10:42:14] jokke: objects <<
[10:42:29] jokke: so i can access it by index
[10:43:17] jokke: apeiros: i don't follow. I looked at the docs, but i don't see the connection
[10:45:02] jokke: well i don't know if there's something wrong with ruby per-se
[10:45:19] jokke: it's easy enough to implement a DeduppedArray based on what we discussed
[14:06:44] jokke: apeiros: yeah i did it like this:
[14:06:58] jokke: not sure why i write dedup with double p :D
[14:07:15] jokke: ignore the Vertex class
[14:07:36] jokke: apeiros: yeah
[14:08:04] jokke: apeiros: but it's for parsing close to millions of lines of highly duplicated data
[14:10:29] jokke: hash defines the bucket
[14:10:33] jokke: not equality
[15:23:09] jokke: apeiros:
[15:24:33] jokke: it won't be
[15:24:58] jokke: can i assign constants in methods?
[15:25:24] jokke: FOO ||= 'bar' won't really work, will it :P
[15:28:38] jokke: can i somehow auto-freeze every object that's being initialized of a class that implements Dedupable
[22:32:11] jokke: Ping timeout: 256 seconds
[22:33:02] jokke: has joined #ruby


[15:03:06] jokke: Quit: WeeChat 2.0.1


[23:00:53] jokke: Ping timeout: 246 seconds
[23:03:03] jokke: has joined #ruby


[13:50:43] jokke: Quit: WeeChat 2.0.1
[14:09:41] jokke: has joined #ruby


[08:56:46] jokke: Quit: WeeChat 2.0.1
[08:59:26] jokke: has joined #ruby
[14:49:53] jokke: Ping timeout: 252 seconds
[15:03:26] jokke: has joined #ruby


[17:01:50] jokke: Quit: WeeChat 1.9
[17:16:06] jokke: has joined #ruby
[21:52:04] jokke: i'm having some trouble with Array#|
[21:52:56] jokke: i have an array with some objects. i've implemented hash and eql? in the class for this object
[21:53:30] jokke: if i now try to make a union of two arrays i always get duplicates
[21:53:44] jokke: even though the hashes are equal
[21:54:13] jokke: for some reason #eql? returns false
[21:54:20] jokke: axsuul: i use yard
[21:54:26] jokke: i think most do
[21:55:00] jokke:
[21:55:12] jokke: these are the methods
[21:59:32] jokke:
[21:59:42] jokke: why the hell is it not overridden?
[21:59:50] jokke: the hash method is
[21:59:55] jokke: but not eql?


[22:09:22] jokke: Ping timeout: 264 seconds
[22:09:57] jokke: has joined #ruby
[22:10:03] jokke: has joined #RubyOnRails


[13:42:38] jokke: (the root)
[13:43:01] jokke: something like as: [:root, :homepage]
[13:43:19] jokke: same route
[13:43:26] jokke: just multiple names
[13:43:45] jokke: in my case it would provide root_url and homepage_url methods for example
[14:04:11] jokke: pwnd_nsfw: yup worked like a charm