笑咖

文章 评论 浏览 28

笑咖 2025-02-02 11:30:50

在您的服务器上创建两个路由,一个以创建订单(并返回结果JSON),而将订单ID作为参数并捕获它(并返回JSON结果)。

这两种路线都应返回/输出仅JSON(无html或文本)。

将这两条路线与此批准流配对: https://developer.paypal.com/demo/checkout/patern/pattern/server

Create two routes on your server, one to create an order (and return the resulting JSON), and one that takes an order id as a parameter and captures it (and returns the JSON result).

Both of these routes should return/output only JSON (no HTML or text).

Pair those two routes with this approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

如何将订单ID传递给PayPal按钮?

笑咖 2025-02-01 05:36:49

如果要靶向Android API级别28,则要使用的Android SDK版本为9(#Android.sdk = 9)。但是,如果您想创建一个应用程序并将其上传到播放商店,那么我认为最小API级别应为31,因此Android SDK版本为12。您可以在下面的链接上检查该级别:
https://develoveling.android.com/studio/studio/releases/releases/platforms

If you want to target android API level 28, then the android SDK version that you are going to use is 9(#android.sdk = 9). But if you want to create an app and upload it to play store then i think that the minimum API level should be 31, so the android SDK version is 12. You can check that on the link below:
https://developer.android.com/studio/releases/platforms

如何解决Buidozer Python Kivy中的错误?

笑咖 2025-02-01 01:55:10

在示例中,您可以测试属性的存在 sshkeys 。我认为这是因为字典中可能缺少此属性。让我们从 user3 中删除此属性,以进行测试

    users:
      user1:
        comment: User 1
        sshkeys:
          - ssh-rsa ******** user1.key
        state: present
      user2:
        comment: User 2
        sshkeys:
          - ssh-rsa ******** user2.key-a
          - ssh-rsa ******** user2.key-b
        state: present
      user3:
        comment: User 3
        state: present


q: “我应该如何在此sshkeys列表上迭代?

a1:无需迭代sshkeys列表。可以一步一步地配置它们。引用

可以在单个密钥字符串值中通过新线分开来指定多个键。

例如,

    - debug:
        msg: |-
          user: {{ item.key }}
          state: {{ item.value.state }}
          key: {{ item.value.sshkeys|join('\n') }}
      loop: "{{ users|dict2items }}"
      when:
        - item.value.state == 'present'
        - item.value.sshkeys|d([])|length > 0

请给出(删节)

  msg: |-
    user: user1
    state: present
    key: ssh-rsa ******** user1.key
  msg: |-
    user: user2
    state: present
    key: ssh-rsa ******** user2.key-a\nssh-rsa ******** user2.key-b

如果要迭代密钥,


,请继续使用下一个选项。 A2:
作为第一步,添加属性 sshkeys 如果现在丢失

    - set_fact:
        users: "{{ dict(_keys|zip(_vals_update)) }}"
      vars:
        _keys: "{{ users.keys()|list }}"
        _vals: "{{ users.values()|list }}"
        _vals_update: "{{ [{'sshkeys': []}]|
                          product(_vals)|
                          map('combine')|list }}"

  users:
    user1:
      comment: User 1
      sshkeys:
      - ssh-rsa ******** user1.key
      state: present
    user2:
      comment: User 2
      sshkeys:
      - ssh-rsa ******** user2.key-a
      - ssh-rsa ******** user2.key-b
      state: present
    user3:
      comment: User 3
      sshkeys: []
      state: present

请迭代用子元素给出的字典

    - debug:
        msg: >-
          user: {{ item.0.key }}
          state: {{ item.0.value.state }}
          key: {{ item.1 }}
      with_subelements:
        - "{{ users|dict2items }}"
        - value.sshkeys
      when: item.0.value.state == 'present'

(删节)

  msg: 'user: user1 state: present key: ssh-rsa ******** user1.key'
  msg: 'user: user2 state: present key: ssh-rsa ******** user2.key-a'
  msg: 'user: user2 state: present key: ssh-rsa ******** user2.key-b'

