问题列表 - 第317971页

PDL /向量和矩阵代数/对称矩阵的特征值排序

我正在尝试使用 Perl 模块eigens_sym 的强大功能来计算对称矩阵的特征向量PDL。

use strict; # Be pessimistic and careful with interpretations in the compilation stage, before the very execution of this program . Doubts may abort execution, probably with error messages to stdout 

use PDL ;   # Load the PDL extension of Perl 



my $matrix ; # declare this variable 

# Set $matrix to my matrix A 

$matrix = new PDL(
                [
                    [  2 ,  1 ,  9 ,  2 , -6 ,  5 , …
Run Code Online (Sandbox Code Playgroud)

perl pdl

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

Spring Security 6 - OAuth2 登录后使用 JWT 令牌而不是 JSESSIONID

我看过一些帖子谈论类似的事情,尽管与我想做的不完全一样。也就是说,我遇到了https://www.jessym.com/articles/stateless-oauth2-social-logins-with-spring-boot这是一个相当复杂的指南,仍然适合 Spring Security,并且具有作者所说的内容“无状态 oauth2 登录”。他们的方法的问题在于它仍然依赖于 cookie,我宁愿避免这种情况,因为它们仍然容易受到 CSRF 攻击等攻击。

在此输入图像描述

在这里,我提供了我想要实现的目标的图表。

在第一部分中,我观察到 Spring Security 的默认行为(我使用的是 Spring Security 6.2.0),具有以下配置和属性:

安全配置.java:

@Configuration
public class SecurityConfiguration {

    private static final String[] SWAGGER_URLS = {
            "/v3/api-docs/**",
            "/swagger-ui/**",
            "/v2/api-docs/**",
            "/swagger-resources/**"
    };

    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity, ClientRegistrationRepository clientRegistrationRepository) throws Exception {

        String base_uri = OAuth2AuthorizationRequestRedirectFilter.DEFAULT_AUTHORIZATION_REQUEST_BASE_URI;
        DefaultOAuth2AuthorizationRequestResolver resolver = new DefaultOAuth2AuthorizationRequestResolver(clientRegistrationRepository, base_uri);
        resolver.setAuthorizationRequestCustomizer(OAuth2AuthorizationRequestCustomizers.withPkce());

        return httpSecurity
                .authorizeHttpRequests(c -> {
                    // permit anyone to get to error pages
                    c.dispatcherTypeMatchers(DispatcherType.ERROR).permitAll();

                    // permit all swagger urls
                    c.requestMatchers(SWAGGER_URLS).permitAll();

                    // require authentication …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security oauth-2.0 spring-boot

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

在我的测试文件(spec.js)中上传本地服务器和端点时出错

我有以下问题:

我正在使用 Cypress 进行自动化测试。我创建了一个本地服务器,一个端点,我总是需要在测试之前启动并在测试之后始终关闭。

我尝试了一种方法,但出现以下错误:

Error: Webpack Compilation Error
./node_modules/mysql2/node_modules/lru-cache/dist/mjs/index.js 51:11
Module parse failed: Unexpected character '#' (51:11)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|      length;
|      private constructor
>     static #constructing = false;
|     static create(max) {
|         const HeapCls = getUintArray(max);
 @ ./node_modules/mysql2/lib/parsers/parser_cache.js 3:12-32
 @ ./node_modules/mysql2/promise.js
Run Code Online (Sandbox Code Playgroud)

有谁能够帮助我?

我上传到服务器的文件(index.js):

const express = require("express");
const app = express();
const port = 3000;
const programmingLanguagesRouter …
Run Code Online (Sandbox Code Playgroud)

javascript automated-tests mysql2 cypress

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

根据缺失值分组创建新行

给定下面的数据框,如果行按名字和姓氏分组,我如何为类型列表中没有每种类型的行找到并创建新行。

因此,在下面的示例中,将为 Bob Jack 创建原始数据帧中缺少的两行新行:一行的类型为“DA”,另一行的类型为“FA”,值列可以设置为 0。

data = {
    'First Name': ['Alice', 'Alice', 'Alice', 'Alice', 'Bob', 'Bob'],
    'Last Name': ['Johnson', 'Johnson', 'Johnson', 'Johnson', 'Jack', 'Jack'],
    'Type': ['CA', 'DA', 'FA', 'GCA', 'CA', 'GCA'],
    'Value': [25, 30, 35, 40, 50, 37]
}

types = ['CA', 'DA', 'FA', 'GCA']
df = pd.DataFrame(data)
Run Code Online (Sandbox Code Playgroud)

python group-by pivot-table dataframe pandas

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

避免在collect() 上使用turbofish 类型注释到Result<Vec<_>, _>

我想使用s 到 acollect()的迭代器并提前返回,以防迭代器中的任何元素出错。所以,像这样:Result<T, E>Vec<T>

use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let input = ""; // Snip real input
    let games: Vec<Game> = input.lines().map(parse_game).collect()?;
    println!("parsed {} games", games.len());
    Ok(())
}

struct Game;

fn parse_game(_s: &str) -> Result<Game, Box<dyn Error>> {
    Ok(Game)
}
Run Code Online (Sandbox Code Playgroud)

(Playground 链接,是的,该代码的灵感来自于 Advent of Code 2023 day 2)

但这不起作用,它无法编译并出现错误:

error[E0282]: type annotations needed
 --> src/main.rs:5:58
  |
5 |     let games: Vec<Game> = input.lines().map(parse_game).collect()?;
  |                                                          ^^^^^^^ cannot infer type of the …
Run Code Online (Sandbox Code Playgroud)

rust

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

为什么 Yarn 会失败并出现“未找到候选者”错误?

例如,我尝试netlify-cli使用以下命令从 17.7.0 升级到 17.8.1yarn upgrade-interactive,并发生以下错误:

\n
\xe2\x9e\xa4 YN0000: \xc2\xb7 Yarn 4.0.2\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Resolution step\n\xe2\x9e\xa4 YN0082: \xe2\x94\x82 @netlify/zip-it-and-ship-it@npm:9.28.1: No candidates found\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed in 1s 602ms\n\xe2\x9e\xa4 YN0000: \xc2\xb7 Failed with errors in 1s 617ms\n
Run Code Online (Sandbox Code Playgroud)\n

和

\n
\xe2\x9e\xa4 YN0000: \xc2\xb7 Yarn 4.0.2\n\xe2\x9e\xa4 YN0000: \xe2\x94\x8c Resolution step\n\xe2\x9e\xa4 YN0082: \xe2\x94\x82 @formkit/vue@npm:^1.3.0: No candidates found\n\xe2\x9e\xa4 YN0000: \xe2\x94\x94 Completed in 22s 953ms\n\xe2\x9e\xa4 YN0000: \xc2\xb7 Failed with errors in 22s 972ms\n
Run Code Online (Sandbox Code Playgroud)\n

根据 npmjs.com 包@netlify/zip-it-and-ship-it可在所请求的版本中使用:

\n

在此输入图像描述

\n

我最近在使用不同的软件包时多次遇到此错误。 …

netlify yarnpkg netlify-cli yarnpkg-v2

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

错误:类型“FormDataEntryValue”无法分配给类型“string”。类型“文件”不可分配给类型“字符串”

我有从 获得的数据formData,我希望将其传递给发送电子邮件的功能。

错误:

Type 'FormDataEntryValue' is not assignable to type 'string | null'.ts(2322)
definitions.ts(119, 3): The expected type comes from property 'lastName' which is declared here on type 'InvoiceEmailData'
(property) lastName: string | null
No quick fixes available
Run Code Online (Sandbox Code Playgroud)

InvoiceEmailDatafor firstName、lastName和上发生错误remarks。

'use server'


export default async function addCustomerOrder(cart: any, total: number, formData: FormData): Promise<{ message: string }> {     
    const cookieStore = cookies()
    const supabase = createServerActionClient({ cookies: () => cookieStore })

    let order_id; …
Run Code Online (Sandbox Code Playgroud)

javascript typescript reactjs next.js

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

TWinControl 组件不响应表单大小调整的问题

我有一个用 Delphi 10.4 编写的可视化控件。为了方便地关注问题,我仅创建了具有 Anchors 和 Align 属性的 TwinControl。我包括了 AutoSize 属性。问题是当该组件构建安装并放置在 TForm 上时,控件将不会响应表单大小调整。

该控件已将控件设置为锚定正确。我向表单添加了一个 TButton,并将其锚点设置为 akRight。按钮随着表单的拉伸而移动。我的控制没有。我可以提供这个小测试的完整源代码。也许有人以前见过这个。我以前曾在我的组件中使用过 TFrame,但发现存在一些显示问题,仅部分控件显示或根本不显示。我的客户没有留下深刻的印象。我会欣赏一些智慧。

这是来自 TWinControl 的代码

unit SampleControl;

    interface

    uses
      System.Classes, Vcl.Controls, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Buttons, Vcl.Dialogs,
      Vcl.Graphics,AdvGrid,vcl.Forms,System.SysUtils,StrUtils,Messages, EBS3DataUtils,
      EBSGridSetup,System.UITypes,WinApi.Windows,vcl.Grids,AdvObj,System.Variants;

    Type
      TSampleControl = class(TWinControl)
      private
        FAnchors: TAnchors;
        FAlign : TAlign;
        FAutoSize : Boolean;
        procedure InitializeComponents;
        procedure SetAnchors(const Value: TAnchors);
        procedure SetAlign(const Value: TAlign);
        procedure SetAutoSize(const Value: Boolean);
      Public
        procedure Resize; Override;
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;
      Published
        property Anchors: TAnchors read FAnchors write SetAnchors default …
Run Code Online (Sandbox Code Playgroud)

delphi anchor components vcl alignment

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

Contentlayer 配置中的 rehypePrettyCode 类型错误

我在尝试在 Contentlayer 配置中配置 rehypePrettyCode 插件时遇到类型错误。onVisitLine、onVisitHighlightedLine 和 onVisitHighlightedWord 函数预计返回 Transformer<any,any> 或 void 类型的值,但它们当前返回 Transformer<Root, Root> 或 void 类型的值。

这是我的配置的相关部分:

rehypePlugins: [
  rehypeSlug,
  [
    rehypePrettyCode,
    {
      theme: "poimandres",
      onVisitLine(node: RehypeNode) {
        // Prevent lines from collapsing in `display: grid` mode, and allow empty
        // lines to be copy/pasted
        if (node.children.length === 0) {
          node.children = [{ type: "text", value: " " }];
        }
      },
      onVisitHighlightedLine(node: RehypeNode) {
        node.properties.className.push("line--highlighted");
      },
      onVisitHighlightedWord(node: RehypeNode) {
        node.properties.className = ["word--highlighted"];
      },
    },
    rehypeAutolinkHeadings,
    {
      properties: {
        className: …
Run Code Online (Sandbox Code Playgroud)

typescript next.js rehypejs contentlayer

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

Eclipse IDE 上禁用下载外部源

I\xe2\x80\x99m 当前面临 Eclipse IDE 的问题,在重新启动/重新打开 IDE 后,在我的 config.xml 文件(它是一个 Maven 项目)上禁用下载外部源。以下是我迄今为止尝试过的解决方案:

\n
    \n
  • 导航到 Window -> Preferences -> Maven 并选中 \xe2\x80\x98Download\nArtifact Sources\xe2\x80\x99 和 \xe2\x80\x98Download Artifact JavaDoc\xe2\x80\x99。
  • \n
  • 执行了 XML 验证。
  • \n
  • 更新了 Maven 项目。
  • \n
  • 清除缓存并清理项目。
  • \n
\n

尽管做出了这些尝试,问题仍然存在。如果有人可以建议任何其他解决方案或指出我\xe2\x80\x99m 是否做错了什么,我将不胜感激。预先感谢您的帮助!

\n

尽管做出了这些尝试,问题仍然存在。如果有人可以建议任何其他解决方案或指出我\xe2\x80\x99m 是否做错了什么,我将不胜感激。预先感谢您的帮助!

\n

java eclipse maven

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