小编Pat*_*ron的帖子

FirebaseStorage在请求图像时返回未知错误

我正在尝试将我添加到Android设备上的firebase存储中的图像拉入其中.每次运行时我都会收到此错误onFailureListener()

E/StorageException(9646):发生未知错误,请检查HTTP结果代码和服务器响应的内部异常.E/StorageException(9646):代码:-13000 HttpResult:0

我还将存储权限更改为暂时具有读/写功能,以确保不是问题.

final ImageView test = (ImageView) findViewById(R.id.test_image);
StorageReference ref = storage.getReferenceFromUrl("gs://my-project.appspot.com/test_image.png");
    ref.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {
            Log.d(TAG, "Successfully loaded uri");
            test.setImageURI(uri);
        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Log.d(TAG, "Failed loaded uri: " + e.getMessage());
        }
    });
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-storage

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

更新到Android Studio 2.3后无法解析符号GoogleAccountCredential

从Android Studio 2.2更新到2.3后,编辑器显示错误声明无法解析这些类:

import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
Run Code Online (Sandbox Code Playgroud)

建筑仍然是奇怪的工作.我正在使用Gradle默认包装器和项目的build.gradle引用:

classpath 'com.android.tools.build:gradle:2.3.0'
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?

android android-studio

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

用于Facebook iOS SDK 4的FBFriendPickerViewController的替换

根据Facebook v4更新日志,所有FB*ViewController都已弃用,我们应该构建自己的表视图控制器来显示朋友列表.

现在,在我开始研究之前,有没有人知道Facebook v4上FBFriendPickerViewController的另一种选择?

谢谢

facebook friend ios facebook-ios-sdk facebook-sdk-4.0

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

AWS ElastiCache 集群和 AWS ElastiCache 复制组有什么区别?

