我将以下行添加到build.gradle(Module:app):
compile 'com.android.support:design:25.4.0'
Run Code Online (Sandbox Code Playgroud)
但是当我执行Gradle时,我正在接受
Failed to resolve: com.android.support.design:25.4.0
Run Code Online (Sandbox Code Playgroud)
我从android 支持设计库获得了支持代码并将其添加到新项目中.我将其添加到依赖项部分:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.4.0'
}
Run Code Online (Sandbox Code Playgroud)
关于我做错了什么的任何想法?
最近我一直在为视觉工作室的统一着色器编码,我注意到,由于统一着色器是用Unity的着色器实验室语言和CG组合编写的,因此Visual Studio 2015似乎并不能识别这些语言.因此,当我按Enter键转到新行时,visual studio不会重新关联关键字,没有intellesense,更糟糕的是所有标签都不正确.我已经尝试过这个视觉工作室扩展程序https://visualstudiogallery.msdn.microsoft.com/ed812631-a7d3-4ca3-9f84-7efb240c7bb5,它似乎没有完全奏效.我想知道是否有人在这里有使用着色器的经验,并且有他们知道要解决这个问题的扩展.
我正在尝试将位图从我的应用程序的缓存目录发送到短信应用程序。我正在使用文件提供程序向处理意图的应用程序授予临时权限。当我尝试发送意图并从意图选择器中选择默认的 android 短信应用程序时,我的消息应用程序崩溃并出现此错误。我尝试从意图选择器中选择其他应用程序,例如电子邮件和其他消息传递应用程序,它似乎工作正常,只是在使用默认文本消息传递应用程序时崩溃。
java.lang.SecurityException: Permission Denial: reading android.support.v4.content.FileProvider uri content://com.example.brandon.emojimms2/shared_images/image.png from pid=9804, uid=10024 requires the provider be exported, or grantUriPermission()
Run Code Online (Sandbox Code Playgroud)
private void shareImage()
{
File imagePath = new File(mContext.getCacheDir(), "images");
File newFile = new File(imagePath, "image.png");
Uri contentUri = FileProvider.getUriForFile(mContext, "com.example.brandon.emojimms2", newFile);
if (contentUri != null) {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // temp permission for receiving app to read this file
shareIntent.setDataAndType(contentUri, mContext.getContentResolver().getType(contentUri));
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
startActivity(Intent.createChooser(shareIntent, "Choose an app"));
}
}
Run Code Online (Sandbox Code Playgroud)
我相当确定我正确设置了文件提供程序,但这里是清单,以防万一。 
编辑:我刚刚做了一些测试,似乎短信应用程序崩溃发生在早期 api 的手机上,但正在处理新的 api,例如 …
android android-intent android-contentprovider android-permissions android-fileprovider
x1 = np.array([0, 1, 0, 1, 0, 1, 0, 1, 1, 1])
y = np.array([-1, -1, -1, -1, -1, 1, 1, 1, 1, -1])
Run Code Online (Sandbox Code Playgroud)
我知道使用这两个数组,您可以总结在这行代码中精确指标与numpy相等的次数.
np.sum(x1 == y)
Run Code Online (Sandbox Code Playgroud)
但有没有办法总结每次相同的索引等于每个数组上的特定值,如
np.sum(x1 == 1 && y == -1)
Run Code Online (Sandbox Code Playgroud)
不幸的是,这行代码没有运行,但是如果它工作,结果应该是3.
我一直在学习Google的机器学习速成课程,并且他们有一个部分,其中有一个练习教您如何使用pandas和tensorflow。在开始时,他们抓住数据帧,并在紧接着抓住“ total_rooms”和“ median_house_value”系列之后。他们用双括号抓住“ total_rooms”系列,而只用一组括号抓住“ median_house_value”系列。我通读了panda的文档,似乎您需要使用双括号索引到一系列索引中的唯一原因是立即索引2列,即data california_housing_dataframe [[“ median_house_value”,“ total_rooms”]]。
这是我正在谈论的代码。
california_housing_dataframe = pd.read_csv("https://dl.google.com/mlcc/mledu-datasets/california_housing_train.csv", sep=",")
# Define the input feature: total_rooms.
my_feature = california_housing_dataframe[["total_rooms"]]
# Configure a numeric feature column for total_rooms.
feature_columns = [tf.feature_column.numeric_column("total_rooms")]
targets = california_housing_dataframe["median_house_value"]
Run Code Online (Sandbox Code Playgroud)
如果需要更多上下文,请参见以下更多代码:
california_housing_dataframe = pd.read_csv("https://dl.google.com/mlcc/mledu-datasets/california_housing_train.csv", sep=",")
# Define the input feature: total_rooms.
my_feature = california_housing_dataframe[["total_rooms"]]
# Configure a numeric feature column for total_rooms.
feature_columns = [tf.feature_column.numeric_column("total_rooms")]
targets = california_housing_dataframe["median_house_value"]
def my_input_fn(features, targets, batch_size=1, shuffle=True, num_epochs=None):
"""Trains a linear regression model of one feature.
Args: …Run Code Online (Sandbox Code Playgroud)