In the example, you test the existence of the attribute sshkeys. I assume this is because this attribute might be missing in the dictionary. Let's remove this attribute from user3 for testing

    users:
      user1:
        comment: User 1
        sshkeys:
          - ssh-rsa ******** user1.key
        state: present
      user2:
        comment: User 2
        sshkeys:
          - ssh-rsa ******** user2.key-a
          - ssh-rsa ******** user2.key-b
        state: present
      user3:
        comment: User 3
        state: present


Q: "How should I iterate over this sshkeys list?"

A1: It's not necessary to iterate the list of sshkeys. It's possible to configure them all in one step. Quoting from exclusive:

Multiple keys can be specified in a single key string value by separating them by newlines.

For example

    - debug:
        msg: |-
          user: {{ item.key }}
          state: {{ item.value.state }}
          key: {{ item.value.sshkeys|join('\n') }}
      loop: "{{ users|dict2items }}"
      when:
        - item.value.state == 'present'
        - item.value.sshkeys|d([])|length > 0

gives (abridged)

  msg: |-
    user: user1
    state: present
    key: ssh-rsa ******** user1.key
  msg: |-
    user: user2
    state: present
    key: ssh-rsa ******** user2.key-a\nssh-rsa ******** user2.key-b

If you want to iterate the keys, proceed to the next option.


A2:
As a first step add the attribute sshkeys if missing

    - set_fact:
        users: "{{ dict(_keys|zip(_vals_update)) }}"
      vars:
        _keys: "{{ users.keys()|list }}"
        _vals: "{{ users.values()|list }}"
        _vals_update: "{{ [{'sshkeys': []}]|
                          product(_vals)|
                          map('combine')|list }}"

gives

  users:
    user1:
      comment: User 1
      sshkeys:
      - ssh-rsa ******** user1.key
      state: present
    user2:
      comment: User 2
      sshkeys:
      - ssh-rsa ******** user2.key-a
      - ssh-rsa ******** user2.key-b
      state: present
    user3:
      comment: User 3
      sshkeys: []
      state: present

Now, iterate the dictionary with subelements

    - debug:
        msg: >-
          user: {{ item.0.key }}
          state: {{ item.0.value.state }}
          key: {{ item.1 }}
      with_subelements:
        - "{{ users|dict2items }}"
        - value.sshkeys
      when: item.0.value.state == 'present'

gives (abridged)

  msg: 'user: user1 state: present key: ssh-rsa ******** user1.key'
  msg: 'user: user2 state: present key: ssh-rsa ******** user2.key-a'
  msg: 'user: user2 state: present key: ssh-rsa ******** user2.key-b'

迭代列表

笑咖 2025-01-31 21:13:19

屁股认为您正在使用真实的日历ID(例如Gmail地址),

var eventCal = CalendarApp.getCalendarById('//gmail address'); 

您正在获取 null 分配给 eventCal ,因为有效的用户否可以访问推荐日历。

  1. 验证您可以使用用于运行脚本的帐户访问日历。

根据经验,运行Google Apps脚本功能时,请避免登录多个帐户。这是因为可以使用默认帐户而不是可以访问所需资源的帐户来调用对话框,侧栏或Web应用程序的服务器端函数。

Assumming that you are using a real calendar id (like Gmail address) in

var eventCal = CalendarApp.getCalendarById('//gmail address'); 

you are getting null assigned to eventCal because the effective user don't have access to the referred calendar.

  1. Validate that you can access the calendar with the account that you are using to run the script.

As a rule of thumb avoid sign-in into multiple accounts when running a Google Apps Script function. This because calling a server-side function from a dialog, sidebar or web-app might be done using the default account instead of the account that has access to the required resources.

TypeError:无法读取属性' getEventById' null

笑咖 2025-01-31 13:08:42

找出问题的根源。

该问题与我使用的编译器(G ++ 11.1.0)或GCOV(9.3.0)有关。

