dymk

Activity Graph

Page 1 of 3 | Next »

2019-01-08

[03:39:20] dymk: Ping timeout: 250 seconds

2018-11-23

[00:32:07] dymk: Has anyone got experience with taking an existing (non-web) application that uses ActiveRecord, and embedding a Rails application in there as a subproject?
[00:32:42] dymk: main challenges I can think of are adding a new path for Rails to search for modules under, mainly the existing "models" directory of the application that it'll be embedded
[00:35:02] dymk: Perhaps instead of it being a separate rails application, it should be a rails engine
[00:41:59] dymk: Ah this is particularly useful: https://stackoverflow.com/questions/33726240/run-rails-engine-standalone

2018-11-22

[01:43:21] dymk: has joined #RubyOnRails
[01:44:43] dymk: Hi, I'm using ActiveRecord 5.2 with a fairly custom usecase, and I'm wondering if AR provides any helper methods for encoding arbitrary arrays/strings into something that the underlying database can consume. Example: Encoding ruby [1, 2, 3] into the PG-understandable string "{1,2,3}"
[01:45:58] dymk: The goal is to write a query kind of like "INSERT INTO table (pkey, array_of_values) VALUES (1, '{1, 2}'), (2, '{3, 4}') ON CONFLICT DO NOTHING"
[01:46:15] dymk: (where those values being inserted are dynamically generated)
[01:47:15] dymk: Sure, internally, but I'm building the SQL string to execute directly
[01:48:16] dymk: There's no support for PG UPSERT in ActiveRecord (without relying on a third party gem, at least)
[01:49:13] dymk: that third party gem doesn't have the requisite flexibility either
[01:49:22] dymk: to give you an idea of the schema: `table` has to columns, `id :: long int` and `media_ids :: array of binary`
[01:50:11] dymk: I'd like to write a query which finds or creates all models in `table` with a certain ID, and adds a given media_id to the media_ids array on each row
[01:57:26] dymk: sevenseacat: basically, this: https://gist.github.com/dymk/1c62bb3280dcb555d9211ceb8c939e75
[02:00:28] dymk: so the hard part (or rather, the part I don't want to write) is the code that serializes an array into SQL
[03:27:53] dymk: has joined #ruby
[03:28:41] dymk: Hi, does pack/unpack support a repeating pattern of multiple different things?
[03:29:48] dymk: E.g., can I pack an array of pairs of (byte, BER encoded number), and unpack it with something like my_arr.pack("Cw*")
[19:17:05] dymk: Is it possible to define a polymorphic association, but have the _type field be backed by an enum of ints (which map to class name), rather than a string of the class name?

2016-04-24

[18:17:00] dymk: has joined #RubyOnRails
[18:18:33] dymk: Hi, I'm working on a site that has to check another site for content every 10 minutes or so, but the task is always the same so I'm shying away from something like sidekiq
[18:18:59] dymk: cron would require reloading the whole app every 10 minutes, so I think that's out the window
[18:19:09] dymk: Has anyone found a good solution for this?
[18:19:29] dymk: sidekiq requires a redis installation, and then I'd still need some sort of way to enqueue jobs repetatively
[18:19:33] dymk: oh, that wasn't a typo
[18:20:16] dymk: hm, I wanted to avoid sidekiq because of the redis dependency
[18:20:35] dymk: but I don't have a use for it on this otherwise really simple site
[18:22:07] dymk: I've used delayed_job too, it's pretty decent
[20:44:43] dymk: has left #RubyOnRails: ()

2015-10-01

[01:33:16] dymk: has left #RubyOnRails: ("Leaving")

2015-09-29

[02:33:01] dymk: has left #RubyOnRails: ("Leaving")
[17:38:08] dymk: has joined #RubyOnRails

2015-09-25

[07:00:08] dymk: Ping timeout: 240 seconds
[10:15:45] dymk: has joined #RubyOnRails
[10:22:31] dymk: Ping timeout: 240 seconds
[10:55:17] dymk: has joined #RubyOnRails
[11:01:43] dymk: Ping timeout: 240 seconds
[17:22:50] dymk: has joined #RubyOnRails

2015-09-24

[05:22:03] dymk: Ping timeout: 246 seconds
[05:29:41] dymk: has joined #RubyOnRails
[06:46:28] dymk: Ping timeout: 240 seconds
[06:47:20] dymk: has joined #RubyOnRails
[23:55:18] dymk: Ping timeout: 240 seconds
[23:58:58] dymk: has joined #RubyOnRails

2015-09-20

[01:33:31] dymk: Paperclip is caching interpolation values I give it, does anyone know a workaround for this?
[01:37:18] dymk: This is embarrassing, it's actually rails' caching that is causing me to not see the changes :<

2015-09-19

[02:03:35] dymk: has joined #RubyOnRails
[02:04:28] dymk: Hi, is there a way in Rails to specify the layout to render with, before calling a method that renders?
[02:05:30] dymk: rhizome, lets say I want to change the layout used based on the current user, in the application controller; is it valid to do something like `if something; self.class.layout :my_other_layout; end
[02:05:51] dymk: right, I'd like to specify the layout before calling a rendering method
[02:06:15] dymk: and I'd like to specify the layout based on some conditional logic
[02:06:41] dymk: eh, this really is a case where I just want to render a totally different layout for a different user
[02:07:30] dymk: michael_mbp, yes, but this isn't something that every single action in my application should have to know about
[02:08:04] dymk: ...right
[02:08:28] dymk: if i want all actions to use this other layout, based on, say, the current user's role
[02:09:42] dymk: and I've got one, in my application controller
[02:10:01] dymk: but what call should I be making in the application controller, to specify the layout?
[02:10:11] dymk: `self.class.layout :something` ?
[02:10:36] dymk: how's that help?
[02:11:09] dymk: right, having the filter in ApplicationController means this filter runs before every action, though :P
[02:12:07] dymk: yeah this really doesn't solve the problem michael_mbp, but i get what you're saying
[02:12:22] dymk: now, the question is: is calling self.class.layout thread safe
[02:12:45] dymk: michael_mbp... it is a monolith in that every controller inherits from it, which is why I'm putting my before_action in it
[02:13:07] dymk: no, hold on
[02:13:14] dymk: all controllers are of interest
[02:13:22] dymk: which is why the callback is in applicationcontroller
[02:13:54] dymk: https://gist.github.com/dymk/974d226504f033db8e6c
[02:14:29] dymk: that'd require changing every `render` call in the entire application to include `layout: @layout`
[02:14:33] dymk: which is exactly what I want to avoid
[02:15:07] dymk: that gist is the... gist of what i'm attempting to do, but I'm worried that calling the class `layout` method isn't threadsafe
[02:16:05] dymk: consider the case when two requests happen at the same time, one is authed, one is not, the nonauthed calls `self.class.layout :basic`, but then authed sets :application layout, then both render after that
[02:16:30] dymk: oh hey, a SO: https://stackoverflow.com/questions/6672385/rails-set-layout-from-within-a-before-filter-method
[02:16:52] dymk: ah yeah they had thread safety issues as well
[02:17:17] dymk: heyohhh! with 59 points is my answer: i can make a method to specify it for me
[02:19:28] dymk: i'm aware of how controllers inherit from application controller, but thanks regardless

2015-09-18

[16:19:28] dymk: has left #ruby: ("Leaving")

2015-09-15

[03:28:32] dymk: Ping timeout: 246 seconds
[03:31:22] dymk: has joined #ruby
[03:41:08] dymk: Ping timeout: 246 seconds
[04:04:26] dymk: has joined #ruby

2015-09-09

[00:49:53] dymk: Ping timeout: 246 seconds
[00:53:58] dymk: has joined #ruby

2015-09-07

[02:15:27] dymk: *.net *.split

2015-09-04

[03:28:35] dymk: Ping timeout: 246 seconds
[03:28:45] dymk: has joined #ruby

2015-08-28

[03:27:54] dymk: Ping timeout: 246 seconds
[03:32:16] dymk: has joined #ruby
[10:27:06] dymk: *.net *.split
[10:29:50] dymk: has joined #ruby

2015-08-21

[06:08:26] dymk: jesus, some guy is suggesting that it's bizzare for ruby to be used for string manipulations
[06:08:38] dymk: he's asking for an example program on github that does string manipulation
[06:08:59] dymk: Does ActionView still append to an internal string buffer? In which case any rails app counts...
[06:10:37] dymk: at this point i can't tell if the fella is serious or not
[06:10:38] dymk: or maybe I'm totally misinterpreting what he's asking
[06:10:38] dymk: wat in question: https://www.reddit.com/r/ruby/comments/3hqky4/string_literals_are_frozen_immutable_by_default/cuadbav?context=3
[06:12:00] dymk: ACTION scoots his chair in
[06:12:08] dymk: no kidding
[06:12:21] dymk: they're asking for a better C api, and i'm sitting here like "have you even used it before?"
[06:13:12] dymk: there was an announcement post from the new CTO today
[06:13:29] dymk: someone was saying that reddit costs something on the order of $20M per year to run
[06:14:14] dymk: baweaver, seriously? damn, remind me never to scale
[06:14:31] dymk: sevenseacat, there was something in that vein in there, hah
[06:14:45] dymk: baweaver, i'll have you know i store gigabytes (gigabytes!) of porn on my little home server
[06:15:06] dymk: just sayin', gigabytes
[06:15:15] dymk: do you know where *i* work?
[06:15:24] dymk: but no, where do you work baweaver?
[06:16:14] dymk: baweaver, that's pretty cool, i'm only an intern, so I can't wave my apple around too much :P
[06:16:31] dymk: core kernel
[06:16:43] dymk: so that ps4.html link is pretty nifty looking
[06:17:14] dymk: sevenseacat, something something you should see the CS page of my uni ;_;
[06:17:29] dymk: fatsum, XNU is ugly, only fitting the fuzzer is too
[06:18:04] dymk: sure, as long as they have a fallback for having mutable strings
[06:18:10] dymk: it won't
[06:18:48] dymk: don't remind me D:
[06:19:07] dymk: baweaver, sure, but their type system is built around immutability, and nice thread local heaps, etc
[06:19:41] dymk: it's gonna be interesting to see how they bolt immutable whatnots onto the current vm
[06:20:00] dymk: Aeyrix, i tried it, it's.... not a great story yet
[06:20:06] dymk: elixir/phoenix that is
[06:20:29] dymk: i hope i didn't wake the phoenix evangelicals ;)
[06:20:38] dymk: and I like the language... as a concept
[06:20:58] dymk: not to be hostile, I really do like the language
[06:21:05] dymk: and phoenix is on the right track
[06:21:13] dymk: ACTION ducks for cover
[06:21:24] dymk: stop pinging him on irc! he'll see me!
[06:21:35] dymk: uh hi radar
[06:22:19] dymk: Radar, I tried phoenix, its ORM is nowhere near activerecord's
[06:22:45] dymk: well yeah and that's what I'm saying :P
[06:22:51] dymk: it's not a good story, right now
[06:23:19] dymk: also docs could use some love
[06:23:53] dymk: there also aren't many good resources on what a "good" elixir application should look like out there
[06:24:22] dymk: sevenseacat, indeed
[06:24:57] dymk: oh, elixir's metaprogramming story: it's way more difficult than even D is
[06:25:11] dymk: things like not being able to extend structs at compile time
[06:26:05] dymk: it's like they tried to keep the core language as small as possible and thus nerfed the usefulness of things like structs
[06:26:17] dymk: but there's still techncially special language support for structs?
[06:26:40] dymk: things like that which might get fixed in v2.x
[06:27:16] dymk: anyways, that's why i think the story isn't that great (re: sevenseacat and Radar)
[06:27:57] dymk: you mean artesian, hand crafted with love, non GMO code?
[06:28:35] dymk: all it needs now is an Our Amazing Journey bankruptcy Medium blog entry
[06:28:59] dymk: "Would I do it again? Of-fucking-course"
[06:29:10] dymk: i'll be here all night folks
[06:29:21] dymk: but really i won't, because work calls tomorrow
[06:29:26] dymk: into the intern silos
[06:29:49] dymk: 1 month or thereabouts, then back to school
[06:30:07] dymk: bay area
[06:30:57] dymk: I'm from norcal, dunno what these areas are
[06:31:24] dymk: baweaver, oh solid, are there ruby meetups often?
[06:31:51] dymk: nofxx: prism_on_a_budget
[06:33:21] dymk: baweaver, but please do let me know about dev meetups, i'm always down for that
[06:33:30] dymk: gotta make the best out of my time in the bay
[06:33:52] dymk: please do pm me with details
[06:34:38] dymk: meetup.com meetup group?
[06:37:08] dymk: baweaver, http://www.meetup.com/sfruby/ ?
[06:38:08] dymk: cool, joined the group

2015-08-15

[21:51:46] dymk: has joined #ruby
[21:52:31] dymk: Hi, I'm looking for a gem that lets you define Ruby objects similar to ActiveModel or Struct, but adds type information to the PORO's methods
[21:52:44] dymk: I remember seeing it a while ago, and can't remember the name
[21:53:02] dymk: hmm I want to say it's virtus
[21:55:22] dymk: Is that so? Hm, any particular reason?
[21:57:08] dymk: Sure, I don't see that as being a reasonable approach to writing Ruby code, but to each his own
[21:57:36] dymk: Not to say I don't love #map, #filter, etc
[21:58:51] dymk: All over the place, functional programming is great when it comes to manipulating lists
[21:59:20] dymk: sure, that can be generalized to data
[21:59:39] dymk: I've tried to apply other functional concepts to Ruby though, like immutable objects, and the language just lacks features to make it worth it IMO
[22:00:16] dymk: I've got a rails app with a fairly complex model graph, and modeling that as a bunch of immutable objects doesn't work with activerecord (which is more of a tooling problem), and it doesn't perform well
[22:00:58] dymk: right, but once you get rid of immutable objects, you've started slipping back into OO land, and I'm not sure where the line is that you've crossed between the two paradigms
[22:01:52] dymk: i honestly think it's more of a rails thing though, the "standard" way of writing rails apps doesn't lend itself well to FP
[22:02:36] dymk: Could you explain what you mean?
[22:05:06] dymk: Ah, no, I didn't mean to use it pejoratively, it's a paradigm that works quite well for my app
[22:05:27] dymk: One of the primary differences between FP and OO as I see it is FP mutates data by making copies, OO mutates data directly
[22:06:10] dymk: Well yes, that's just how you'd do the analogous operations in the FP world, by making copies; everything is immutable
[22:06:39] dymk: Probably, I'm no FP expert
[22:09:41] dymk: That's true, but I'm skeptical how code written in FP fashion would perform given how Ruby isn't optimized for "allocate every time you want to change a field on a structure"
[22:10:29] dymk: Indeed, sometimes being pedantic about languages can be fun though ;)
[22:11:42] dymk: nofxx, what's it give you in return to perform meaningful computation, then?
[22:34:45] dymk: from its github page: "It's developed as a C extension, so it's fast."
[22:35:14] dymk: I'm sure it is fast, but i chuckle a little bit when I see that line of reasoning

2015-08-11

[03:09:45] dymk: has left #RubyOnRails: ("Leaving")

2015-08-09

[05:47:06] dymk: has left #RubyOnRails: ("Leaving")
[16:30:36] dymk: has joined #RubyOnRails
[16:43:30] dymk: has left #RubyOnRails: ("Leaving")
[16:43:44] dymk: has left #ruby: ("Leaving")
[20:15:09] dymk: has joined #RubyOnRails
[20:15:37] dymk: Is it possible to take an ActiveRecord::Relation that has had .select called on it (e.g. Upload.select(:id)) and re-select its columns?
[20:15:53] dymk: E.g. rewhere but for select
[20:18:02] dymk: ah it seems assigning to select_values will do it

2015-08-02

[17:22:39] dymk: Does Rails provide an API for extracting the PG::Result from an ActiveRecord::Relation?
[17:23:08] dymk: Really API doesn't matter that much, I'd just like to know where the PG::Result is being stored so I can pry it out with instance_variable_get or something similar
[17:28:09] dymk: Well, ActiveRecord::Base.connection.instance_variable_get("@connection") would be the PG::Connection
[17:28:33] dymk: and queries are resolved lazily, so I'd imagine the pg::result would be in-flight somewhere in there?

2015-08-01

[18:36:49] dymk: Has anyone ever passed an activerecord postgresql connection off to a native extension and lived to tell the tale?
[18:37:21] dymk: I'd like to do some custom stuff on top of postgres... but not handle all the things like authenticating with the db, i'd like to leave that up to rails
[18:37:34] dymk: mm thanks baweaver
[18:37:37] dymk: has joined #RubyOnRails
[18:38:27] dymk: Has anyone had experience with taking a connection to PG from Activerecord, and passing that connection directly to a native extension?
[18:38:44] dymk: and hopefully getting the raw libpg database connection from it

2015-07-29

[14:48:43] dymk: has left #ruby: ()
[14:48:51] dymk: has joined #ruby

2015-07-28

[02:13:21] dymk: It seems like there's no way to change the path of a gem based on the group the gem is in
[02:13:29] dymk: has anyone done that before?
[02:14:21] dymk: RickHull, lets say you've got `gem "my_priv_gem", path: "../../some_path"` that exists on development, but at a different path in prod
[02:14:44] dymk: RickHull, what I did was put two `gem my_private_gem` in different groups with different paths
[02:14:58] dymk: however bundler complains about duplicate gems
[22:08:16] dymk: adaedra: correct
[22:08:48] dymk: apeiros: wait what? Really?

2015-07-27

[03:01:44] dymk: Is there a builtin native method for getting an array's length in an extension?
[03:03:32] dymk: Ox0dea, many things ought to get a mention in extension.rdoc :P
[03:11:10] dymk: What's ruby got the concept of an ID for?
[03:11:26] dymk: seems the way to get a symbol's value is go from c string -> ID -> VALUE
[03:11:34] dymk: but I don't understand why that intermediate step exists
[03:12:28] dymk: the docs make it seem like a distinct concept
[03:24:10] dymk: Ox0dea, oh so I can use that as identity then when checking if one thing is the same instance as another
[03:24:22] dymk: alright very cool
[03:26:50] dymk: Ox0dea, no I think I got it
[03:27:19] dymk: it can be thought of as a pointer to the memory of the instance in question
[03:27:48] dymk: >> [:foo.object_id, :bar.object_id, :foo.object_id]
[03:27:53] dymk: >> [:foo.object_id, :bar.object_id, :foo.object_id]
[03:28:10] dymk: it seems they're deterministic right here unless ruboto is caching
[03:28:45] dymk: hah, that sounds exploitable
[03:32:55] dymk: that great feeling when unittests are passing and your code isn't segfaulting
[03:39:03] dymk: what're my options when it comes to securing a private gem server?
[03:39:46] dymk: well more like will geminabox allow me to force ssh authentication or something similar :P
[03:39:54] dymk: sorry that was a pretty bad question, I will admit
[03:41:21] dymk: mm man i'm a rails guy, i need my solutions to literally write themselves for me ;)
[03:41:47] dymk: honestly it'll be easier to just copy/paste the gem into a vendored directory I think
[03:58:21] dymk: you know, it's really quite moving to see stuff in development.log from over a year ago
[03:58:33] dymk: the initial "Processing by Rails::WelcomeController#index as HTML"
[04:49:01] dymk: [k-, it doesn't make sense for it to be deterministic, but perhaps it is
[04:49:17] dymk: i like how the name [k- and the word deterministic lined up there
[04:49:36] dymk: only three letters off to have gone 3/3
[04:49:49] dymk: coulda made bash.org history
[04:51:44] dymk: >>> mfw three chevrons makes it look like a python shell
[04:51:56] dymk: oh yeah the robot didn't like that
[04:52:20] dymk: this native extension is seriously the bees knees
[04:52:33] dymk: it's a big graph database so i can avoid postgres all together