我的代码是这样的:
<?php
class A {
public function CallA()
{
echo "callA" . PHP_EOL;
}
public static function CallB()
{
echo "callB" . PHP_EOL;
}
public static function __callStatic($method, $args)
{
echo "callStatic {$method}";
}
}
A::CallA();
Run Code Online (Sandbox Code Playgroud)
但它会回应:
Strict Standards: Non-static method A::CallA() should not be called statically in /vagrant/hades_install/public/test.php on line 21
callA
Run Code Online (Sandbox Code Playgroud)
也就是说,CallA不会遇到功能__callStatic
如果我想__callStatic通过使用调用,我该怎么办?A::CallA()
我怎样才能在针对android的react-native中重新设置上一个活动?
我的想法是:
1在index.android.js中设置_navigate
// ???????
var _navigator;
BackAndroid.addEventListener('hardwareBackPress', function() {
if (_navigator && _navigator.getCurrentRoutes().length > 1) {
_navigator.pop();
return true;
}
return false;
});
Run Code Online (Sandbox Code Playgroud)
2在RouteMapping中传递导航器:
RouteMapper: function(route, navigationOperations, onComponentRef) {
_navigator = navigationOperations;
if (route.name === 'detail') {
// ?????
return (
<DetailScreen
navigator={navigationOperations}
question={route.question} />
);
} else if (route.name == 'front') {
// ??
return(
<FrontScreen
navigator={navigationOperations}
/>
);
}
},
Run Code Online (Sandbox Code Playgroud)
3在列表视图中设置推送
gotoDetail: function(question: Object) {
this.props.navigator.push({
id: question.question_id,
name: 'detail',
question: question
})
Run Code Online (Sandbox Code Playgroud)
但它不起作用.当我点击Android中的后退按钮时,它会跳出应用程序?
我怎样才能做到这一点?
或者任何人都能举一些例子?
我知道我可以通过参数传递参数
spark-submit com.xxx.test 1 2
Run Code Online (Sandbox Code Playgroud)
并得到参数:
def main(args: Array[String]): Unit = {
// ????
var city = args(0)
var num = args(1)
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有一个传递命名参数的路径,如:
spark-submit com.xxx.test --citys=1 --num=2
Run Code Online (Sandbox Code Playgroud)
以及如何在main.scala中获取此命名参数?
在我的项目中,如果我这样编写pom:
...
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>post-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
...
Run Code Online (Sandbox Code Playgroud)
运行mvn install后,它不会在我的项目中生成报告。
但我将其更改为
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>pre-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
有效!!
我想知道有什么不同?
我在这里阅读了官方文档:http : //www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html
目标prepare-agent仅用于jvm代理的set属性,而不是启动jvm代理,为什么有必要?
有问题的JSON字符串如下所示:
{
"development":{
"connector":[
{"id":"connector-server-1", "host":"127.0.0.1", "port":4050, "wsPort":3050},
{"id":"connector-server-2", "host":"127.0.0.1", "port":4051, "wsPort":3051},
{"id":"connector-server-3", "host":"127.0.0.1", "port":4052, "wsPort":3052}
],
"chat":[
{"id":"chat-server-1", "host":"127.0.0.1", "port":6050},
{"id":"chat-server-2", "host":"127.0.0.1", "port":6051},
{"id":"chat-server-3", "host":"127.0.0.1", "port":6052}
],
"gate":[
{"id": "gate-server-1", "host": "127.0.0.1", "wsPort": 3014}
]
},
"production":{
"connector":[
{"id":"connector-server-1", "host":"127.0.0.1", "port":4050, "wsPort":3050},
{"id":"connector-server-2", "host":"127.0.0.1", "port":4051, "wsPort":3051},
{"id":"connector-server-3", "host":"127.0.0.1", "port":4052, "wsPort":3052}
],
"chat":[
{"id":"chat-server-1", "host":"127.0.0.1", "port":6050},
{"id":"chat-server-2", "host":"127.0.0.1", "port":6051},
{"id":"chat-server-3", "host":"127.0.0.1", "port":6052}
],
"gate":[
{"id": "gate-server-1", "host": "127.0.0.1", "wsPort": 3014}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我想用这样的代码解析它:
package config
import(
"sync"
"io/ioutil"
"encoding/json" …Run Code Online (Sandbox Code Playgroud)