始终不够

文章 评论 浏览 29

始终不够 2025-02-20 16:05:32

我找到了解决方案,所以在我的轴上我必须添加
“数据:值,
标题:{
'content-type':'应用程序/json'
},,
身体:json.stringify(values),})”
所以给予

validationSchema={validate} onSubmit={values => {
          axios({
            method: "post",
            url: `http://localhost:3001/api/auth/login`, 
            data: values,
            headers: {
              'Content-Type': 'application/json'
               },
              body: JSON.stringify(values),
          }) .then((res) => {
            console.log(res);
            if (res.data.errors) {
              emailError.innerHTML = res.data.errors.values;
              
            } else {
              window.location = "/home";
            }
          })
          .catch((err) => {
            console.log(err);
          });
        }}

在我的CORS后端,我做到了:

const cors = require('cors');
const corsOptions ={
    origin:'http://localhost:3000/', 
    credentials:true,            //access-control-allow-credentials:true
    optionSuccessStatus:200
}
app.use(cors({credentials: true, origin: 'http://localhost:3000'}));

// middlewear general qui s'applique à toute les roots qui permet de gerer les CORS
app.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', "*");
  res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content, Accept, Content-Type, Authorization');
  res.header("Access-Control-Allow-Credentials", "true");
  next();
});

因此,这是解决的,我发现了具有Doc Axios的这种类型的Axios: https://axios-httpp.com /docs/api_intro
当我看到Axios不起作用时,我尝试使用methode提取: https://jasonwatmore.com/post/2020/02/01/react-fetch-http-post-post-request-request-examples

I found the solution, so in my axios I had to add
"data: values,
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(values), })"
So it give

validationSchema={validate} onSubmit={values => {
          axios({
            method: "post",
            url: `http://localhost:3001/api/auth/login`, 
            data: values,
            headers: {
              'Content-Type': 'application/json'
               },
              body: JSON.stringify(values),
          }) .then((res) => {
            console.log(res);
            if (res.data.errors) {
              emailError.innerHTML = res.data.errors.values;
              
            } else {
              window.location = "/home";
            }
          })
          .catch((err) => {
            console.log(err);
          });
        }}

And on my CORS BACKEND I made this:

const cors = require('cors');
const corsOptions ={
    origin:'http://localhost:3000/', 
    credentials:true,            //access-control-allow-credentials:true
    optionSuccessStatus:200
}
app.use(cors({credentials: true, origin: 'http://localhost:3000'}));

// middlewear general qui s'applique à toute les roots qui permet de gerer les CORS
app.use((req, res, next) => {
  res.header('Access-Control-Allow-Origin', "*");
  res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content, Accept, Content-Type, Authorization');
  res.header("Access-Control-Allow-Credentials", "true");
  next();
});

So this is solve and I found this type of Axios with doc Axios : https://axios-http.com/docs/api_intro
And when I saw that axios doesn't work I try with methode fetch: https://jasonwatmore.com/post/2020/02/01/react-fetch-http-post-request-examples

Axios关于React Dosen的帖子与后端MySQL一起使用(但在Postman上工作)

始终不够 2025-02-20 15:06:27

使用斐波那契堆改善算法的渐近运行时。换句话说,随着图表的增长,最终将出现使用斐波那契堆比使用二进制堆更快的点。

但是,我听到的传统观点是,在此发生之前所需的图形大小是如此之大,以至于实际上,二进制堆总是更快。

Using a Fibonacci Heap improves the asymptotic runtime of the algorithm. In other words, as your graph grows larger, there will eventually come a point where using a Fibonacci Heap is faster than using a binary heap.

However, the conventional wisdom I've heard is that the graph size required before that happens is so large that, for practical purposes, a binary heap will always be faster.

使用斐波那契堆时dijkstra速度更快吗?

始终不够 2025-02-19 13:28:22

您可以使用

import google.auth.transport.requests
import google.oauth2.id_token
auth_req = google.auth.transport.requests.Request()
token = google.oauth2.id_token.fetch_id_token(auth_req, <AUDIENCE>)

示例:云功能的受众看起来像
https://&lt; region&gt; - &lt; project_id&gt; .cloudfunctions.net/&lt; function_name&gt;

