我正在玩HomeKit,我正在尝试添加一个新家.这是我的代码:
func addHome()
{
homeManager.addHomeWithName("My House", completionHandler:
{ (error: NSError!, home: HMHome!) in
if error
{
NSLog("%@", error)
}
})
}
Run Code Online (Sandbox Code Playgroud)
这给出了编译器错误:
Run Code Online (Sandbox Code Playgroud)Cannot convert the expression's type 'Void' to type 'String!'
我试过指定一个返回类型Void:
...
{ (error: NSError!, home: HMHome!) -> Void in
...
Run Code Online (Sandbox Code Playgroud)
无济于事.有没有人有任何想法如何解决这个问题?传递nil给完成处理程序修复了错误,但当然我想在完成时做一些事情.
有没有办法从列的所有值中减去最小值?我需要从第一列中的所有其他数字中减去第一列中的第一个数字.
我写了这个脚本,但它没有给出正确的结果:
$ awk '{$1 = $1 - 1280449530}' file
1280449530 452
1280449531 2434
1280449531 2681
1280449531 2946
1280449531 1626
1280449532 3217
1280449532 4764
1280449532 4501
1280449532 3372
1280449533 4129
1280449533 6937
1280449533 6423
1280449533 4818
1280449534 4850
1280449534 8980
1280449534 8078
1280449534 6788
1280449535 5587
1280449535 10879
1280449535 9920
1280449535 8146
1280449536 6324
1280449536 12860
1280449536 11612
Run Code Online (Sandbox Code Playgroud) 我对这段代码有一些奇怪的警告:
typedef double mat4[4][4];
void mprod4(mat4 r, const mat4 a, const mat4 b)
{
/* yes, function is empty */
}
int main()
{
mat4 mr, ma, mb;
mprod4(mr, ma, mb);
}
Run Code Online (Sandbox Code Playgroud)
gcc 输出如下:
$ gcc -o test test.c
test.c: In function 'main':
test.c:13: warning: passing argument 2 of 'mprod4' from incompatible pointer
type
test.c:4: note: expected 'const double (*)[4]' but argument is of type 'double
(*)[4]'
test.c:13: warning: passing argument 3 of 'mprod4' from incompatible pointer
type
test.c:4:
note: …Run Code Online (Sandbox Code Playgroud) 我有以下SQL:
ALTER PROCEDURE [dbo].[usp_gettasks]
@ID varchar(50)
AS
declare @PDate Date
WHILE (DATEPART(DW, @PDate) = 1 OR DATEPART(DW, @PDate) = 7 )
BEGIN
set @PDate = DATEADD(day, 1, @PDate)
END
CREATE VIEW tblList AS
select tt.ItemOrder,tt.DisplayVal, DATEADD(day, tt.DaysDue, @PDate) from tblLine tt
where tt.ID = 1
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:
语法错误:'Create VIEW'必须是批处理中唯一的语句
我GO之前尝试过Create View,但后来无法识别它的价值PDate.
我正在尝试使用Xcode 6编译现有的应用程序.
这是我的代码:
UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];
Run Code Online (Sandbox Code Playgroud)
这是我的错误:
use of undeclared identifier 'UIUserNotificationSettings'
Run Code Online (Sandbox Code Playgroud)
我不知道如何解决这个问题.
这是我对iOS 8的检查:
if (SYSTEM_VERSION_LESS_THAN(_iOS_8_0)) {
// Displaying notifications and ringing
if ([self isMissingMandatoryNotificationTypes:[UIApplication.sharedApplication enabledRemoteNotificationTypes]]) {
[self registrationWithSuccess:^{
DDLogInfo(@"Push notifications were succesfully re-enabled");
} failure:^{
[self.missingPermissionsAlertView show];
}];
}
} else {
// UIUserNotificationsSettings
UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];
Run Code Online (Sandbox Code Playgroud) 如何在 JavaFX 中使用形状的边框来更改其属性之一 - 高度、宽度、半径等。
我尝试在圆形上使用圆形来调整半径的大小,但我想知道是否可以使用形状的边框来完成。
这是我的自定义圆类:
public class NewCircle extends Circle {
public NewCircle (double x, double y , double radius, Color colore){
super(x,y,radius);
this.setFill(colore);
this.setOnMousePressed(circleOnMousePressedEventHandler);
this.setOnMouseDragged(circleOnMouseDraggedEventHandler);
}
double orgSceneX, orgSceneY;
double orgTranslateX, orgTranslateY;
EventHandler<MouseEvent> circleOnMouseClickedEventHandler = new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent t ){
}
};
EventHandler<MouseEvent> circleOnMousePressedEventHandler = new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent t){
orgSceneX = t.getSceneX();
orgSceneY = t.getSceneY();
Node source = (Node) t.getSource();
orgTranslateX = ((Circle) (t.getSource())).getTranslateX();
orgTranslateY = ((Circle) (t.getSource())).getTranslateY();
((Circle)t.getSource()).toFront();;
}
}; …Run Code Online (Sandbox Code Playgroud) ios ×2
arguments ×1
awk ×1
c ×1
closures ×1
const ×1
function ×1
homekit ×1
ios8 ×1
java ×1
javafx ×1
objective-c ×1
sql-server ×1
subtraction ×1
swift ×1