小编Abh*_*ndi的帖子

更改Android Studio的xcrun开发人员路径

我正在使用GIT,我正在尝试推送我的代码,并在使用终端时收到以下错误.我不使用XCode,我正在使用Android Studio.

我尝试使用的命令是:

git branch网络

错误:

xcrun:错误:无效的活动开发人员路径(/ Library/Developer/CommandLineTools),缺少xcrun:/ Library/Developer/CommandLineTools/usr/bin/xcrun`

我正在运行El Capitan Beta 4更新,无论如何都有帮助.

git intellij-idea xcrun android-studio osx-elcapitan

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

在`Thread.setDefaultUncaughtExceptionHandler`中显示一个对话框

当我的android应用程序抛出异常时,我想显示一个自定义对话框告诉用户发生了错误,所以我Thread.setDefaultUncaughtExceptionHandler用来设置一个全局异常处理程序:

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, final Throwable ex) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getApplicationContext());
                builder.setTitle("There is something wrong")
                        .setMessage("Application will exit?" + ex.toString())
                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                // throw it again
                                throw (RuntimeException) ex;
                            }
                        })
                        .show();
            }
        });
    }

}
Run Code Online (Sandbox Code Playgroud)

但我发现它有任何异常抛出,AlertDialog不会显示,而是应用程序阻塞,过了一会儿,它会显示一个系统对话框:

X app is not responding. Would you like to close …
Run Code Online (Sandbox Code Playgroud)

android exception-handling android-alertdialog android-dialog

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

为什么Restlet on GAE表示Component为NULL

在对Restlet资源发出的每个请求中,我都会在Google App Engine日志中看到以下日志

21:38:50.059 javax.servlet.ServletContext log: ExampleAPIs: [Restlet] ServerServlet: component class is null
21:38:51.568 javax.servlet.ServletContext log: ExampleAPIs: [Restlet] Attaching application: com.example.api.ExampleAPIConfig@68ec99 to URI: /example/v1
Run Code Online (Sandbox Code Playgroud)

为什么说Component是null? 我同意我没有定义组件而是使用ServerResources并将它们映射到Application类中的路由器.但这就是根据Restlet GAE Edition文档应该如何完成的.

布线路线的应用等级

public Example extends Application {
    @Override
    public Restlet createInboundRoot() {
        router = new Router(getContext());
        CorsService corsService = new CorsService();         
        corsService.setAllowedOrigins( new HashSet<String>(Arrays.asList("http://example.com")));
        corsService.setAllowedCredentials(true);
        getServices().add(corsService);

         router.attach("/xyz", XYZ.class);
    }
}
Run Code Online (Sandbox Code Playgroud)

处理并返回JSON表示的服务器资源

public class XYZ extends ServerResource {

    private static final Logger logger = Logger.getLogger("API:Xyz");

    @Get(":json")
    public Representation handleGetRequest() {
         ..
         return new …
Run Code Online (Sandbox Code Playgroud)

java google-app-engine restlet

8
推荐指数
1
解决办法
371
查看次数

跳过$观看初次通话

因此,为可怕的头衔提前道歉.我真的不知道这些东西的所有正确的角度术语.

我在范围内有这样的代码:

$scope.catName = 'Le cat'

//<-- Magic goes here

$scope.$watch('catName', function () {
    //[...]
})
Run Code Online (Sandbox Code Playgroud)

现在,由于角度等到下一个摘要(正确的术语?)来评估手表,我的初始分配('Le cat')将触发手表.

我希望这个配置不会触发手表,但在此之后更改会这样做.

有没有办法重置catName的'脏状态'?

Js-fiddle:http://jsfiddle.net/7DNrD/1/

javascript angularjs

7
推荐指数
1
解决办法
2535
查看次数

startActivity(意图)错误,出错了什么?

下面的代码startActivity(intent)给出了一个错误

这是我的代码:

public class MyWebViewClient3 extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (Uri.parse(url).getHost().equals("www.facebook.com")) {
            // This is my web site, so do not override; let my WebView load the page
            return false;
        }
        // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        startActivity(intent);//this is where it goes wrong
        return true;
        }
}
Run Code Online (Sandbox Code Playgroud)

url tabs android webview android-intent

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

在时间分区的bigquery表中,何时将数据写入__UNPARTITIONED__?有什么影响?

我遇到了一些时间分区的bigquery表格的未记录的未记录行为:

我在BigQuery中创建了一个时间分区表并插入了数据.我能够正常插入 - 数据写入今天的分区(我也能够明确指定分区并写入其中)

在对新数据进行一些测试之后,我删除了今天的分区,以获得干净的数据:(CLI)

bq --project_id=my-project rm v1.mytable$20160613
Run Code Online (Sandbox Code Playgroud)

然后我检查它是否为空:

select count(*) from [v1.mytable]
Run Code Online (Sandbox Code Playgroud)

结果 270而不是0

我再次尝试删除并重新运行查询 - 相同的结果.所以我问了

select count(*) from [v1.mytable$20160613]
Run Code Online (Sandbox Code Playgroud)

结果 0

所以我可能已插入数据的几个日期,但都是0.最后我跑了

SELECT partition_id from [v1.mytable$__PARTITIONS_SUMMARY__];
Run Code Online (Sandbox Code Playgroud)

结果

{ UNPARTITIONED 20160609 20160613}

并且所有数据实际上都是在UNPARTITIONED中

我的问题:

  1. 何时将数据写入此特殊分区而不是每日分区,如何避免这种情况?
  2. 是否有其他影响,除了失去解决特定日期(在查询中,或删除数据等)的能力?我应该照顾这个案子吗?

google-bigquery

4
推荐指数
2
解决办法
1243
查看次数