在 terraform/cloudformation 文档中,有两种不同的资源可用于创建 ElastiCache Redis 实例:

  1. aws_elasticache_cluster( https://www.terraform.io/docs/providers/aws/r/elasticache_cluster.html )
  2. aws_elasticache_replication_group( https://www.terraform.io/docs/providers/aws/r/elasticache_replication_group.html )

这两者有什么区别?我应该选择哪一个?

amazon-web-services amazon-elasticache aws-cloudformation terraform

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

使用Cloudformation进行DynamoDB自动扩展

AWS发布了DynamoDB的自动扩展功能.我想知道如何通过Cloudformation自动缩放创建表.

amazon-web-services aws-cloudformation amazon-dynamodb

6
推荐指数
1
解决办法
3063
查看次数

如何将Android xml布局转换为png/svg以在iOS版本中使用

我这里有一个Android布局xml文件:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/locationMarker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="30dp"
        android:gravity="center"
        android:orientation="vertical">

        <TextView
            android:id="@+id/locationMarkertext"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/rounded_corner_map"
            android:gravity="center"
            android:minWidth="180dp"
            android:onClick="create"
            android:paddingLeft="2dp"
            android:paddingRight="2dp"
            android:text="Pick the Location"
            android:textColor="@android:color/white" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:onClick="create"
            android:src="@drawable/plus" />
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

此xml布局呈现如下所示:

引脚布局xml截图

这适用于Android,但我想在iOS应用程序上使用此xml布局.我想知道是否有办法将此xml布局转换为svg或png格式或任何允许我重新使用此项而无需重新创建它的方法.它需要具有透明度,如果可行的话,.svg很可能比.png更好.如果可能的话,我希望只显示可见部分.

xml svg png android ios

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

正则表达式的部分匹配

在NFA中,很容易使所有先前非最终状态接受使其匹配给定语言的所有子串的语言.

在Java regex引擎中,有没有办法找出字符串是否是与给定正则表达式匹配的字符串的起始子字符串?

regexX ="任何开始",regexA - 任何给定的正则表达式

"regexXregexA"结果表达式匹配匹配"regexA"的所有子字符串:

例:

regexA = a*b
Run Code Online (Sandbox Code Playgroud)

"a"匹配

"regexXa*b"
Run Code Online (Sandbox Code Playgroud)

因为它是"ab"(和"aab")
编辑的开头:

由于有些人仍然不理解,这里是这个问题的程序测试:

import java.util.regex.*;
public class Test1 {
    public static void main(String args[]){
       String regex = "a*b";
       System.out.println(
       partialMatch(regex, "aaa");
       );
     }
public boolean partialMatch(String regex, String begining){
//return true if there is a string which matches the regex and    
//startsWith(but not equal) begining, false otherwise 
}
}
Run Code Online (Sandbox Code Playgroud)

结果是真的.

java regex

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

Google Places API 结果与 Google 地图不匹配

我正在尝试使用 Google Places API 查找给定邮政编码附近的餐馆。我在 API 调用中使用的纬度/经度与 Google 地图网站返回的纬度/经度相同,但餐厅列表几乎有 80% 不同。

我的 API 调用如下所示

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.4949254,-0.0138559&type=restaurant&key=API_KEY&radius=1000

我该怎么做才能从 Google Places API 返回更准确的结果(最好与从maps.google.com 返回的列表相同)?

google-maps google-places-api

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

AWS SAM YAML 文件无法引用 S3 事件的现有存储桶

使用案例:在 SAM YAML 文件中为 Lambda 函数创建 S3 事件时引用现有存储桶

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Sample SAM Template for sam-app

Globals:
    Function:
        Timeout: 900
        MemorySize: 2048
        Environment: 
          Variables:
            TABLE_NAME: "111"
            ENDPOINT_OVERRIDE: "222"

Resources:
  SomePull:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: target/demo-1.0.0.jar
      Handler: com.xxxx.run.LambdaFunctionHandler::handleRequest
      Runtime: java8
      Role: arn:aws:iam::aaaa:roaaaale/aaaa/lambdaExecution
      events:
          bucket: codedeploytestxxx
          event: s3:ObjectCreated:*
          rules:
            - prefix: uploads
            - suffix: .jpg
          existing: true
Run Code Online (Sandbox Code Playgroud)

参考: https: //github.com/serverless/serverless/pull/6290

我尝试了几种方法,但在创建事件时仍然无法引用现有存储桶,我在上面缺少什么配置。

执行上述脚本后出现错误:

Invalid. property events not defined for resource of type AWS::Serverless::Function
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation aws-sam-cli aws-sam

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

AWS 是否可以在组级别强制执行 MFA(例如,对于所有具有管理员权限的人)?

是否可以创建 IAM 规则或 SCP(组织规则)来为特定组中或具有特定权限(例如管理员或高级用户)的所有用户强制执行 MFA?

amazon-web-services aws-organizations aws-iam

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

无法使用 python -m 调用工具执行

我正在对詹金斯进行以下操作:

python3 -m pip install cfn-lint
> Requirement already satisfied...
python3 -m cfn-lint
> /usr/bin/python3: No module named cfn-lint
Run Code Online (Sandbox Code Playgroud)

怎么了?为什么我不能使用刚安装的工具?

python pip path aws-cloudformation

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

接收到检测到的验证错误:值 '[AWS:RDS::DBInstance]' at 'typeNameList' 失败

我正在尝试创建一个运行 MySQL 数据库的 RDS 服务器并收到以下错误:

1 validation error detected: Value '[AWS:RDS::DBInstance]' at 'typeNameList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length less than or equal to 204, Member must have length greater than or equal to 10, Member must satisfy regular expression pattern: [A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}]

AWSTemplateFormatVersion: 2010-09-09

Parameters:
  DBName:
    Type: String
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
  MUser:
    Type: String
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
  MPass:
    Type: String
    AllowedPattern: '[a-zA-Z0-9]*'
    Description: "It shouldn't be less than 8 characters"
    
Resources:
  MyDBInstance:
    Type: AWS:RDS::DBInstance
    Properties:
      DBName: …
Run Code Online (Sandbox Code Playgroud)

amazon-ec2 amazon-rds aws-cloudformation

0
推荐指数
1
解决办法
642
查看次数