Page 1 of 1
[09:02:28] consti: Hi! I'm trying to build json on CentOS 6; I get the following error: https://gist.github.com/anonymous/a837d5ac22486bb2a79a (/usr/bin/install: cannot stat `generator.so': No such file or directory)
[09:03:28] consti: I'm not even 100% sure if #ruby is the right channel for this :) ??? what's the best procedure to figure out what is really missing on my OS?
[09:06:30] consti: avril14th: I'll look if I can fix it with hanmac1's comment - otherwise I'll go check #centos :)
[08:36:20] consti: whats the best pattern to solve the following issue: When a User signs up, he can create a new Location - if that Location already exists, he should use that Location (but he should not be able to change the Locations attributes). If a Location has no more users, it should be destroyed.
[08:38:33] consti: In User, I've: belongs_to :location; and accepts_nested_attributes_for :location. I've tried to solve the problem of 'duplicate' Location creations in User before_validation: user.location = Location.where(unique_place_id_i_get_from_google_maps: user.location.unique_place_id_i_get_from_google_maps).first_or_initialize
[09:12:41] consti: apeiros: thanks.. but that doesn't solve the problem. where(place_id: xxx).first_or_create will screw up my counter_caches. I'm really getting a little mad here. I planned to spend 30 minutes on 'fixing that little annoiance' and now I've screwed most of the things up and will probably do a git reset --hard ;)
[09:32:31] consti: setting an associated model (and _not_ saving it yet) will decrement the counter_cache.
[04:40:15] consti: hi! I'm refactoring some code and have a snippet in the controller where I receive json data (as a params), which I split up and assign to variables. it's 4 loc and I'm not sure if I should move that somewhere else (if yes, where? would that be a module?) thanks!
[04:46:14] consti: I've another thing: I've a Device model that can receive push notifications (iOS). That logic was in the controller, I moved that into Device#receive_push_notification. Would you move that into the Device class or in its own PushNotification class?
[04:48:00] consti: quazimodo: no logic before assignment - so I'll just keep these in the controller. moving out the push notifications made sense.
[10:14:49] consti: Hi! I've multiple items with GPS data and a timestamp. I'm trying to figure out a structure where I can group these items by their GPS coordinates and a time 'bucket': I've 4TB of photos from camera traps out of a jungle and I need to group them into time buckets (e.g. a lion runs by and we have 20 pictures of that, within a certain time range).
[10:17:37] consti: I can't figure out a good way to do that: right now I've created a model called CameraEvent (has_many photos) with uniqueness on a scope of latitude, longitude, hour_since_beginning_of_time (or something similar). That would at least group the images into hourly buckets for each lat/lng. But that's ugly and not really what I want. Does anyone have an idea how I could do that?
[10:19:25] consti: workmad3: that might be the right tool for the job. I've not worked with elasticsearch yet, but I'll look into it. thanks!
[10:22:09] consti: workmad3: that's pretty cool. But my main issue is something like 'auto-grouping'. I'm importing massive amounts of photos and need them to automagically group into 'events'. I set a threshold (like 10 minutes) and for all images that have been taken within that threshold at the same location I want a collection 'CameraEvent'.
[10:26:18] consti: workmad3: mh.. at the end of the day (literaly speaking, since that should go live tomorrow ;) ) I need a list of all events within a threshold (that doesn't have to be dynamic) and the collection of photos of each event.
[10:29:21] consti: workmad3: until tomorrow I'll only have to import a couple of species ;) (I'm running exiftool to extract/group the raw images into the species folders right now in the background.. I hope that's going to be finished until I'm done with the site). But yes, it's a short deadline. you'll probably see me on IRC for the next 20h! ;)
[10:49:59] consti: workmad3: ah! that's so much more clever than my approach. I didn't think about adding two time ranges (start and end) into the model. I only added one (something like (time.to_i/3600)*3600 as the_hour)
[10:52:15] consti: workmad3: thanks! after importing the specific species for tomorrow, I'll have more than enough time to import the rest. unfortunately the uploading to S3 and resizing will take most of the time.
[10:52:53] consti: workmad3: will you hang around here later? I'll get things done and then would love to send you some bitcoin for beer or two (it that's your thing ;) )
[10:53:43] consti: workmad3: unfortunatly I don't. but maybe I'll come up with a way to extract that data from the raw files..
[10:55:07] consti: workmad3: no. just raw image files with a creation date (and exif data that hopefully includes GPS - some of the files don't).
[11:01:27] consti: workmad3: I'll store the location within the event. unfortunately the cameras will move in different seasons
[11:04:22] consti: workmad3: I _had_ a scaffold for CameraEvent (based on the exif data of some pictures.. some of the cameras did create sequences and events on their own.. but I had to learn that they misconfigured the cameras to only count something as an event as long as it was less than 3 photos.. so that didn't work)
[11:05:40] consti: workmad3: what's the best type for end_time/start_time (migration)? I went with date earlier - but now I'm not sure?
[14:36:32] consti: * actually named scope is: scope :previous ->(id) do where("id < :id", id: id) end
[14:36:39] consti: * actually named scope is: scope :previous ->(id) do where("id < :id", id: id).first end
[16:42:42] consti: Hi! Is there any way to have an object, set some attr_accessor and then return the object (and return nil, if object is nil), in one line?
[16:43:53] consti: ACTION Something like this (using ActiveRecord from Rails in that case, but that's not important):Object.all.first.send(:my_accessor=, other_my_accessor).return_the_object
[16:44:40] consti: Something like this (using ActiveRecord from Rails in that case, but that's not important): Object.all.first.send(:my_accessor=, other_my_accessor).return_the_object
[23:21:11] consti: Hi! What's the best practice to get a 'next' / 'previous' scope for nested resources? (E.g. cameras/1/photos/82 -> next would be cameras/1/photos/86 since photos with ID 82 and 86 belong to camera 1)
[23:28:23] consti: morenoh149: Photo belongs_to :camera, Camera has_many :photos; So there could be (and will be) multiple photos in between the different IDs that belong to other cameras (the last integer in the URL is the ID of Photo).
[23:33:27] consti: morenoh149: I thought there might be a best practice. You would think more people run into that 'issue' with nested resources. categories/5/posts/9 (how to I link to the next post within the same category?)