小编jia*_*eng的帖子

如何将秘密Gist更改为公开?

我上传了Gist代码并将其设置为秘密.

现在我想将要点改为公开,但我找不到如何公开...

有人可以帮我吗?

gist

113
推荐指数
3
解决办法
1万
查看次数

如果存在非静态函数,__ callStatic不会调用

我的代码是这样的:

<?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()

php

5
推荐指数
1
解决办法
1375
查看次数

我怎样才能在针对android的react-native中重新设置上一个活动?

我怎样才能在针对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中的后退按钮时,它会跳出应用程序?

我怎样才能做到这一点?

或者任何人都能举一些例子?

react-native

5
推荐指数
1
解决办法
3090
查看次数

如何通过自制软件从1.4升级到1.5

我尝试brew升级去

它始终显示:

去1.4.1已安装

我如何升级到1.5?

homebrew go

5
推荐指数
3
解决办法
1万
查看次数

可以使用命名参数进行spark-submit吗?

我知道我可以通过参数传递参数

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中获取此命名参数?

scala distributed-computing apache-spark

5
推荐指数
1
解决办法
1462
查看次数

在jacoco-maven-plugin中是否需要prepare-agent目标?

在我的项目中,如果我这样编写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代理,为什么有必要?

java maven jacoco

4
推荐指数
1
解决办法
4162
查看次数

如何在Go中解析此JSON字符串?

有问题的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)

json go

2
推荐指数
1
解决办法
3279
查看次数