当编译器从G ++更改为Clang时,代码覆盖范围报告了正确的结果。

为了确保问题与编译器的特定版本有关(G ++ 11.1.0),我将系统从Ubuntu 20.04.4 LTS升级到Ubuntu 22.04.4 LTS。

测试条件如下如下

  • 22.04.4 LTS
  • G ++(Ubuntu 11.2.0-19ubuntu1)11.2.0
  • GCOV(Ubuntu 11.2.0-19ubuntu1)11.2.0 11.2.0

更新后,代码覆盖率与正确的结果报告了正确的结果G ++。

Find out the source of the problem.

The problem was related to the compiler (g++ 11.1.0) or gcov (9.3.0) I used.

The code coverage reported the correct result when the compiler changed from g++ to clang.

To ensure the problem is related to the specific version of the compiler (g++ 11.1.0), I upgraded the system from Ubuntu 20.04.4 LTS to Ubuntu 22.04.4 LTS.

The test condition became as follow

  • Ubuntu 22.04.4 LTS
  • g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0
  • gcov (Ubuntu 11.2.0-19ubuntu1) 11.2.0

After the update had been made, the code coverage reported the correct result with g++.

GCOV/LCOV忽略了“未使用函数”之前声明的``使用函数''

笑咖 2025-01-31 05:41:02

foo()成功中使用 callback()函数。
以这种方式尝试。这很容易理解。

var lat = "";
var lon = "";

function callback(data) {
    lat = data.lat;
    lon = data.lon;
}

function getLoc() {
    var url = "http://ip-api.com/json"
    $.getJSON(url, function(data) {
        callback(data);
    });
}

getLoc();

Use a callback() function inside the foo() success.
Try it in this way. It is simple and easy to understand.

var lat = "";
var lon = "";

function callback(data) {
    lat = data.lat;
    lon = data.lon;
}

function getLoc() {
    var url = "http://ip-api.com/json"
    $.getJSON(url, function(data) {
        callback(data);
    });
}

getLoc();

如何从异步电话中返回响应?

笑咖 2025-01-31 01:59:33

您必须声明相同的加密数据才能正确解密它。

在您的PLSQL代码 iv 变量中,变量与 iv 在PHP中声明的值不同,因此您将无法在PLSQL中解密数据,您将其加密使用不同的 iv << iv <<。 /代码>在PHP中。

在PLSQL中使用相同的 iv 值与PHP中的值将解决该问题。

You have to declare same cryptographic data to be able to decrypt it correctly.

In your PLSQL code IV variable has different value from IV declared in PHP, so you wont be able to decrypt data in PLSQL, which you encrypted with different IV in PHP.

Using the same IV value in PLSQL as in PHP will solve the problem.

如何在使用PHP加密的PL/SQL中解密字符串?

笑咖 2025-01-31 00:46:04

您可以创建这样的特定文件
页 - &gt;服务 - &GT; service-3.js

或您可以处理
页 - &gt; 404.js

You can create specific file like this
pages -> services -> service-3.js

Or you can handle in
pages -> 404.js

如何告诉NextJS尝试在其他动态路线中查找页面?

笑咖 2025-01-30 14:19:57

Taking this example dataframe df:

df <- structure(list(Working.hours = c("37-42", "37-42", "<27", "<27", 
"43+", "43+", "33-36", "33-36", "37-42", "37-42", "<27", "<27"
), country = c("DK", "DK", "SE", "SE", "DK", "DK", "SE", "SE", 
"NO", "NO", "NO", "NO"), criterion = c("happy", "lifesatisfied", 
"happy", "lifesatisfied", "happy", "lifesatisfied", "happy", 
"lifesatisfied", "happy", "lifesatisfied", "happy", "lifesatisfied"
), score = c(7L, 9L, 8L, 8L, 7L, 8L, 6L, 6L, 7L, 5L, 4L, 7L)), row.names = c(NA, 
-12L), class = c("tbl_df", "tbl", "data.frame"))

