小编Dan*_*hea的帖子

Firebase Firestore 在物理设备上进行 WiFi 故障时出现错误:无法到达 Cloud Firestore 后端

尝试从 Firestore 获取文档时,如果设备通过 Wifi 连接,则连接失败并显示以下错误消息:

\n
W/Firestore( 4903): (21.4.3) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn\'t respond within 10 seconds\nW/Firestore( 4903): This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.\n
Run Code Online (Sandbox Code Playgroud)\n

重现

\n

通常,在物理设备中运行时会发生错误。\n我创建了一个小应用程序,以便能够在对其余代码的干扰最小的情况下重现错误。请参阅下面的代码。

\n

当您在调试器上点击运行(我正在使用 VSCode),然后单击 (+) 按钮向 Firestore 发出请求时,它会尝试几秒钟(您将看到进度指示器,没有测试应用程序),然后调用snapshot = await docRef.get()失败并显示以下错误消息:

\n
PlatformException(Error performing get, Failed to get document …
Run Code Online (Sandbox Code Playgroud)

firebase flutter google-cloud-firestore

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

Bitbucket:致命:尝试克隆 Git 存储库时 HTTP 请求失败

我无法将我的 Git 存储库从 Bitbucket Cloud 克隆到我的服务器。我通过 SSH 连接到网站的服务器(不是本地),然后尝试执行以下操作:

git clone https://myusername@bitbucket.org/myusername/reel-visuals.git
Run Code Online (Sandbox Code Playgroud)

输入密码后,这就是我收到的确切错误:

error:  while accessing https://myusername@bitbucket.org/myusername/reel-visuals.git/info/refs
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)

我确实输入了正确的用户名和密码。

我究竟做错了什么?这是我的 Bitbucket 存储库的权限问题还是其他问题?如果是这样,我该如何修复它?

git bitbucket git-clone bitbucket-cloud

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

使用 connect-session-sequelize 实现持久会话

我正在制作一个带有登录系统的网站,我希望用户即使在浏览器关闭后也能够保持登录状态。仅当用户注销时才销毁会话。我在网上搜索了解决方案,并发现了使用connect-session-sequelize 的建议。我阅读了文档并尽最大努力使代码正常工作,但我在这方面缺乏经验,这成为了障碍。

问题:

我的代码没有给出服务器重新启动后保持用户登录的结果。我的代码是:

var express = require('express');
var app = express();
var cookieParser = require('cookie-parser');
var session = require('express-session');
var SequelizeStore = require('connect-session-sequelize')(session.Store);

var pug = require('pug');
var bodyParser = require('body-parser');
var bcrypt = require('bcrypt');

app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(express.static('public'));
app.use(cookieParser());

app.set('views', './views');
app.set('view engine', 'pug');

var Sequelize = require('sequelize');
var db = new Sequelize('postgres://'+ process.env.POSTGRES_USER + ':' + 
process.env.POSTGRES_PASSWORD + '@localhost/terranova', {
    host: 'localhost',
    dialect: 'postgres',
    storage: './session.postgres', 
    define: {
      timestamps: true
    }
});

var sessionStore …
Run Code Online (Sandbox Code Playgroud)

postgresql session persistent node.js express

6
推荐指数
0
解决办法
5409
查看次数

setHyphenation 和 breakStrategy 在 TextView 中无法按预期工作

我试图在 TextView 中添加连字符来破坏长单词。例如,我有一个文本视图,其文本是“推荐”。因为该单词对于一行来说太长,所以我想在第一行中添加“Recommend-”,在第二行中添加“ation”,如下所示:

在此输入图像描述

但事实上,我得到了

在此输入图像描述

这是我对 TextView 的内容:

<TextView
   android:id="@+id/textViewid"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:text="@string/long_text"
   android:breakStrategy="high_quality"
   android:hyphenationFrequency="full" />
Run Code Online (Sandbox Code Playgroud)

我尝试了breakStrategy值和hyphenationFrequency值的不同组合,但没有成功。知道为什么它会以这种方式或其他方式使连字起作用吗?提前致谢!

android hyphenation

6
推荐指数
0
解决办法
1289
查看次数

Atlassian Bitbucket Cloud - ssh 身份验证 - git pull 有效,git push 失败

1. 总结问题

我按照 Bitbucket 的说明设置 ssh。

我有一个 pub/priv 密钥对,并将 pub 密钥粘贴到项目的 Bitbucket 设置(访问密钥)中。

我在 GCE VM 上有一个构建服务器。 git clone工作成功,并且git pull origin master有效。我正在使用密码。

git commit但是,如果我在 GCE VM 上对单个文件进行小更改,然后执行git push origin master,则会失败并显示以下错误消息。

Enter passphrase for key '/home/proc/.ssh/id_rsa':
Unauthorized
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

git remote -v 节目

origin  git@bitbucket.org:<my-account>/<my-repo>.git (fetch)
origin  git@bitbucket.org:<my-account>/<my-repo>.git (push)
Run Code Online (Sandbox Code Playgroud)

如果git pull origin master工作正常,则 ssh 设置正确。 …

