小编mix*_*xel的帖子

在IntelliJ IDEA中找不到"使用Gradle文件同步项目"按钮

我刚刚将google-play-services-lib库添加到我的项目中,并且卡在我需要"将项目与gradle文件同步"的位置,但IntelliJ 13.0.1上不存在此按钮.这个功能有替代品吗?

android intellij-idea gradle

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

从嵌套在函数中的闭包中快速抛出

我有一个抛出错误的函数,在这个函数中我有一个inside a闭包,我需要从它的完成处理程序抛出错误.那可能吗 ?

到目前为止,这是我的代码.

enum CalendarEventError: ErrorType {
    case UnAuthorized
    case AccessDenied
    case Failed
}

func insertEventToDefaultCalendar(event :EKEvent) throws {
    let eventStore = EKEventStore()
    switch EKEventStore.authorizationStatusForEntityType(.Event) {
    case .Authorized:
        do {
            try insertEvent(eventStore, event: event)
        } catch {
            throw CalendarEventError.Failed
        }

    case .Denied:
        throw CalendarEventError.AccessDenied

    case .NotDetermined:
        eventStore.requestAccessToEntityType(EKEntityType.Event, completion: { (granted, error) -> Void in
            if granted {
                //insertEvent(eventStore)
            } else {
                //throw CalendarEventError.AccessDenied
            }
        })
    default:
    }
}
Run Code Online (Sandbox Code Playgroud)

throws ios swift2

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

流量数据显示在Android Google Maps API v2中的绘制形状(折线)上方

我正在使用折线绘制路线,并且在路线上方显示交通数据,因此路线被交通线部分隐藏.

更新 我在gmap-api-issues上创建了问题并在那里附加了示例源代码(您只需要将Google Maps API密钥添加到AndroidManifest.xml).请"明星"这些问题以吸引谷歌开发者的注意力.

android google-maps z-index google-maps-android-api-2

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

查看两个版本之间Android支持库源代码的更改

我想克隆Android支持库的存储库,看看版本24.1.1和24.2.0之间的变化.

我知道存储库位于此处,但是:

  1. 它的最新提交日期是7月1日,尽管最新的支持库24.2.0发布于8月.
  2. 没有支持库版本24.1.1,24.2.0等标签.

我怎样才能看到版本24.1.1和24.2.0之间的提交?

git android android-source android-support-library

13
推荐指数
1
解决办法
556
查看次数

如何在IntelliJ IDEA中调试Android Gradle项目的特定构建变体?

如果我创建Android Application调试配置并将使用它,那么一切正常,默认情况下IntelliJ IDEA使用debugbuild.gradle中的构建类型.但我想调试特定的构建变体(flavor和build类型).例如,flavor名称是Cabby和构建类型if mock.我创建这样的调试配置:

Cabby Mock Gradle调试配置

然后我开始调试这个配置.Gradle任务assembleCabbyMockinstallCabbyMock成功执行,然后我看到:

在此输入图像描述

debugging android intellij-idea gradle android-gradle-plugin

12
推荐指数
1
解决办法
4012
查看次数

关于Scala中结构类型成员的反射访问的警告

这个警告意味着什么:

应启用结构类型成员方法getMap的反射访问

该警告包括对scala文档的引用,但我不明白我的代码与解释的关系.(具体来说,解释提到了反思......我的代码如何使用反射?)

我有这个:(Scala 2.11.2)

object getMap {
    implicit def fromOptionToConvertedVal[T](o:Option[T]) = new {
        def getMap[R] (doWithSomeVal:(T) => R) = new {
            def orElse(handleNone: => R) = o match {
                case Some(value) => doWithSomeVal(value)
                case None => handleNone
            }
        }
    }   
}

import getMap._
val i:Option[Int] = Some(5)
val x = i getMap (_*2) orElse 1
Run Code Online (Sandbox Code Playgroud)

这会在下面生成警告:

