我的服务器上只有32GB,而且日志很快占用了这个空间.所以我想禁用日志.
我想我找到了它的位置,但由于我是服务器上的一个完整的菜鸟,我不想在不确定它们不会崩溃服务器的情况下开始改变事物.
在etc/apache2/apache2.conf中,我发现了这个:
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
Run Code Online (Sandbox Code Playgroud)
在etc/apache2/conf.d/other-vhost-access-log中,我发现了这个:
# …Run Code Online (Sandbox Code Playgroud) 我正在尝试对我的debian vps(apace2,mysql)进行推送通知.
我使用本教程中的PHP脚本(http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2).
基本上,脚本放在一个无限循环中,每隔几秒检查一次mysql表中的新记录.该教程说它应该作为后台进程运行.
// This script should be run as a background process on the server. It checks
// every few seconds for new messages in the database table push_queue and
// sends them to the Apple Push Notification Service.
//
// Usage: php push.php development &
Run Code Online (Sandbox Code Playgroud)
所以我有四个问题.
如何从终端启动脚本?我应该输入什么?服务器上的脚本位置是:
/var/www/development_folder/scripts/push2/push.php
如果需要,我怎么能杀死它(不必重新启动)?
由于推送通知是必不可少的,我需要一种方法来检查脚本是否正在运行.代码(来自教程)调用函数出错了:
function fatalError($message)
{
writeToLog('Exiting with fatal error: ' . $message);
exit;
}
Run Code Online (Sandbox Code Playgroud)也许我可以在那里放一些东西来重启脚本?但是,如果脚本正在运行,那么每隔5分钟左右检查一次cron作业或其他事情也会很好,并且如果它没有,则启动它.
4 - 我可以在apace或mysql重启后自动启动脚本吗?如果服务器崩溃或其他需要快速重启的事情发生?
非常感谢提前
我有一个单例类处理所有Game Center逻辑:
typedef void (^GameCenterCallbackFinishUpdating)();
- (void)getAllMatches:(GameCenterCallbackFinishUpdating)onComplete
{
[GKTurnBasedMatch loadMatchesWithCompletionHandler:^(NSArray *matches, NSError *error)
{
//Do stuff here...
onComplete();
}];
}
Run Code Online (Sandbox Code Playgroud)
从另一个viewController我使用:
[[GameCenterHelper sharedHelper] getAllMatches:^{
[self.myTableView reloadData];
}];
Run Code Online (Sandbox Code Playgroud)
当我在应用程序中时,它工作得很好,但是一旦我关闭应用程序(背景)然后再次启动它,我得到:
onComplete(); ---- Thread 1: EXC_BAD_ACCESS (code=2, address=0xc)
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?
我连续有x个视图:
[view1] [view2] [view3]
我需要能够拖动和重新排序它们中的任何一个(仅在水平方向),还需要插入新视图.
你会如何实现这个?
我猜是这样的:
- (void)didDragView:(UIView *)currentView
{
for (UIView *v in self.viewsArray)
{
if (currentView.center.x < v.center.x)
// Move view to index: [self.viewsArray indexOfObject:v];
}
}
Run Code Online (Sandbox Code Playgroud) 为什么这不起作用:
self.backButton?.addTarget(self, action: Selector("backButtonPressed:"), forControlEvents: .TouchUpInside)
// unrecognized selector sent to instance CRASH
func backButtonPressed(sender:AnyObject?) {
}
Run Code Online (Sandbox Code Playgroud)
这次崩溃(发送到实例的无法识别的选择器)
func backButtonPressed(sender:UIButton) {
}
Run Code Online (Sandbox Code Playgroud) 试图找出ng-if.为什么要执行警报功能?谢谢
<div ng-if="false">
<script> alert("a"); </script>
</div>
Run Code Online (Sandbox Code Playgroud) 我在另一篇文章中找到了关于如何生成随机数的答案:
-(NSString *) genRandStringLength:(int)length
{
NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
NSMutableString *randomString = [NSMutableString stringWithCapacity: length];
for (int i = 0; i < length; i++) {
[randomString appendFormat: @"%c", [letters characterAtIndex: rand()%[letters length]]];
}
return randomString;
}
Run Code Online (Sandbox Code Playgroud)
我建立一个游戏,需要为每场比赛生成一个唯一的ID.如果我每天有100,000个新的比赛(当比赛完成,它被删除并且其唯一ID可以重复使用),在上面的代码中使用什么是安全的长度,以确保不会有任何冲突(2匹配相同的ID)?或者是否有更好的方法来生成唯一ID?
我想尝试保持长度的性能,因为它将来回发送到服务器.
谢谢
我有下面的代码来动画分数标签.你会如何改变它,以便它成为一个轻松的动画?
谢谢
- (void)animateFrom:(float)fromValue toValue:(float)toValue
{
self.scoreAnimationFrom = fromValue;
self.scoreAnimationTo = self.question.correctValue;
CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(animateNumber:)];
self.startTimeInterval = CACurrentMediaTime();
[link addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}
- (void)animateNumber:(CADisplayLink *)link
{
float dt = ([link timestamp] - self.startTimeInterval) / self.duration;
if (dt >= 1.0)
{
[link removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
return;
}
float current = ((self.scoreAnimationTo - self.scoreAnimationFrom) * dt + self.scoreAnimationFrom);
self.valueLabel.text = [NSString stringWithFormat:@"%f", current];
}
Run Code Online (Sandbox Code Playgroud) 如何在React本机中转换元素的用户交互,类似于IOS,在这种情况下为MapView.
userInteraction = false
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在编写备份作业,需要获取 Parse-server 中的所有类,以便我可以查询所有行并导出它们。
我如何获取所有课程?
谢谢
objective-c ×5
ios ×4
apache ×2
apache2 ×2
debian ×2
php ×2
angularjs ×1
iphone ×1
math ×1
parse-server ×1
react-native ×1
swift ×1
xcode ×1