git bitbucket bitbucket-cloud

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

Firebase Documentsnapshot 映射到 Flutter 中的 Json 对象

我正在尝试将 DocumentSnap 从 Firebase 映射到 Flutter 中的 Json 类。我可以确认我正在从文档中获取数据,但我无法将收集的数据传递给我的 Json 对象。我已附上代码和错误消息。

用于从 Firebase DatabaseService.dart 获取文档的类

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';

import 'package:oast_app/widgets/auth_class.dart';



class FireTest {
  Future<List<UserCheck>> streamUser(FirebaseUser user) async {
    DocumentSnapshot querySnapshot =
        await Firestore.instance.collection('users').document(user.uid).get();
    if (querySnapshot.exists) {
      print('success');
      print(querySnapshot.data['fname']);
      print(querySnapshot.data['lname']);

      querySnapshot.data.map<String, dynamic>((json) => UserCheck.fromJson(json)); **this is whats erroring**
    }
    return [];
  }
}
Run Code Online (Sandbox Code Playgroud)

Json 对象类

import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';

part 'auth_class.g.dart';

@JsonSerializable(nullable: false)
class UserCheck extends ChangeNotifier {
  final String uid;
  final String fName;
  final String lName;
  final String regEmail; …
Run Code Online (Sandbox Code Playgroud)

jsonserializer firebase flutter google-cloud-firestore

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

启用或禁用通知抖动

我想借助一个按钮来启用/禁用通知服务,当启用此按钮时,用户会收到通知,而当它被禁用时,他将不会收到任何通知。

import 'dart:io';

import 'package:firebase_messaging/firebase_messaging.dart';

class FirebaseNotifications {
  FirebaseMessaging _firebaseMessaging;

  void setUpFirebase() {
    _firebaseMessaging = FirebaseMessaging();
    firebaseCloudMessaging_Listeners();

  }

  void firebaseCloudMessaging_Listeners() {
    if (Platform.isIOS) iOS_Permission();

    _firebaseMessaging.getToken().then((token) {
      print(token);
    });

    _firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) async {
        print('on message $message');
      },
      onResume: (Map<String, dynamic> message) async {
        print('on resume $message');
      },
      onLaunch: (Map<String, dynamic> message) async {
        print('on launch $message');
      },
    );
  }

  void iOS_Permission() {
    _firebaseMessaging.requestNotificationPermissions(
        IosNotificationSettings(sound: true, badge: true, alert: true));
    _firebaseMessaging.onIosSettingsRegistered
        .listen((IosNotificationSettings settings) {
      print("Settings registered: $settings");
    });
  } …
Run Code Online (Sandbox Code Playgroud)

push-notification dart flutter firebase-cloud-messaging

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

单 SPA 本地主机 CROS 起源问题 - React 应用程序

我是反应新手..我有反应应用程序,我已将其迁移到 Single-SPA。为了将我的应用程序与主应用程序(具有许多 Vue single-spa 应用程序的平台)集成,我将其重新构造为

MainApp - 它包括与进程相关的所有页面 - 在 localhost:3000 下运行

root-html-file - 它包括一个index.html和package.json文件index.html(在localhost:5000下运行-由SPA生成)

代码: root-html-file -> index.html

<script type="systemjs-importmap">
      {
        "imports": {
    "myapp": "http://localhost:3000/",
    "single-spa": "https://cdnjs.cloudflare.com/ajax/libs/single-spa/4.3.7/system/single-spa.min.js",
    "react": "https://cdnjs.cloudflare.com/ajax/libs/react/16.8.6/umd/react.development.js"
     }}</script>

Promise.all([System.import('single-spa'),System.import('react')]).then(function (modules) {
          var singleSpa = modules[0];
            singleSpa.registerApplication(
                'myapp',
                () => System.import('myapp'),
                location => true
            );
          singleSpa.start();
Run Code Online (Sandbox Code Playgroud)

myapp 应用程序作为独立的工作正常。仅当运行 root-html-file 应用程序(npm runserve)时,该应用程序会将 myapp 应用程序加载到其中,从而导致 CROS origin 问题。请查看屏幕截图

在此输入图像描述

如果我方向错误,请指导我。

reactjs systemjs single-spa

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

配置文件或调试 APK:生成签名的 Bundle 需要您将 Android Gradle 插件更新到版本 3.2.0

在 Android Studio 中,我使用 Profile 或 debug APK 选项来生成签名的 Bundle,但出现以下错误:

“生成签名的 Bundle 需要您将 Android Gradle 插件更新到版本 3.2.0 或更高版本”

在此输入图像描述

如果我单击“关闭此对话框并更新插件”,则会出现另一个提示,询问是否更新。单击“更新”除了关闭提示之外似乎没有执行任何操作。

plugins android bundle version gradle

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

Faker Python 生成中文/拼音名字

我试图使用 Faker (Python) 生成随机中文名称,但它生成的是中文字符而不是拼音的名称。

我找到了这个 : 在此输入图像描述

它显示它以拼音生成它们,而当我尝试相同的代码时,它只给我汉字。

怎么得到拼音??

python cjk faker

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