you can proceed like this:

library(dplyr)
library(ggplot2)

df <- 
    df %>%
    pivot_longer(cols = c(happy, lifesatisfied),
                 names_to = 'criterion',
                 values_to = 'score'
                 )

df %>%
    ggplot(aes(x = Working.hours,
            y = score,
            fill = criterion)) +
        geom_col(position = 'dodge') +
        coord_flip()

For picking colours see ?scale_fill_manual, for formatting legend etc. numerous existing answers to related questions on stackoverflow.

Taking this example dataframe df:

df <- structure(list(Working.hours = c("37-42", "37-42", "<27", "<27", 
"43+", "43+", "33-36", "33-36", "37-42", "37-42", "<27", "<27"
), country = c("DK", "DK", "SE", "SE", "DK", "DK", "SE", "SE", 
"NO", "NO", "NO", "NO"), criterion = c("happy", "lifesatisfied", 
"happy", "lifesatisfied", "happy", "lifesatisfied", "happy", 
"lifesatisfied", "happy", "lifesatisfied", "happy", "lifesatisfied"
), score = c(7L, 9L, 8L, 8L, 7L, 8L, 6L, 6L, 7L, 5L, 4L, 7L)), row.names = c(NA, 
-12L), class = c("tbl_df", "tbl", "data.frame"))

you can proceed like this:

library(dplyr)
library(ggplot2)

df <- 
    df %>%
    pivot_longer(cols = c(happy, lifesatisfied),
                 names_to = 'criterion',
                 values_to = 'score'
                 )

df %>%
    ggplot(aes(x = Working.hours,
            y = score,
            fill = criterion)) +
        geom_col(position = 'dodge') +
        coord_flip()

For picking colours see ?scale_fill_manual, for formatting legend etc. numerous existing answers to related questions on stackoverflow.

如何通过在X轴上使用两个变量和Y轴上的分组变量来制作条形图?

笑咖 2025-01-30 11:47:16

使用 @Woxxom的解决方案,我可以做到!
它需要的只是他的解决方案(请参阅注释),以更改文本框的内部值,并且它们是El.dispatchevent,其中Enter On On On键使提交工作!

With @wOxxOm's solution I was able to do it!
All it needed was his solution (see comments) to change the inside value of the textbox and them a el.dispatchEvent with enter on it's key made the submit work!

JS greasemonkey输入文本框

笑咖 2025-01-30 09:34:09

我启用了一个启用工作负载身份的新鲜集群。

我使用以下日志探索器查询:

resource.type="k8s_container"
jsonPayload.message:"Unable to sync sandbox" 
resource.labels.container_name="gke-metadata-server"

立即看到了相同的日志消息。

我的理解是,这是您可以 /应该忽略的良性消息 /正常日志消息。

它是通过创建POD触发的 Kubectl Run Nginx -image = nginx ,并立即看到了该消息。 (我认为它也是由豆荚被删除而触发的,因为我再次看到集群Autoscaler缩放一些节点时。)

I spun up a fresh cluster with workload identity enabled.

I used the following log explorer query:

resource.type="k8s_container"
jsonPayload.message:"Unable to sync sandbox" 
resource.labels.container_name="gke-metadata-server"

and immediately saw the same log message.

It's my understanding that that's a benign message / normal log message that you can / should ignore.

It's triggered by creating pods I ran kubectl run nginx --image=nginx, and immediately saw the message. (I think it's also triggered by pods being deleted as I saw it again when cluster autoscaler scaled down some nodes.)

gke实例元数据吊舱记录“无法同步沙盒”数百万次

笑咖 2025-01-30 03:09:47

使用下游收藏家映射学生的名字。

 students.stream()
                .collect(Collectors.groupingBy(Student::getGrade, 
                         Collectors.mapping(Student::getName, Collectors.toList())));

Use downstream collector to map the Student to name.

 students.stream()
                .collect(Collectors.groupingBy(Student::getGrade, 
                         Collectors.mapping(Student::getName, Collectors.toList())));