You can use

import google.auth.transport.requests
import google.oauth2.id_token
auth_req = google.auth.transport.requests.Request()
token = google.oauth2.id_token.fetch_id_token(auth_req, <AUDIENCE>)

Example: Audience for cloud function will look like
https://<REGION>-<PROJECT_ID>.cloudfunctions.net/<FUNCTION_NAME>

无法从顶点AI自定义作业中使用`gcloud auth print-token'

始终不够 2025-02-19 10:25:21
// In typings.d.ts(is Global)
export declare global {
    interface Window {
        __PUBLIC__: string;
    }
}

// In typings.d.ts(is Global)
export declare global {
    interface Window {
        __PUBLIC__: string;
    }
}

enter image description here

您如何在打字稿中的“窗口”上明确设置新属性?

始终不够 2025-02-19 08:13:45

好的,我找到了正确的表格:

选择新的部分(l.name,nvl(table1.amount,cast,table2.bigdecimalamount as int)))。

Ok, I found correct form:

SELECT new someDTO(l.name, NVL(table1.amount, CAST (table2.BigDecimalAmount AS int))).

在Oracle SQL查询中施放BigDecimal的问题

始终不够 2025-02-18 22:12:13

为此,更改您的 Metro.config.js

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const defaultSourceExts =
  require('metro-config/src/defaults/defaults').sourceExts;
module.exports = {
  transformer: {
    getTransformOptions: () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
  resolver: {
    sourceExts: process.env.RN_SRC_EXT
      ? [...process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts), 'cjs'] // <-- cjs added here
      : [...defaultSourceExts, 'cjs'], // <-- cjs added here
  },
};

Change your metro.config.js for this:

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const defaultSourceExts =
  require('metro-config/src/defaults/defaults').sourceExts;
module.exports = {
  transformer: {
    getTransformOptions: () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
  resolver: {
    sourceExts: process.env.RN_SRC_EXT
      ? [...process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts), 'cjs'] // <-- cjs added here
      : [...defaultSourceExts, 'cjs'], // <-- cjs added here
  },
};

Metro遇到了一个错误:尝试解析模块时“ IDB-Keyval&#x27;从文件

始终不够 2025-02-18 13:50:03

使用聚合管道进行更新。

  1. $ set - set <代码>名称数组字段。

    1.1。 $ MAP - 迭代名称>名称>数组中的每个项目并返回新数组。

    1.2。 $ cond - 检查当前文档的 middlename 的条件。

    1.2.1。如果 true ,则将当前文档与字段 mid_name 通过 $ mergeObjects

    1.2.2。如果 false ,请保留现有文档。

  2. $ unset - 删除 name.middlename 的字段。

db.md_carrierInformation.updateMany({
  "name.middlename": {
    $exists: true
  }
},
[
  {
    $set: {
      "name": {
        $map: {
          input: "$name",
          in: {
            $cond: {
              if: {
                $ne: [
                  "$this.middlename",
                  undefined
                ]
              },
              then: {
                $mergeObjects: [
                  "$this",
                  {
                    mid_name: "$this.middlename"
                  }
                ]
              },
              else: "$this"
            }
          }
        }
      }
    }
  },
  {
    $unset: "name.middlename"
  }
])

示例mongo playground

Work on the update with the aggregation pipeline.

  1. $set - Set name array field.

    1.1. $map - Iterate each item in name array and return new array.

    1.2. $cond - Condition for checking current document's middlename is not existed.

    1.2.1. If true, with merge current document with the document with field mid_name via $mergeObjects.

    1.2.2. If false, remain the existing document.

  2. $unset - Remove field for name.middlename.

db.md_carrierInformation.updateMany({
  "name.middlename": {
    $exists: true
  }
},
[
  {
    $set: {
      "name": {
        $map: {
          input: "$name",
          in: {
            $cond: {
              if: {
                $ne: [
                  "$this.middlename",
                  undefined
                ]
              },
              then: {
                $mergeObjects: [
                  "$this",
                  {
                    mid_name: "$this.middlename"
                  }
                ]
              },
              else: "$this"
            }
          }
        }
      }
    }
  },
  {
    $unset: "name.middlename"
  }
])

Sample Mongo Playground

MongoDB-如何从非结构化数组字段列表中重命名特定字段?

始终不够 2025-02-18 11:52:31

您可以使用 laravel scopes 。在帖子模型中添加本地scepepepept:

public function scopePublished($query)
{
    return $query->where('publish', '=', 1);
}

然后通过@paginate

 posts: [Post!]! @paginate(scopes: "published")

you can use laravel scopes. Add a local scopePublished to the post model:

public function scopePublished($query)
{
    return $query->where('publish', '=', 1);
}

Then use it inside your schema by @paginate:

 posts: [Post!]! @paginate(scopes: "published")

laravel-graphql滤波器查询

始终不够 2025-02-18 09:59:54

将您的 classDecider()更改为 return classDecider()。您必须返回最终结果

Change your classDecider() in else into return classDecider(). You have to return the final result

python3递归函数返回null

始终不够 2025-02-18 05:10:25

考虑以下内容。

$(function() {
  function checkValue(input) {
    // satantize for Numbers Only
    if (isNaN($(input).val())) {
      return false;
    }
    // cast to Integers
    var val = parseInt($(input).val());
    var min = parseInt($(input).data("min"));
    var max = parseInt($(input).data("max"));
    console.log(val, min, max, (val >= min) && (val <= max))
    // return val is in between Min & Max
    return (val >= min) && (val <= max);
  }

  //Init Min & Max on Text Input as Data Attributes
  $("#co-tbi-loanAmount-input").data({
    min: $("#tbi-range-slider").attr("min"),
    max: $("#tbi-range-slider").attr("max")
  });

  $('#co-tbi-loanAmount-input').change(function(s) {
    // ignore 1, and 10, will start to look at 100
    if ($(this).val().length >= 3) {
      if (!checkValue(this)) {
        console.log("Incorrect Value: " + $(this).val());
        $(this).val("");
      } else {
        var numberInputValue = Math.floor(parseInt($(this).val()) / 100) * 100;
        $(this).val(numberInputValue);
        var start = parseInt($("#tbi-range-slider").val()) - parseInt($("#tbi-range-slider").attr("min"));
        var diff = parseInt($("#tbi-range-slider").attr("max")) - parseInt($("#tbi-range-slider").attr("min"));
        console.log("linear-gradient(to right, #FF6600 0%, #FF6600 " + Math.round(start / diff * 100) + "%, #DEE2E6 " + Math.round(start / diff * 100) + "%, #DEE2E6 100%)");
        $("#tbi-range-slider").val(numberInputValue).parent().css("background", "linear-gradient(to right, #FF6600 0%, #FF6600 " + Math.round(start / diff * 100) + "%, #DEE2E6 " + Math.round(start / diff * 100) + "%, #DEE2E6 100%)");
      }
    }
  });

  $("#tbi-range-slider").change(function() {
    $('#co-tbi-loanAmount-input').val($(this).val()).trigger("change");
  })
});
body {
  font-family: system-ui;
  background: #f06d06;
  color: white;
  text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="co-tbi-loanAmount-input" class="tbi-calc-loanAmount co-tbi-input tbi-font-18" value="25000">
<div>
  <input type="range" min="400" max="50000" value="25000" step="100" class="tbi-slider" id="tbi-range-slider">
</div>

这允许用户输入一个数字(示例: 200 400 420 10000 )并将调整滑块,如果它大于或等于 min ,则小于或等于或等于的最大

如果用户输入 200 的值,则将删除该值。如果用户输入A或其他东西,它也将删除该值。

如果用户输入 420 ,则将删除到 400

Consider the following.

$(function() {
  function checkValue(input) {
    // satantize for Numbers Only
    if (isNaN($(input).val())) {
      return false;
    }
    // cast to Integers
    var val = parseInt($(input).val());
    var min = parseInt($(input).data("min"));
    var max = parseInt($(input).data("max"));
    console.log(val, min, max, (val >= min) && (val <= max))
    // return val is in between Min & Max
    return (val >= min) && (val <= max);
  }

  //Init Min & Max on Text Input as Data Attributes
  $("#co-tbi-loanAmount-input").data({
    min: $("#tbi-range-slider").attr("min"),
    max: $("#tbi-range-slider").attr("max")
  });

  $('#co-tbi-loanAmount-input').change(function(s) {
    // ignore 1, and 10, will start to look at 100
    if ($(this).val().length >= 3) {
      if (!checkValue(this)) {
        console.log("Incorrect Value: " + $(this).val());
        $(this).val("");
      } else {
        var numberInputValue = Math.floor(parseInt($(this).val()) / 100) * 100;
        $(this).val(numberInputValue);
        var start = parseInt($("#tbi-range-slider").val()) - parseInt($("#tbi-range-slider").attr("min"));
        var diff = parseInt($("#tbi-range-slider").attr("max")) - parseInt($("#tbi-range-slider").attr("min"));
        console.log("linear-gradient(to right, #FF6600 0%, #FF6600 " + Math.round(start / diff * 100) + "%, #DEE2E6 " + Math.round(start / diff * 100) + "%, #DEE2E6 100%)");
        $("#tbi-range-slider").val(numberInputValue).parent().css("background", "linear-gradient(to right, #FF6600 0%, #FF6600 " + Math.round(start / diff * 100) + "%, #DEE2E6 " + Math.round(start / diff * 100) + "%, #DEE2E6 100%)");
      }
    }
  });

  $("#tbi-range-slider").change(function() {
    $('#co-tbi-loanAmount-input').val($(this).val()).trigger("change");
  })
});
body {
  font-family: system-ui;
  background: #f06d06;
  color: white;
  text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="co-tbi-loanAmount-input" class="tbi-calc-loanAmount co-tbi-input tbi-font-18" value="25000">
<div>
  <input type="range" min="400" max="50000" value="25000" step="100" class="tbi-slider" id="tbi-range-slider">
</div>

This allows the User to enter a number (examples: 200, 400, 420, 10000) and will adjust the slider if it is greater than or equal to min and less than or equal to max of the Slider.

If the user enters a value of 200, it will remove the value. If the User enters an A or something else, it will also remove the value.

If the user enters 420, it will be dropped to 400.

输入标签验证

始终不够 2025-02-17 15:11:46

因此,也许我对此我错了,但是 zindices 。

So, maybe I'm wrong with this, but the object in Chakra foundations is called borders. I recently had a bunch of trouble overriding the z-index values for the Modal and Overlay components. This file appears to mainly deal with the size and stroke, but I assume you could add your color here as well. In my case, the object was titled zIndices.

脉轮:可以覆盖全球边界风格

始终不够 2025-02-17 13:22:29

基本上,
要读取内容文件:

cat the_file_to_read

因此,

curl --url "$(cat the_file_to_read)" --output "the_file_to_write"

当然,输入文件内容必须包含完整的URL ...或不包含。您可以在curl命令中添加协议:

curl --url "https://$(cat the_file_to_read)" --output "the_file_to_write"

为了防止输入文件中的多个行,您需要一个或模式过滤器:

curl --url "https://$(cat the_file_to_read | head -1)" --output "the_file_to_write"

您还可以读取这样的http响应代码:

HTTP_RESPONSE_CODE=$(curl --url "https://$(cat the_file_to_read | head -1)" --output "the_file_to_write" --write-out '%{response_code}')
echo "HTTP_RESPONSE_CODE=${HTTP_RESPONSE_CODE}"

请参阅 man curl 说明,更多选择...

Basically,
To read content file:

cat the_file_to_read

So,

curl --url "$(cat the_file_to_read)" --output "the_file_to_write"

Of course, the input file content must be contains the complete URL... or not. You could add the protocol in cURL command:

curl --url "https://$(cat the_file_to_read)" --output "the_file_to_write"

To prevent more than one line in input file, you need one or mode filters like that:

curl --url "https://$(cat the_file_to_read | head -1)" --output "the_file_to_write"

You also can read HTTP response code like this:

HTTP_RESPONSE_CODE=$(curl --url "https://$(cat the_file_to_read | head -1)" --output "the_file_to_write" --write-out '%{response_code}')
echo "HTTP_RESPONSE_CODE=${HTTP_RESPONSE_CODE}"

See man curl for more explanations, more options...

如何使用文件中的字符串来卷曲URL?

始终不够 2025-02-17 02:58:13

有趣的巧合,我几个小时前在 htttps:htttps:htttps:htttps:// topanswers。 xyz/tex?q = 2047#A2293

 \documentclass{beamer}
\usetheme[progressbar=frametitle, sectionpage=progressbar, subsectionpage=progressbar, block=fill]{moloch}% modern fork of the metropolis theme
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{\normalsize\insertframenumber}
 
\title{Title}
\subtitle{Sub-title}
\date{\today}
\author{author}
\institute{institute}
 
\AtBeginSection[]
{
    \setbeamertemplate{navigation symbols}{}
    \frame[plain,c,noframenumbering]{
        \sectionpage
        \tableofcontents[currentsection,subsectionstyle=hide]}
    \setbeamertemplate{navigation symbols}{\normalsize\insertframenumber}
}
 
\makeatletter
 
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
 
\patchcmd{\ps@empty}{\usebeamertemplate***{navigation symbols}}{}{}{} 
 
\makeatother
 
\begin{document}
  \maketitle
 
\section{First section}
 
\begin{frame}
Content 
\end{frame}
 
\section{Second section}
\subsection{First sub section}
\begin{frame}
Content 
\end{frame}   
 
\subsection{Second sub section}
\begin{frame}
Content 
\end{frame} 
 
\section{Third section}
\end{document}

Funny coincidence, I just answered basically the same problem a couple of hours ago at https://topanswers.xyz/tex?q=2047#a2293

 \documentclass{beamer}
\usetheme[progressbar=frametitle, sectionpage=progressbar, subsectionpage=progressbar, block=fill]{moloch}% modern fork of the metropolis theme
\setbeamertemplate{footline}{}
\setbeamertemplate{navigation symbols}{\normalsize\insertframenumber}
 
\title{Title}
\subtitle{Sub-title}
\date{\today}
\author{author}
\institute{institute}
 
\AtBeginSection[]
{
    \setbeamertemplate{navigation symbols}{}
    \frame[plain,c,noframenumbering]{
        \sectionpage
        \tableofcontents[currentsection,subsectionstyle=hide]}
    \setbeamertemplate{navigation symbols}{\normalsize\insertframenumber}
}
 
\makeatletter
 
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
 
\patchcmd{\ps@empty}{\usebeamertemplate***{navigation symbols}}{}{}{} 
 
\makeatother
 
\begin{document}
  \maketitle
 
\section{First section}
 
\begin{frame}
Content 
\end{frame}
 
\section{Second section}
\subsection{First sub section}
\begin{frame}
Content 
\end{frame}   
 
\subsection{Second sub section}
\begin{frame}
Content 
\end{frame} 
 
\section{Third section}
\end{document}

删除子部分幻灯片上的编号

始终不够 2025-02-16 23:38:54

如果 Promise-doctions 未缓存,它将起泡并丢弃错误。因此,也许您应该增加对错误的期望

expect(service.searchObject).toThrow();

If the Promise-Rejection isn't cached, it will bubble up and throw the error. So maybe you should add an expectation for the error like

expect(service.searchObject).toThrow();

单位测试角异步有望

始终不够 2025-02-16 18:20:22

我相信我为这篇文章找到了一种方法:如何根据其他列上的值将熊猫的移动平均值纳入

df['ma_24h'] = (df.groupby(['customer'])['avg_price']
                .rolling('24H', min_periods=360)
                .mean()
                .sort_index(level=1)
                .values)

我将滚动变为24小时。我遇到的主要问题是与索引并获得值,显然我必须对索引进行排序,然后选择值。

如果还有其他更简单的方法可以实现这一目标,我为他们开放。

I believe I found a way thanks to this post: How to include Moving Average with Pandas based on Values on other Columns

df['ma_24h'] = (df.groupby(['customer'])['avg_price']
                .rolling('24H', min_periods=360)
                .mean()
                .sort_index(level=1)
                .values)

I changed the rolling to 24H. The main issue I had was with the index and getting the values and apparently I had to sort the index and just select the values.

If there are other simpler ways to accomplish this, I'm open for them.

PANDAS-分配组滚动的均值结果,以尊重初始数据框架的新列

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文