小编Lak*_*ake的帖子

使用真实电话号码的 Firebase PhoneAuth 不起作用,但白名单号码正在运行 - Android

我正在我的应用程序中设置 Firebase 电话身份验证。我在 firebase auth 部分白名单中设置了一个测试电话号码和一个验证码。当我用这个数字和代码进行测试时,它工作正常。但是当我使用另一个号码进行测试时,出现以下错误:

onVerificationFailed    com.google.firebase.auth.FirebaseAuthInvalidCredentialsException:
    The request contains malformed or mismatching credentials [ App ID does not match the requested project.
Run Code Online (Sandbox Code Playgroud)

旁注:我也在这个 android 应用程序中使用了 facebook 帐户工具包,并且进展顺利。

有什么建议?

android firebase firebase-authentication

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

Zabbix - 缓冲池利用率太低

我使用 Zabbix 作为我的 Linux 监控解决方案。
\n显示MySQL - The buffer pool utilization is less than\xc2\xa050% in the last 5 minutes. This means that there is a lot of unused RAM allocated for the buffer pool, which you can easily reallocate at the moment为警告。

\n\n

我应该担心这个吗?
\n如何解决这个问题?

\n

mysql buffer innodb zabbix

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

PreparedStatement或callableStatements

我试图了解PreparedStatementsCallableStatements与我之间的区别。因此,任何人都可以将以下sql查询转换为CallableStatement。我知道如何将Statement转换为,PreparedStatement但存在问题CallableStatements

作为一个 java.sql.Statement

SELECT * FROM Customer WHERE customerId = 'C001'
Run Code Online (Sandbox Code Playgroud)

作为一个 java.sql.PreparedStatement

SELECT * FROM Customer WHERE customerId = ? //set customerId using preparedStatement.setString(1,"C001")
Run Code Online (Sandbox Code Playgroud)

如何在中编写相同的查询 CallableStatements

提前致谢!

java jdbc

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

如何根据选项值获得左/右

我正在尝试Either根据选项值返回值。我的目标是如果该选项存在则返回Either.right(),否则代码应返回Either.left()。我使用 Java 8 和 vavr 0.9.2

我想避免有条件的叠瓦

public Either<String, Integer> doSomething() {
    Optional<Integer> optionalInteger = Optional.of(Integer.MIN_VALUE);
    Option<Integer> integerOption = Option.ofOptional(optionalInteger);

    return integerOption.map(value -> {
      //some other actions here
      return Either.right(value);
    }).orElse(() -> {
      //some other checks her also 
      return Either.left("Error message");
    });
}
Run Code Online (Sandbox Code Playgroud)

编译器失败并显示此消息

Error:(58, 7) java: no suitable method found for orElse(()->Either[...]age"))
    method io.vavr.control.Option.orElse(io.vavr.control.Option<? extends io.vavr.control.Either<java.lang.Object,java.lang.Integer>>) is not applicable
      (argument mismatch; io.vavr.control.Option is not a functional interface
          multiple non-overriding abstract methods found in interface io.vavr.control.Option)
    method io.vavr.control.Option.orElse(java.util.function.Supplier<? …
Run Code Online (Sandbox Code Playgroud)

java either vavr

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

带有中间件的 django 中间件错误不带任何参数

从那以后我一直遇到这个错误,我检查了 Django 文档并通过谷歌搜索了许多网站,但仍然没有得到这个错误的解决方案,在此先感谢。每当我想运行服务器时都会出现此错误

from datetime import timedelta

from django.core.cache import cache
from django.utils import translation, timezone
from django.conf import settings as global_settings
import pytz
from djangobb_forum import settings as forum_settings

class TimezoneMiddleware(object):
    def process_request(self, request):
        if request.user.is_authenticated():
            profile = request.user.forum_profile
            try:
                timezone.activate(profile.time_zone)
            except pytz.UnknownTimeZoneError:
                profile.time_zone = global_settings.TIME_ZONE
                profile.save()
Run Code Online (Sandbox Code Playgroud)

这是我在 settings.py 中的中间件,我使用的是 python 3.7 和 Django 2.2

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

        #DjangoBB_Forum part
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'pagination.middleware.PaginationMiddleware',
    'django.middleware.cache.FetchFromCacheMiddleware',
    'djangobb_forum.middleware.LastLoginMiddleware',
    'djangobb_forum.middleware.UsersOnline',
    'djangobb_forum.middleware.TimezoneMiddleware',
]
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误

System check identified …
Run Code Online (Sandbox Code Playgroud)

django forum

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

Android - Gridlayout android.support.v7.widget.GridLayout无法强制转换为android.widget.GridLayout

我想创建一个能够在所有API中运行的GridLayout.

问题是,当我使用GridLayout而不是android.support.v7.widget.GridLayout时,该应用程序在Android 7.1.1中正常运行,但在旧版本中它崩溃了.

但是,如果我使用android.support.v7.widget.GridLayout而不是GridLayout(如下面的代码),它总是崩溃.

activity_main

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#FFF"
    tools:context="devector.dom.gridtest.MainActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="wrap_content">



    <RelativeLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/textGrid"
            android:text="Grid test"
            android:textColor="#000"
            android:layout_centerInParent="true"
            android:textSize="34sp"
            />
    </RelativeLayout>

    <android.support.v7.widget.GridLayout
        android:textAlignment="center"
        android:id="@+id/mainGrid"
        android:padding="25dp"
        android:layout_marginLeft="8dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:columnCount="2"
        app:rowCount="3"
        app:alignmentMode="alignMargins"
        app:columnOrderPreserved="false">


        <!-- Row 1 -->
        <!-- Column 1-->

        <android.support.v7.widget.CardView
            android:layout_width="150dp"
            android:layout_height="125dp"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            app:cardElevation="8dp"
            app:cardCornerRadius="8dp"
            >


            <LinearLayout
                android:layout_gravity="center_horizontal|center_vertical"
                android:layout_margin="16dp"
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                >

                <ImageView
                    android:src="@drawable/zerotwo"
                    android:layout_gravity="center_horizontal" …
Run Code Online (Sandbox Code Playgroud)

android android-gridlayout

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