How to convert MKCoordinateRegion to a CBLGeoRect?

2015-10-21 Thread Brendan Duddridge
Hi, I have an MKMapView which is providing me with the displayed region in the format of an MKCoordinateRegion. The structure looks like this: typedef struct { CLLocationDegrees latitudeDelta; CLLocationDegrees longitudeDelta; } MKCoordinateSpan; typedef struct { CLLocationCoo

Re: How to convert MKCoordinateRegion to a CBLGeoRect?

2015-10-21 Thread Jens Alfke
Looks like simple addition & subtraction? Or am I missing something? I mean, the MK struct gives you the center point and dimensions of the rect. A CBLGeoRect contains the min and max coords. —Jens On Oct 21, 2015, at 12:57 AM, Brendan Duddridge mailto:brend...@gmail.com>> wrote: Hi, I have a

Setting up CORS on Sync Gateway

2015-10-21 Thread Todd Freese
I am having troubles setting up CORs support on my sync gateway. I've swapped out my real domain name with xxx for posting purposes. On my SG server (https://db.xxx.com), I added the following to my config.json: "CORS": { "origin":["https://webclient.xxx.com";],

Re: Setting up CORS on Sync Gateway

2015-10-21 Thread ajres
I have not done this myself, but I found an SE Q and A that suggests nginx needs to be configured to pass the 'Access-Control-Allow-Origin' header. http://serverfault.com/questions/162429/how-do-i-add-access-control-allow-origin-in-nginx Andy -- You received this message because you are subscr

Re: Setting up CORS on Sync Gateway

2015-10-21 Thread Todd Freese
Tried that, still a no go. Seems like sync gateway needs to be inserting the Access-Control-Allow-Origin header, which I'm not sure is happening... T -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop

Re: Setting up CORS on Sync Gateway

2015-10-21 Thread Todd Freese
I'll add that I see the OPTIONs request in the SG log. Is there a way to see this response? The Chrome debugger shows the request, but not the response. Todd -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group a

Re: Setting up CORS on Sync Gateway

2015-10-21 Thread Jens Alfke
On Oct 21, 2015, at 10:06 AM, Todd Freese mailto:to...@filmworkers.com>> wrote: I'll add that I see the OPTIONs request in the SG log. Is there a way to see this response? The Chrome debugger shows the request, but not the response. I don’t think SG has an option to log HTTP responses. The ge

Re: Setting up CORS on Sync Gateway

2015-10-21 Thread Todd Freese
So I got this working. Turns out I had a typo in my config file. Yes a typo. Sorry for the noise! Todd -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: Setting up CORS on Sync Gateway

2015-10-21 Thread Todd Freese
I'll add this to the thread for the next person... I did not have to make any changes to my Nginx config to get CORS to work. Todd -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails fro

best practices for checking a related document for access info

2015-10-21 Thread Seung Chan Lim
I have the following two types of documents 1. space 2. conversation: "space" attribute points to the _id of space Whenever a conversation starts, a new doc of type "conversation" is created and its attribute "space" contains the _id of a doc of type "space" What I want to ensure in my sync fu

Re: best practices for checking a related document for access info

2015-10-21 Thread Seung Chan Lim
What I'm leaning toward is just creating a EVERYONE role, then adding any new user to that role. Then giving any public space provide access to that role. I guess that's the way? slim On Wednesday, October 21, 2015 at 5:36:39 PM UTC-4, Seung Chan Lim wrote: > > I have the following two types o

Re: best practices for checking a related document for access info

2015-10-21 Thread Jens Alfke
On Oct 21, 2015, at 2:36 PM, Seung Chan Lim mailto:djs...@gmail.com>> wrote: I thought I could do this by doing access("GUEST", doc._id) when a space doc is created/updated but that doesn't seem to work. It doesn’t work because GUEST is a specific account used for requests without authorizati

Re: How to convert MKCoordinateRegion to a CBLGeoRect?

2015-10-21 Thread Brendan Duddridge
In CBLGeoRect, there's min and max. Does x in the CBLGeoPoint structs correspond to longitude and y is latitude? And does min correspond to the North West and max to the South East? I'm not quite sure I'm emitting my coordinates properly in my map function. Here's my map function emit: emit(CB

Re: How to convert MKCoordinateRegion to a CBLGeoRect?

2015-10-21 Thread Brendan Duddridge
I finally got it working tonight the way it should. I switched my map function to emit longitude first and then latitude: emit(CBLGeoPointKey([locationData[@"lon"] doubleValue], [locationData[@"lat"] doubleValue]), nil); And my routine to convert from my MKCoordinateRegion to a CBLGeoRect is