获取一个地图&lt; string,list&lt; string&gt;&gt;从List&lt; Pojo&gt;

笑咖 2025-01-29 18:42:02

最后发现了。原因是在Traefik路线中。我使用的是“主机( example.com” rel =“ nofollow noreferrer”> https://github.com/traefik/traefik/pull/7008 。主机的检查既是标题主机检查和服务器名称指示。如果切换到“ Hostheader( example.com )”仅检查标题主机,这足以适合Nginx代理。

Figured it out in the end. The reason is in the traefik routes. I was using "Host(example.com)" which is not enough due to changes made in this PR https://github.com/traefik/traefik/pull/7008. The check for Host is both the header host check and the server name indication. If switched to "HostHeader(example.com)" only header host is checked, which is enough for the nginx proxy.

无法从nganx到traefik在ELB后面的traefik

笑咖 2025-01-29 01:32:12

think 您的路径看起来像:

/assets/images/mall.png

,但是您的pubspec.yaml说的是:

/images/mall.png

,找不到它。

确保您的Filetree与您在PubSpec.yaml中所说的相同,不要忘记正确缩进。

明确:

资产:

  • 图像/

并不意味着/资产/图像/

应该是:

资产:

  • 资产/图像/

I think you have a path that looks like:

/assets/images/mall.png

but your pubspec.yaml is saying it's:

/images/mall.png

and can't find it.

Make sure your filetree is the same as you're telling it is in pubspec.yaml and don't forget to indent correctly.

To be clear:

assets:

  • images/

does NOT mean /assets/images/

it should then be:

assets:

  • assets/images/

使用image.asset()导入图像的问题

笑咖 2025-01-28 23:26:04

您可以为您需要的内容“刮擦” ZSH源文件,然后使用 eval 在bash中执行代码。 一些功能

test1() {
    echo "Hello from test1"
}

test2() {
    echo $((1 + $1))
}

示例

# Specify source script and functions
source_filename="script.zsh"
source_functions=" \
    test1          \
    test2          \
"

# Perform "sourcing"
function_definitions="$(python -B -c "
import re
with open('${source_filename}', mode='r') as file:
    content = file.read()
for func in '${source_functions}'.split():
    print(re.search(func + r'\(\).*?\n}', content, flags=re.DOTALL).group())
" )"
eval "${function_definitions}"

# Try out test functions
test1                         # Hello from test1
n=5
echo "$n + 1 is $(test2 $n)"  # 5 + 1 is 6

这是一个用于 test1 test2 在ZSH脚本中定义:

bash script.sh

上面使用Python,特别是其 re 模块。它只需查找表单 funcname()的字符序列,然后假设该函数以第一个} 结束。因此,这不是很一般,但是如果您以这种方式编写功能,则有效。

You can "scrape" the zsh source file for what you need, then execute the code in bash using eval. Here's an example for doing this for a few functions:

File script.zsh:

test1() {
    echo "Hello from test1"
}

test2() {
    echo $((1 + $1))
}

File script.sh (bash):

# Specify source script and functions
source_filename="script.zsh"
source_functions=" \
    test1          \
    test2          \
"

# Perform "sourcing"
function_definitions="$(python -B -c "
import re
with open('${source_filename}', mode='r') as file:
    content = file.read()
for func in '${source_functions}'.split():
    print(re.search(func + r'\(\).*?\n}', content, flags=re.DOTALL).group())
" )"
eval "${function_definitions}"

# Try out test functions
test1                         # Hello from test1
n=5
echo "$n + 1 is $(test2 $n)"  # 5 + 1 is 6

Run the bash script and it will make use of the functions test1 and test2 defined in the zsh script:

bash script.sh

The above makes use of Python, specifically its re module. It simply looks for character sequences of the form funcname(), and assumes that the function ends at the first }. So it's not very general, but works if you write your functions in this manner.

如何从bash脚本中获取ZSH脚本?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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