问题列表 - 第318063页

世博会项目中的 Firebase 问题

每当我单击代码上的提交按钮将数据上传到我的 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)

firebase reactjs expo google-cloud-firestore

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

如何从 C 字符串获取 C++20forward_range 而不计算其长度?

我有一个 C 字符串 ( const char *),我想将其转换为 C++20 范围 (a forward_range) 以对其应用一些标准算法。

我不想使用,std::string_view因为我不想计算它的长度(字符串可以很长,我只关心前几个字符)。幸运的是,aforward_range不需要提前知道它的长度。

我该怎么做呢?我可以编写一个自定义迭代器,但希望有一种更简单的方法。

c++ std-ranges

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

Arrays.hashcode(int[]) 为不同元素提供相同的哈希值

我正在尝试根据数组中的整数计算哈希值。我期望具有不同整数的数组不具有相同的哈希码:

给定 [72, 99] 并执行 Arrays.hashcode([72,99]) 我得到 3292

给定 [73, 68] 并执行 Arrays.hashcode([73, 68]) 我也得到 3292

有人知道为什么会发生这种情况并且有替代我想要实现的目标吗?

java

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

dplyr "%>%" 命令:两个在一行

我愿意在一个对象(aov)上执行两个单独的 %>% 命令,是否有一种优雅的方法可以在一个命令行中执行此操作?

库(dplyr)aov_bike%>%摘要()%>%情节()

#上面的方法不起作用:我相信它在summary()的输出上执行了plot()

更清楚:所需(无 dplyr):库(dplyr)摘要(aov_bike)图(aov_bike)

r dplyr

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

C# 中 Java 算法的等效项

我有以下代码用于解密 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)

c#

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

类型错误:主体不可用 - NextJS 服务器操作 POST

我在客户端组件中使用 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)

typescript reactjs next.js

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

删除基于伪元素的用户交互

如何利用用户与 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 不起作用。谢谢。

html javascript css

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

找不到模块:错误:无法解析“/usr/src/app/node_modules/jpeg-exif/lib”中的“fs”

在生产环境中构建反应应用程序时出现错误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)

javascript reactjs

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

没有 CS0184 警告不可能检查

为什么本示例中的 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)

c# compiler-warnings roslyn

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

我正在使用react-fast-marquee进行水平滚动动画,并且我为其添加了缩放效果

我有以下代码,它按照我想要的方式工作大约 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)

javascript css animation scroll reactjs

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