小编Rul*_*uli的帖子

收到错误“数字信封例程”,原因:“不支持”,代码:“ERR_OSSL_EVP_UNSUPPORTED”

我在学习 Next.js 时遇到此错误,npx create-next-app根据此处的站点文档使用命令https://nextjs.org/docs/api-reference/create-next-app。一切正常,直到我启动服务器,

错误堆栈:

$ npm run dev

> devto-clone@0.1.0 dev
> next dev

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at BulkUpdateDecorator.hashFactory (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
    at BulkUpdateDecorator.update (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
    at OriginalSource.updateHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
    at NormalModule._initBuildHash (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
    at handleParseResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
    at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
    at processResult (C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
    at C:\xampp\htdocs\devto-clone\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash …
Run Code Online (Sandbox Code Playgroud)

node.js reactjs next.js

77
推荐指数
3
解决办法
21万
查看次数

使用 redux-toolkit 将状态重置为初始状态

我需要将当前状态重置为初始状态。但我所有的尝试都没有成功。我如何使用 redux-toolkit 做到这一点?

const showOnReviewSlice = createSlice({
  name: 'showOnReview',
  initialState: {
    returned: [],
  },
  reducers: {
    reset(state) {
      //here I need to reset state of current slice
    },
  },
});

Run Code Online (Sandbox Code Playgroud)

javascript redux redux-toolkit

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

如何在 Microsoft.Identity.Web 中定义 SignedOut 页面?

I'm successfully signing in and out using Azure AD B2C in a Blazor Server app, but it's not clear to me the proper way to define the SignedOut page. This question seems to be more applicable to Microsoft.Identity.Web.UI, because this SignedOut page seems to be hardcoded to a very generic SignedOut.cshtml:

Signed out
You have successfully signed out.

The documentation seems to indicate this can be changed, but it does not say how exactly.

From the documentation: "By …

c# azure-active-directory blazor-server-side .net-5

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

pdfminer.high_level 未显示

我正在尝试使用 .pdf 文件将 PDF 转换为纯文本pdfminer.high_level.extract_text()。我不断收到此错误消息:

File "/Users/ian/Documents/Resume Selector Project/resumeBackend.py", line 5, in digestResume
    text = pdfminer.high_level.extract_text
AttributeError: module 'pdfminer' has no attribute 'high_level'
Run Code Online (Sandbox Code Playgroud)

起初,我认为这可能是我的模块未在系统范围内安装的问题,但我相信我已经通过在项目所在的同一目录中运行 pdf2txt.py 消除了这个可能的原因。

我将附上我的代码,以方便解决此问题。

File "/Users/ian/Documents/Resume Selector Project/resumeBackend.py", line 5, in digestResume
    text = pdfminer.high_level.extract_text
AttributeError: module 'pdfminer' has no attribute 'high_level'
Run Code Online (Sandbox Code Playgroud)

python module python-3.x pdfminer

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

属性 [livewire] 不存在

我无法使用 laravel-livewire 在 Laravel 8 路由上运行我的代码。
班级在Livewire\LandingPage.

我得到的错误是

属性 [livewire] 不存在

这是我的路线

<?php

use Illuminate\Support\Facades\Route;

Route::livewire('/' , 'LandingPage');

Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
    return view('dashboard');
})->name('dashboard');
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-livewire

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

恐慌:每种 Gas 的最大费用低于区块基本费用:地址 0xbc8153EE0b1E9B1f1E8153945400dc38EDbD8638,maxFeePerGas:1 baseFee:875000000

我找到了以下使用 SimulatedBackend 的示例。直到最近,该代码还可以正常工作,但是现在这段代码会导致恐慌(恐慌:每个 Gas 的最大费用低于区块基本费用:地址 0xbc8153EE0b1E9B1f1E8153945400dc38EDbD8638,maxFeePerGas:1 baseFee:875000000)。我怀疑这与伦敦的更新有关。

package eth

import (
    "context"
    "math/big"
    "testing"

    "github.com/ethereum/go-ethereum/accounts/abi/bind"
    "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/core"
    "github.com/ethereum/go-ethereum/core/types"
    "github.com/ethereum/go-ethereum/crypto"
)

func TestSimulatedBackend(t *testing.T) {
    privateKey, err := crypto.GenerateKey()
    if err != nil {
        t.Fatalf("failed to generate key: %v", err)
    }

    auth, err := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337))
    if err != nil {
        t.Fatalf("failed to generate transaction: %v", err)
    }

    balance := new(big.Int)
    balance.SetString("10000000000000000000", 10) // 10 eth in wei

    address := auth.From
    genesisAlloc := map[common.Address]core.GenesisAccount{
        address: {
            Balance: balance,
        },
    } …
Run Code Online (Sandbox Code Playgroud)

go go-ethereum

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

将 WebElement 类型转换为 By 类型

有没有办法将WebElement类型对象转换为By硒中的类型对象?类型转换不起作用。

我有一个只接受 By 的函数,所以我需要将 a 转换WebElement为 a By

java selenium selenium-webdriver

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

pd.read_csv 忽略括号内的逗号

我有一个非常简单的文件:

[Name]
Streamline 1


[Data]
X [ m ], Y [ m ], Z [ m ], Velocity [ m s^-1 ]
2.66747564e-01, 0.00000000e+00, 2.03140453e-01, (0.00000000e+00, 8.17744827e+00, 0.00000000e+00)
2.66958952e-01, 0.00000000e+00, 2.07407191e-01, (0.00000000e+00, 6.77392197e+00, 0.00000000e+00)
2.63460875e-01, 0.00000000e+00, 2.06593186e-01, (0.00000000e+00, 7.04168701e+00, 0.00000000e+00)
2.65424699e-01, 0.00000000e+00, 2.00831652e-01, (0.00000000e+00, 8.93691921e+00, 0.00000000e+00)
2.70607203e-01, 0.00000000e+00, 2.02286631e-01, (0.00000000e+00, 8.45830917e+00, 0.00000000e+00)
2.68299729e-01, 0.00000000e+00, 1.97365344e-01, (0.00000000e+00, 1.00771456e+01, 0.00000000e+00)
...
Run Code Online (Sandbox Code Playgroud)

我需要将速度作为向量加载到单行中。

我的基本代码:

df = pd.read_csv("C:/Users/Marek/Downloads/0deg-5ms.csv", skiprows=5)
Run Code Online (Sandbox Code Playgroud)

但这种尝试导致第 2 列成为索引,其余的分成 4 列。index_col=False可以解决索引的问题,但是会导致索引超出范围。我需要一个分隔符来隐式告诉 pandas 忽略括号中的任何内容。我认为python 在读取 csv 文件时忽略带有括号的分隔符可能会起作用,但是是的,我到处都有空格。我发现了一些使用扩展函数来加载文件并按行处理它们的解决方案,例如包含括号中偶尔有逗号的列的 …

python regex csv pandas

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

使用 Spring boot + WebFlux 进行全局错误处理

在 Spring boot Rest 控制器中使用响应式编程时,我们如何全局处理异常?

我认为这@ControllerAdvice行不通,因为我已经尝试过但没有成功。

目前我的另一个尝试是这个选项,使用自定义属性:

@Component
public class OsvcErrorAttributes extends DefaultErrorAttributes {
    public OsvcErrorAttributes() {
        super(true);
    }

    @Override
    public Map<String, Object> getErrorAttributes(ServerRequest request, boolean includeStackTrace) {
        return assembleError(request);
    }

    private Map<String, Object> assembleError(ServerRequest request) {
        ServerException serverException = (ServerException)getError(request);

        Map<String, Object> errorAttributes = new HashMap<>();
        errorAttributes.put("message", serverException.getMessage());
        errorAttributes.put("errors", serverException.getErrorMap());
        return errorAttributes;
    }
}
Run Code Online (Sandbox Code Playgroud)

和 WebExceptionHandler 像这样:

@Component
@Order(-2)
public class OsvcErrorHandler extends AbstractErrorWebExceptionHandler {
    public OsvcErrorHandler(ErrorAttributes errorAttributes,
                            ResourceProperties resourceProperties,
                            ApplicationContext applicationContext) {
        super(errorAttributes, resourceProperties, applicationContext);

        // …
Run Code Online (Sandbox Code Playgroud)

exception spring-boot project-reactor spring-webflux

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

Xarray 长格式到宽格式 - 相当于 Pandas 的枢纽

我正在寻找一种在 Xarray 中制作数据透视表的方法,类似于 Pandas.pivotset_index([...]).unstack().

基本上,我有一些包含 3 列的表格数据:

数据

我想(在 Xarray 中)通过旋转或 set_index([...]).unstack()操作将其转换为宽格式,如通过 Pandas 所示:

数据透视表

当然,我可以首先通过 Pandas 将数据从长格式转换为宽格式,然后将其加载到 Xarray 中:

df = pd.DataFrame(data)
df = df.set_index(['price','date']).unstack()
x = xr.DataArray(df.values,dims=("price","date"),
                 coords={"price":df.index,
                         "date":df.columns.get_level_values(1)},
                 attrs={"long_name":"volume","units":'BTC'})
Run Code Online (Sandbox Code Playgroud)

给出以下结果:

结果

但我真的希望有一种方法可以在不使用 Pandas 的情况下完成所有这些工作,因为我还想利用 Xarray 的本机 Dask 支持。

python pandas python-xarray

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