小编Dar*_*ava的帖子

用 numpy 求逆分数矩阵

我有一个 n*n 矩阵,如下所示:

[
    [Fraction(1, 1), Fraction(-1, 2)],
    [Fraction(-4, 9), Fraction(1, 1)]
]
Run Code Online (Sandbox Code Playgroud)

我想找到它的倒数。Fraction由于其中有s,因此执行以下操作:

from numpy.linalg import inv
inv(M)
Run Code Online (Sandbox Code Playgroud)

不起作用。我明白了TypeError: No loop matching the specified signature and casting was found for ufunc inv

python numpy

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

在Java中提取路径的一部分

我有这样的文件路径:

/home/Dara/Desktop/foo/bar/baz/qux/file.txt
Run Code Online (Sandbox Code Playgroud)

在Java中,我希望能够获得前两个文件夹.IE浏览器.baz/qux无论文件路径长度或操作系统如何(文件路径分隔符如/ :\).我试图使用该subpath()方法,Paths但我似乎无法找到获取文件路径长度的通用方法.

java file path filepath

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

C有任何BigDecimal类吗?

我看着整个互联网,我似乎找不到一个.

Java中有类似的东西,但我需要使用C(最好是我可以在本地使用的东西).有没有人有任何想法?

c bigdecimal

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

使用 API ID 通过 Stripe 一次性付款

我使用 Stripe 创建了一个订阅服务。我可以订阅用户使用定期付款。这是相关代码(节点):

  // Create the subscription
  const subscription = await stripe.subscriptions.create({
    customer: req.body.customerId,
    items: [{ price: req.body.priceId }],
    expand: ['latest_invoice.payment_intent'],
  });
Run Code Online (Sandbox Code Playgroud)

这有效并使用priceId仪表板中所示的:

在此处输入图片说明

但是,当我销售不经常出现的产品时,它就会失败。我收到错误:

The price specified is set to `type=one_time` but this field only accepts prices with `type=recurring`
Run Code Online (Sandbox Code Playgroud)

我理解错误,但我不确定是否可以将订阅设置为不重复。

我的应用程序有 3 层:

  • 一旦脱落
  • 每月
  • 每年

理想情况下,我不想添加一个全新的代码段来处理似乎是订阅所做的一个子集的事情,但即使我这样做了,该paymentIntent对象似乎只需要一个数量而不是 API ID,如图所示. 有没有办法使用我已经建立的基础设施来做到这一点?

stripe-payments

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


标签 统计

bigdecimal ×1

c ×1

file ×1

filepath ×1

gestures ×1

java ×1

javascript ×1

jquery ×1

mouse ×1

numpy ×1

path ×1

python ×1

stripe-payments ×1