每当我单击代码上的提交按钮将数据上传到我的 firebase 数据库时,我都会收到此错误:
ERROR [2024-01-21T03:39:39.733Z] @firebase/firestore: Firestore (10.7.2): INTERNAL UNHANDLED ERROR: TypeError: Cannot read property 'includes' of undefined
我尝试卸载节点模块,特别是 firebase,但没有任何效果。我尝试创建一个新的 firebase 帐户,但仍然无法正常工作。我想不明白。
import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
import { getAuth } from 'firebase/auth';
import { getFirestore, doc, setDoc } from 'firebase/firestore';
import app from '../config/FirebaseConfig'; // Adjust this path as necessary
const DataInput = () => {
const [monthOrderTotal, setMonthOrderTotal] = useState('');
const [monthDollarAmount, setMonthDollarAmount] = useState('');
const firestore = getFirestore(app);
const auth = getAuth(); …Run Code Online (Sandbox Code Playgroud) 我有一个 C 字符串 ( const char *),我想将其转换为 C++20 范围 (a forward_range) 以对其应用一些标准算法。
我不想使用,std::string_view因为我不想计算它的长度(字符串可以很长,我只关心前几个字符)。幸运的是,aforward_range不需要提前知道它的长度。
我该怎么做呢?我可以编写一个自定义迭代器,但希望有一种更简单的方法。
我正在尝试根据数组中的整数计算哈希值。我期望具有不同整数的数组不具有相同的哈希码:
给定 [72, 99] 并执行 Arrays.hashcode([72,99]) 我得到 3292
给定 [73, 68] 并执行 Arrays.hashcode([73, 68]) 我也得到 3292
有人知道为什么会发生这种情况并且有替代我想要实现的目标吗?
我愿意在一个对象(aov)上执行两个单独的 %>% 命令,是否有一种优雅的方法可以在一个命令行中执行此操作?
库(dplyr)aov_bike%>%摘要()%>%情节()
#上面的方法不起作用:我相信它在summary()的输出上执行了plot()
更清楚:所需(无 dplyr):库(dplyr)摘要(aov_bike)图(aov_bike)
我有以下代码用于解密 DES 加密编码消息Java。
try
{
byte[] key = new String(keyString).getBytes();
byte[] enc = Base64.getDecoder().decode(encryptedMessage);
SecretKey generateSecret = SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(key));
Cipher cipher = Cipher.getInstance("DES");
cipher.init(2, generateSecret);
String dec = new String(cipher.doFinal(enc));
}
catch (Exception ex)
{
}
Run Code Online (Sandbox Code Playgroud)
我想将其移植到 C# 中。不过,我不确定如何处理SecretKey generateSecret = SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(key));以下是C#我用于 DES 解密的代码:
byte[] enc = Convert.FromBase64String(encryptedMessage);
byte[] key = Encoding.UTF8.GetBytes(keyString);
using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
{
des.Key = key;
ICryptoTransform desDecrypt = des.CreateDecryptor();
byte[] result = desDecrypt.TransformFinalBlock(enc, 0, enc.Length);
return …Run Code Online (Sandbox Code Playgroud) 我在客户端组件中使用 NextJS v14.1.0 和服务器操作。我收到了正确的消息,但也收到了一个 TypeError 消息,表明 body 不可用。
src/app/auth/account-verification/page.tsx
const onSubmit = async (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
const data = { requestId: token, otp: parseInt(otp) };
const response = await AccountVeficationAction(data);
ActionResponseHandler(response, "Account Verification");
if (response.success) {
Router.push("/auth/login");
}
};
Run Code Online (Sandbox Code Playgroud)
/src/app/auth/_utils/actions/action.ts
export const AccountVeficationAction = async (body: any) => {
try {
const response = await fetch(`${BASEURL}/auth/confirm-account`, {
method: "POST",
headers: {
"Content-Type": "application/json",
// Add other necessary headers (e.g., authorization)
},
body: JSON.stringify(body), // Access data from the …Run Code Online (Sandbox Code Playgroud) 如何利用用户与 html 元素的交互来删除伪元素?我有一个带有伪元素的元素,其宽度为 50% 并且绝对定位。我想在用户与其父元素交互后永久删除伪元素。
.test {
position: relative;
background: blue;
}
.test::before {
content: "some text";
background: red;
width: 50%;
position: absolute;
}Run Code Online (Sandbox Code Playgroud)
<div class="test">Lorem ipsum dolor sit.</div>Run Code Online (Sandbox Code Playgroud)
在父级上使用 :hover、:active 和 :focus 不起作用。谢谢。
在生产环境中构建反应应用程序时出现错误Module not found: Error: Can't resolve 'fs' in '/usr/src/app/node_modules/jpeg-exif/lib'
节点版本
Node version 18
在 Docker 生产中运行命令
npm install --legacy-peer-deps
npm run build
package.json 文件
"name": "dcts-client",
"version": "0.1.0",
"private": true,
"homepage": "ecommerce",
"dependencies": {
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@fortawesome/fontawesome-svg-core": "^6.1.2",
"@fortawesome/free-brands-svg-icons": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@hookform/error-message": "^2.0.0",
"@mui/icons-material": "^5.11.0",
"@mui/material": "^5.10.2",
"@mui/x-date-pickers": "^5.0.0",
"@react-pdf/renderer": "^3.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"bootstrap": "^5.2.0",
"card-validator": "^8.1.1",
"cross-domain-storage": "^2.0.7",
"dayjs": "^1.11.5",
"env-cmd": "^10.1.0",
"js-cookie": "^3.0.1",
"lodash.isequal": "^4.5.0",
"payment": …Run Code Online (Sandbox Code Playgroud) 为什么本示例中的 testB不像 testA 那样给出“警告 CS0184:给定的表达式永远不是提供的 ('MyClass2') 类型”?
class Program
{
void Main()
{
var a = new MyClass1();
var b = (IMyInterface)new MyClass1();
//Get a CS0184 Warning on this line
var testA = a is MyClass2;
//No warning on this line
var testB = b is MyClass2;
}
}
interface IMyInterface
{
}
class MyClass1 : IMyInterface
{
}
class MyClass2
{
}
Run Code Online (Sandbox Code Playgroud) 我有以下代码,它按照我想要的方式工作大约 90%,它从右向左滚动,并且我添加了一个检查以查看图像何时到达页面中心,它应该将图像放大一点一点点的效果。
这对于前 3 个图像效果很好,但是当循环完成时,索引 0 和索引 1 永远不会缩放。
我已经尝试解决这个问题有一段时间了,但似乎无法确定原因。
这是一个代码沙箱,可以查看它的运行情况并使用它
https://codesandbox.io/p/sandbox/zen-tharp-zvdwyk
任何帮助将不胜感激
import React, { useEffect, useRef, useState } from "react";
import Marquee from "react-fast-marquee";
import styled from "styled-components";
const props = {
Carousel: [
{ image: "/1.webp" },
{ image: "/2.webp" },
{ image: "/3.webp" },
{ image: "/4.webp" },
{ image: "/5.webp" },
],
};
function Gallery() {
const [updateLoop, setUpdateLoop] = useState(false);
const [centerImageIndex, setCenterImageIndex] = useState(null);
const imgRef = useRef();
const [imageWidth, setImageWidth] = useState(0); …Run Code Online (Sandbox Code Playgroud)