我有一个包含纬度、经度、用户 ID 和半径列的 MySQL 表。当用户提供他的当前位置(纬度,经度)以及半径时,我想查询表以根据两个半径为他提供重叠位置。
例如,如果用户给我 12.5 的纬度;经度为 73.5,半径为 5 英里;我应该能够检索 MySQL 表中两个半径重叠的所有条目。
我最初的想法是为数据库中的每个纬度、长度创建一个边界框(基于半径),然后根据这个边界框查询传入的位置详细信息。这种方法是否正确?如果我走这条路,我应该担心什么?任何指导我朝着正确方向前进的帮助将不胜感激。
PS:以下链接是我用作参考的链接。
我试图在我的ViewController中有一个可拖动的UIView,最终这个UIView将成为一个可点击的按钮但是现在,当它被拖动到屏幕上时,我仍然坚持更新该视图的约束.代码如下.
- (void)viewDidLoad
{
[super viewDidLoad];
self.anotherView = [[UIView alloc]init];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(dragging:)];
[self.anotherView addGestureRecognizer:panRecognizer];
[self.anotherView setBackgroundColor: [UIColor blueColor]];
self.anotherView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview: self.anotherView];
[self.view bringSubviewToFront:self.anotherView];
NSDictionary *views = @{@"subview" : self.anotherView, @"superview" : self.view};
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.anotherView
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self.view
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.anotherView
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationLessThanOrEqual
toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.anotherView
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
toItem:Nil
attribute:NSLayoutAttributeWidth
multiplier:1.0
constant:20]];
[self.view addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"V:[subview(40)]"
options:0
metrics:nil
views:views]];
// add horizontal constraints
/*[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[subview(==20)]|" options:0 …Run Code Online (Sandbox Code Playgroud) 我正在为一些简单的功能开发基本API.我正在捕获如下输入:
if ($action == 'delete' && isset($_POST['targetId']) && isset($_POST['userId'])) {
//The isset causes "Do not access Superglobal _POST array directly" warning in Netbeans
$userId = filter_input(INPUT_POST, 'userId');
$beamId = filter_input(INPUT_POST, 'targetId');
}
Run Code Online (Sandbox Code Playgroud)
我是否应该使用filter_input来检查值是否已设置?喜欢:
if ($action == 'delete' && filter_input(INPUT_POST, 'targetId') && filter_input(INPUT_POST, 'userId')) {
}
Run Code Online (Sandbox Code Playgroud)
我不是在看这里的选项而是我会对最安全和防黑客的最正确的解决方案感到满意.
编辑:是的,上述信息将用作SQL的输入
php ×2
autolayout ×1
constraints ×1
geofencing ×1
ios ×1
isset ×1
mysql ×1
objective-c ×1
superglobals ×1
uiview ×1