[warn] /Users/Greg/git/Favorites-Demo/src/main/scala/com/rs/server/ThriftServer.scala:34: reflective access of structural type member method getMap should be enabled
[warn] by making the implicit value scala.language.reflectiveCalls visible.
[warn] This …
Run Code Online (Sandbox Code Playgroud)

scala

12
推荐指数
1
解决办法
4235
查看次数

如何提高相对简单的Java计数方法的效率和/或性能?

我正在构建一个必须阅读大量文本文档的分类器,但我发现我的countWordFrequenties方法越慢,它处理的文档就越多.下面的这个方法花了60ms(在我的电脑上),而阅读,规范化,标记化,更新我的词汇和均衡不同的整数列表只需要3-5ms(在我的电脑上).我的countWordFrequencies方法如下:

public List<Integer> countWordFrequencies(String[] tokens) 
{
    List<Integer> wordFreqs = new ArrayList<>(vocabulary.size());
    int counter = 0;

    for (int i = 0; i < vocabulary.size(); i++) 
    {
        for (int j = 0; j < tokens.length; j++)
            if (tokens[j].equals(vocabulary.get(i)))
                counter++;

        wordFreqs.add(i, counter);
        counter = 0;
    }

    return wordFreqs;
}
Run Code Online (Sandbox Code Playgroud)

加快这个过程的最佳方法是什么?这个方法有什么问题?

这是我的整个班级,还有另一个班级类别,在这里发布这个也不错,或者你们不需要吗?

public class BayesianClassifier 
{
    private Map<String,Integer>  vocabularyWordFrequencies;
    private List<String> vocabulary;
    private List<Category> categories;
    private List<Integer> wordFrequencies;
    private int trainTextAmount;
    private int testTextAmount;
    private GUI gui;

    public BayesianClassifier() 
    { …
Run Code Online (Sandbox Code Playgroud)

java methods performance classification word-count

12
推荐指数
1
解决办法
441
查看次数

以编程方式更改工具栏主题

我的代码是:

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        app:theme="@style/Toolbar_Theme"/>
Run Code Online (Sandbox Code Playgroud)

我想在java代码中更改app:theme.我能找到toolbar.setTheme用于改变工具栏样式的方法吗?

android

11
推荐指数
1
解决办法
3690
查看次数

Provision Profile不包括签名证书

我已经将Xcode更新为8,因为我无法运行我的项目.

我尝试启用/禁用"自动管理签名"选项,但继续收到2个警报:

  1. 您的应用ID"..."无法注册到您的开发团队.
  2. 供应资料"..."不包括签署证书"我的签名证书"

我是开发人员门户网站上的团队代理我可以看到我的用户证书,所有这些似乎都是有效的.当我转到Xcode - >首选项 - >帐户时,我可以看到我们的团队帐户附加到我们所有的团队配置文件,但在我的个人证书中,我看不到任何配置文件.

如何将缺少的配置文件添加到我的个人证书中以及为什么会这样?

我没有任何帮助,请点击链接.

xcode ios

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

Android Specific Gradle产品风味组合

在我的代码中,我有一些模板都来自一个代码库.对于每个模板,我想添加特定尺寸.使用风味尺寸和产品口味我已经达到了这个代码:

flavorDimensions "template", "color"

productFlavors {

    templateA {
        applicationId "com.templatea"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "template"
    }


    templateB {
        applicationId "com.templateb"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "template"
    }

    templateC {
        applicationId "com.templatec"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "template"

    }

    blue {
        applicationId "com.blue"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "color"
    }

    green {
        applicationId "com.green"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "color"
    }

    orange {
        applicationId "com.orange"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "color"
    }    
Run Code Online (Sandbox Code Playgroud)

这给出了结果(我忽略了buildtypes):

templateABlue

templateAGreen

templateAOrange

templateBBlue templateBGreen

templateBOrange templateCBlue …

android gradle

9
推荐指数
1
解决办法
904
查看次数