装纯掩盖桑

文章 评论 浏览 26

装纯掩盖桑 2025-02-21 01:55:46

返回的JSON中没有数据属性。只需解析JSON,然后将该数据作为参数GetUser

function getUser(data) {
  for (const prop in data) {
    console.log(`${prop}: ${data[prop]}`);
  }
}

async function display(id) {
  try {
    const url = `https://jsonplaceholder.typicode.com/users/${id}`;
    const response = await fetch(url);
    const data = await response.json();
    getUser(data);
  } catch (err) {
    console.log(err.message);
  }
}

display(3);

There is no data property in the returned JSON. Just parse the JSON and then have that data as an argument to getUser.

function getUser(data) {
  for (const prop in data) {
    console.log(`${prop}: ${data[prop]}`);
  }
}

async function display(id) {
  try {
    const url = `https://jsonplaceholder.typicode.com/users/${id}`;
    const response = await fetch(url);
    const data = await response.json();
    getUser(data);
  } catch (err) {
    console.log(err.message);
  }
}

display(3);

JavaScript-来自Ajax的对象迭代

装纯掩盖桑 2025-02-20 00:21:02

让我们在shell中的命令的一般语法是:

[var=val...] cmd [args...]

var = val正在用value 带有value val在命令持续时间CMD

为什么发生这种情况

两个命令truefalse忽略参数。 true Enthown带有0退出状态的退出,<代码> false事物带有非零退出状态的退出。 true -a false执行命令true带有两个参数,sting -a和字符串 false 。 true忽略参数,退出状态为零。对于false,也是如此。

a = [导出一个变量a带有字符串的值的值[到下一个命令的环境。

$ a=[ env | grep '^a='
a=[

a = [true -a false]设置环境变量a到字符串的值>使用3个参数字符串-a,字符串false和字符串]

  a=[ true -a false ]
  |   |    |  |     \----  third argument
  |   |    |  \----------  second argument
  |   |    \-------------  first argument
  |   \------------------  command to execute
  \----------------------  var=val, exports a variable

true再次忽略参数,true再次,带有退出状态0退出。对于false,具有非零退出状态也是如此。

显示true的值echo $ a是您先前在外壳中设置的值。 a = [true ...仅设置命令耐用的变量a,此后该变量具有其自身的值。

$ a=anything_here
$ a=anything_here2 true anything_here3
$ echo $?
0               # true exits with 0 exit status
$ echo $a
anything_here   # the variable `a` preserved its value set before the command

为什么“ false -a true”和“ true -a false”在shell中返回不同的结果?

因为命令falsetrue带有不同退出状态的退出。

注意:字符串true false [ ] -a对壳。这些都是字符串。字符串-a]作为传递作为参数的特殊含义,命令 [。它仍然是字符串-a,但是当执行可执行时,它会解析参数并特别在字符串-a -a上行动。碰巧有名为truefalse的可执行文件。字符串[]truefalse-a本身具有对于壳没有意义,这些都是字符串。

-a and&&&&amp;全部是外壳的操作,

否,-a是Shell中的字符串-a&amp;&amp;是Shell中的“和”操作。 -a[test 命令的“和”运算符。注意:由于[>,更喜欢使用[...]&amp;&amp; [...]而不是[... -a ...]

参考: https://pubs.opengroup.org/onlinepubs/9699919799.2018Edition/utilities/test.html https://www.gnu.org/savannah-checkouts/gnu/bash/manual/manual/bash.html#simple-command-command-expansion https://pubs.opengroup.org/onlinepubs/9699919799.2018Edition/utilities/true.html https://pubs.opengroup.org/onlinepubs/9699919799.2018Edition/utilities/false.html https://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html#tag_02_09_01

Let's the general syntax of a command in shell is:

[var=val...] cmd [args...]

The var=val are exporting environment variable var with the value val for the duration of command cmd.

Why did this happen

Both commands true and false ignore arguments. true anything exits with 0 exit status, false anything exits with non-zero exit status. true -a false executes command true with two arguments, sting -a and string false. true ignores arguments, exits with zero exit status. The same for false.

a=[ exports a variable a with the value of string [ to the environment of the next command.

$ a=[ env | grep '^a='
a=[

a=[ true -a false ] set's environment variable a to the value of string [ and then executes command true with 3 arguments string -a, the string false and the string ].

  a=[ true -a false ]
  |   |    |  |     \----  third argument
  |   |    |  \----------  second argument
  |   |    \-------------  first argument
  |   \------------------  command to execute
  \----------------------  var=val, exports a variable

true ignores the arguments and true once again, exits with exit status 0. The same is for false, with non-zero exit status.

The value echo $a that shows true is the value that you previously have set in your shell. The a=[ true ... only set's the variable a for the duraction of the command, after that the variable has it's own value.

$ a=anything_here
$ a=anything_here2 true anything_here3
$ echo $?
0               # true exits with 0 exit status
$ echo $a
anything_here   # the variable `a` preserved its value set before the command

Why ”false -a true“ and "true -a false" in shell return a different results?

Because commands false and true exit with different exit status.

Note: the strings true false [ ] -a have no special meaning for shell. These are all strings. The string -a and ] have special meaning when passed as an argument for the command [. It's still the string -a, but when the executable [ is executed, it parses the arguments and acts specially on the string -a. There happen to be executables named true and false. The strings [, ], true, false or -a by itself have no significant for shell, these are all just strings.

-a and && are all and operation in shell,

No, -a is the string -a in shell. && is an "and" operation in shell. -a is the "and" operator for [ or test commands. Note: because of problems with [, prefer to use [ ... ] && [ ... ] instead of [ ... -a ... ].

References: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/test.html , https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Simple-Command-Expansion , https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/true.html , https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/false.html , https://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html#tag_02_09_01 .

为什么&#x201D; false -a true&#x201c;和“ true -a false”在外壳中,返回不同的结果?

装纯掩盖桑 2025-02-19 14:24:37

考虑将咖啡杯育儿到手对象。如果您没有手对象,请将一个空的游戏对象添加到一个孩子的角色中,然后将其放在手部位置。

当您进入扳机时,将杯子在手对象下方并设置为vector3.zero

public Transform hand;
public Transform coffee;
void OnTriggerEnter(Collider collider)
{
    coffee.SetParent(hand);
    coffee.localPosition = Vector3.zero;
}

Consider parenting the coffee cup to the hand object. If you don't have a hand object, add an empty game object to the character as child and place it at the hand position.

When you enter the trigger, parent the cup under the hand object and set its position to Vector3.zero

public Transform hand;
public Transform coffee;
void OnTriggerEnter(Collider collider)
{
    coffee.SetParent(hand);
    coffee.localPosition = Vector3.zero;
}

我的Coroutine将行不通。我该如何修复?

装纯掩盖桑 2025-02-18 15:17:36

您真的只想打印出SQL语句 - 试图解决所有这些串联是错误的错误。

strSQL = "SELECT fct_monitoring.MeasureID FROM fct_monitoring WHERE MeasureID IN (" & _ 
    Chr(34) & "CAUTI_Rate_All" & Chr(34) & "," & _ 
    Chr(34) & "CDI_LabID" & Chr(34) & "," & _ 
    Chr(34) & "CLABSI_Rate_All" & Chr(34) & "," & _ 
    Chr(34) & "Falls_Injury" & Chr(34) & "," & _ 
    Chr(34) & "READ-1" & Chr(34) & ")" & _ 
    Chr(34) & "CAUTI_SIR_All" & Chr(34) & "," & _ 
    Chr(34) & "CDI_SIR" & Chr(34) & "," & _ 
    Chr(34) & "CLABSI_SIR_All" & Chr(34) & "," & _ 
    " GROUP BY fct_monitoring.MeasureID;"

Debug.Print(sqlStr)

SQL语句,您可以更好地阅读 - 如果需要

通过该调试输出,您可以查看一些使某些更有意义的东西(应该是 这种更好的格式,我想我可以看到,大概是在阅读1之后,您有一个括号,应该是引用,而在clabsi_sir_all之后,您有一个逗号,您应该有一个括号(看起来像是有人决定移动一条线)) 。

You really want to just print out the sql statement - it is too error prone to try to work out all these concatenations.

strSQL = "SELECT fct_monitoring.MeasureID FROM fct_monitoring WHERE MeasureID IN (" & _ 
    Chr(34) & "CAUTI_Rate_All" & Chr(34) & "," & _ 
    Chr(34) & "CDI_LabID" & Chr(34) & "," & _ 
    Chr(34) & "CLABSI_Rate_All" & Chr(34) & "," & _ 
    Chr(34) & "Falls_Injury" & Chr(34) & "," & _ 
    Chr(34) & "READ-1" & Chr(34) & ")" & _ 
    Chr(34) & "CAUTI_SIR_All" & Chr(34) & "," & _ 
    Chr(34) & "CDI_SIR" & Chr(34) & "," & _ 
    Chr(34) & "CLABSI_SIR_All" & Chr(34) & "," & _ 
    " GROUP BY fct_monitoring.MeasureID;"

Debug.Print(sqlStr)

With that debug output you can look at something that makes a bit more sense (it should be a sql statement you can read better - if you want, you can even paste it into a query in sql design view and run it.

Although actually in this better format, I think I can see that probably after READ-1 you have a parenthesis that should be a quote, and after CLABSI_SIR_All you have a comma where you should have a parenthesis (this looks like someone decided to move a line around).

在运行时错误3129中需要帮助,并使用SELECT语句

装纯掩盖桑 2025-02-18 13:16:26

发生此错误是因为./上载/不存在。

fyi:
如果使用Multer如下

const upload = multer({dest:'uploads'})

这将在服务器启动时创建Uploads Directories。

但是,如果我们使用目标对象,则它不会创建目录。

证明/参考: ”
https://www.npmjs.coms.coms.com/package/package/multer#diskstorage

解决方案

const fs = require('fs'); // Added to create directories
const multer = require('multer');

const storage = multer.diskStorage({
  destination: function(req, file, cb) {
    // :::::::::::::::Create diretories:::::::::::::::::::
    fs.mkdir('./uploads/',(err)=>{
       cb(null, './uploads/');
    });
  },
  filename: function(req, file, cb) {
    cb(null, new Date().toISOString() + file.originalname);
  }
});

const fileFilter = (req, file, cb) => {
  // reject a file
  if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/png') {
    cb(null, true);
  } else {
    cb(null, false);
  }
};

const upload = multer({
  storage: storage,
  limits: {
    fileSize: 1024 * 1024 * 5
  },
  fileFilter: fileFilter
});

This error occurs because ./uploads/ does not exist.

FYI :
If you use multer like below

const upload = multer({ dest: 'uploads' })

This creates uploads directories at server starting.

but if we use destination object then it does not create directory.

Proof/ref: https://www.npmjs.com/package/multer#diskstorage
https://www.npmjs.com/package/multer#diskstorage

Solution

const fs = require('fs'); // Added to create directories
const multer = require('multer');

const storage = multer.diskStorage({
  destination: function(req, file, cb) {
    // :::::::::::::::Create diretories:::::::::::::::::::
    fs.mkdir('./uploads/',(err)=>{
       cb(null, './uploads/');
    });
  },
  filename: function(req, file, cb) {
    cb(null, new Date().toISOString() + file.originalname);
  }
});

const fileFilter = (req, file, cb) => {
  // reject a file
  if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/png') {
    cb(null, true);
  } else {
    cb(null, false);
  }
};

const upload = multer({
  storage: storage,
  limits: {
    fileSize: 1024 * 1024 * 5
  },
  fileFilter: fileFilter
});

Inoent:没有这样的文件或目录。

装纯掩盖桑 2025-02-18 11:26:59

^表示“与” 兼容。因此,例如,如果您要运行npm Updatenpm install,则指定了一个软件包“^4.3.1”在您的package.json中,将安装最新的4.xx版本,而不是5.xx版本,因为该较新版本可能是不兼容的。有几种特殊情况:

^1.2.3 is&gt; = 1.2.3&lt; 2.0.0

^0.2.3 is&gt; = 0.2.3&lt; 0.3.0(0.xx是特殊)

^0.0.1 is = 0.0.1(0.0.x是特殊)

^1.2 is&gt; = 1.2.0&lt ; 2.0.0(类似 ^1.2.0)

^1 is&gt; = 1.0.0&lt; 2.0.0

如果有疑问,我会使用一个semver计算器,例如 https://semver.npmjs.com/

^ means “compatible with”. So for example, if you were to run an npm update or npm install, with a package specified to a version "^4.3.1" in your package.json, the latest 4.x.x version would be installed, and not a 5.x.x version since that newer version would be potentially incompatible. There are a few special cases:

^1.2.3 is >=1.2.3 <2.0.0

^0.2.3 is >=0.2.3 <0.3.0 (0.x.x is special)

^0.0.1 is =0.0.1 (0.0.x is special)

^1.2 is >=1.2.0 <2.0.0 (like ^1.2.0)

^1 is >=1.0.0 <2.0.0

When in doubt with a package, I use a semver calculator like https://semver.npmjs.com/

软件版本编号之前的 ^是什么意思?

装纯掩盖桑 2025-02-18 01:58:12

ppspy做以下内容。

  • 它读取您的Shopify站点地图以在商店中找到产品。
    .../stitemap_products_1.xml

  • 作为后备,它解析了网址:
    .../collections/all?sort_by =最畅销 - 和尝试
    在那里找到产品。

  • 接下来,它使用Shopify的JSON URL。再次试图找到
    所有产品。一个示例URL:
    .../products.json?page = 1&amp; limit = 250-大多数商店所有者甚至都不知道存在。

  • 之后,它调用了每种产品的JSON URL。你可以得到这个
    只需打开产品页面并写作,在您的在线商店中的URL
    “ .json”在URL中。示例URL:
    .../products/your-productName.json。

在此JSON中,有一个“ Updated_at”字段。每次进行更改时,都会更新此字段。另外,发生订单时(股票更改)。

因此,可以(大约)跟踪销售。

PPSPY does the following.

  • It reads your Shopify sitemap to find the products in the store.
    .../sitemap_products_1.xml

  • As fallback, it parses the URL:
    .../collections/all?sort_by=best-selling - and tries
    to find the products there.

  • Next, it uses the JSON URL from Shopify. There again it tries to find
    all products. An example URL:
    .../products.json?page=1&limit=250 - most store owners don't even know this exists.

  • After that, it calls the JSON URL for each product. You can get this
    URL in your online store by simply opening a product page and writing
    ".json" after it in the URL. Example URL:
    .../products/your-productname.json.

In this JSON there is a field "updated_at". This field is updated every time a change is made. Also, when an order take place (the stock is changed).

And with this, it is possible to track the sales (approximately).

Ali Hunter和Ppspy等间谍工具如何从Shopify商店获取数据

装纯掩盖桑 2025-02-17 14:32:54

我认为您正在寻找动态加载的内容。

您可以在“开发人员工具”中选中“网络”选项卡。
您正在寻找'XHR类型的请求。

在Firefox中,您可以通过单击此处来过滤XHR请求:

检查所有'XHR'请求的请求和响应,您可能会找到返回的信息,作为JSON或HTML文档。

请让我们知道情况如何!

我建议您查看此视频,以获取动态加载的内容: https://www.youtube .com/watch?v = pu3gmdwslyc

该视频适用于一个名为Scrapy的Python库。
我建议您检查一下,如果您要处理网络剪接 - 这是必须的!

这说明您的视频涵盖了基础知识,而无需了解Python或scrapy。

I think you are looking at a Dynamically loaded content.

You can check in the Network tab in the Developer Tools.
You are looking for a request of type `xhr.

In Firefox you can filter the XHR requests by clicking here:
enter image description here

Check the requests and responses for all the 'XHR' requests, you will probably find your information returned there as a JSON or an HTML document.

Please let us know how it goes!

I suggest you check out this video for web-scraping dynamically loaded content: https://www.youtube.com/watch?v=Pu3gmdWsLYc

The video is for a Python library called Scrapy.
I suggest you check it out if you are to deal with web-scraping - it is a must!

That said you the video covers the basics without the need to know Python or Scrapy.

该HTML中隐藏的详细信息页面的链接在哪里?

装纯掩盖桑 2025-02-17 02:03:46

这些没有解决同一件事。在一种情况下,您要这样做:

    solve_results1[i,:] .= 0.0
    solve_results1[i,i] = 1.0
    sol_Ds_v7 = core_op_plain(solve_results1[i,:], tspan, p_Ds_v7)

在另一个情况下,您要做

    solve_results2[i,i] = 1.0 
    # USING "PLAIN", NON-SIMD OPERATION HERE
    push!(tasks, Base.Threads.@spawn core_op_plain(solve_results2[i,:].+0.0, tspan, p_Ds_v7));

solve_results2在此处运行之前没有将其归零,这与添加零不同。这就是为什么第一个求解是正确的原因,因为您在设置中进行solve_results2。= 0.0;,因此将其归零。但是,在第一次运行后,它将突变,当您重新解决初始条件时,是最后一次的解决方案。

那和p的深副本使其显然是安全的。我还没有仔细观察此问题,但是如果您在多个线程上使用相同的p对象,并且它们会突变相同的p,那么您最终将遇到一项运行效果另一个参数。 deepcopy将以简单的方式修复此操作,而难以制作预读取缓存的方法,这样您就不会碰撞覆盖物。

These aren't solving the same thing. In one case you do:

    solve_results1[i,:] .= 0.0
    solve_results1[i,i] = 1.0
    sol_Ds_v7 = core_op_plain(solve_results1[i,:], tspan, p_Ds_v7)

in the other you do

    solve_results2[i,i] = 1.0 
    # USING "PLAIN", NON-SIMD OPERATION HERE
    push!(tasks, Base.Threads.@spawn core_op_plain(solve_results2[i,:].+0.0, tspan, p_Ds_v7));

solve_results2 is not zeroed before the run here, which is not the same as adding zero. This is why the first solve is correct, since you do solve_results2 .= 0.0; in the setup, so it's zeroed. But then after the first run it will have mutated and when you re-solve the initial condition is the solution of the last time.

That and a deepcopy of p makes it clearly thread safe. I haven't looked at this closely but if you use the same p object on multiple threads and they mutate the same p, then you will end up with one run effecting the parameters of the other. deepcopy will fix this the easy way, and the harder way is to make pre-thread caches so you don't collide the overwrites.

在朱莉娅(Julia)中并行求解ODE:可变答案,在执行几次后悬挂

装纯掩盖桑 2025-02-16 22:17:29

我建议使用gsub并参考此 post

名称(eat10.18)&lt; - gsub(x = names(eat10.18),模式=“ _10p”,replacement =“ _p_10”)

结果run_p_10
1000211
1001421
1002132

I suggest using gsub and referring to this post.

names(eat10.18) <- gsub(x = names(eat10.18), pattern = "_10p", replacement = "_p_10")

Result

ideat_10eat_p_10run_p_10
1000211
1001421
1002132

如何通过在R中替换后缀来重命名列?

装纯掩盖桑 2025-02-16 21:37:20

您可以使用Caret逃避单个角色,例如

if ^"^%prefix%^" == "-" ...

诀窍是逃避报价,否则内在的商人没有特殊的含义。

这不能适用于一个以上的字符,但是您可以切换到简单的延迟扩展。它的扩展总是安全的。

setlocal EnableDelayedExpansion
set "value="This is a test""
set "arg=!value!"
set "prefix=!arg:~1,1!"
if "!prefix!" == "-" ...

You can use the caret to escape a single character, like

if ^"^%prefix%^" == "-" ...

The trick is to escape the quotes, too, else the inner caret has no special meaning.

This can't work for more than one character, but you could switch to the even simple delayed expansion. It's expansion is always safe.

setlocal EnableDelayedExpansion
set "value="This is a test""
set "arg=!value!"
set "prefix=!arg:~1,1!"
if "!prefix!" == "-" ...

当左手侧为双引号时,如何在批处理脚本中比较字符

装纯掩盖桑 2025-02-16 20:17:33

使用Anchor.getElement()。setAttribute(“路由器-Ignore”,true);如果您需要服务来处理给定的URL而不是客户端端路由器。

Use anchor.getElement().setAttribute("router-ignore", true); if you need your service to handle the given URL instead of the client-side router.

vaadin:锚点在浏览器中设置内部URL,但不导航

装纯掩盖桑 2025-02-16 15:03:29

我建议您将您的分支重新打入主分支,而不是进行合并。重新审议它使您基本上可以将分支移至历史记录中的任何点,并为您提供打开选项,以便您将来再次移动它(例如,如果其他人继续对主要分支进行更改)。将您的分支机构与特定时间表联系起来:它可以使您的所有代码更改,但将来会消除您的选项。

在尝试任何一个之前,请先备份分支。

有两种方法:

  • 简单的方法

    查看您的分支,然后运行git rebase main。如果您的情况不复杂,这将自动起作用。

  • 精确的方式

    如果简单的方法给您不良的结果,则可能需要明确地告诉Git您的分支从哪里开始,以及将其移动到何处:

    git rebase -tono new_base old_base your_branch_name

    其中:

    • new_base是您希望将分支放在顶部的另一个分支的名称;那可能是Main
    • old_base是分支机构当前历史记录中最新提交的提交 - 不属于分支机构的一部分;从本质上,这是您最初切割分支的地方
    • your_branch_name是您的分支的名称,即正在移动的分支

I'd recommend rebasing your branch onto the main branch instead of doing a merge. Rebasing it allows you to basically move your branch to any point in the history, and keeps the option open for you to move it again in the future (if, for example, other people keep making changes to the main branch). Merging essentially ties your branch to a specific timeline: it gets you all the code changes, but it eliminates your options in the future.

Make a backup of your branch before trying any of this.

There are two ways to do this:

  • the easy way

    Check out your branch, and then run git rebase main. If your situation is not complicated, this will work automatically.

  • the precise way

    If the easy way gives you bad results, you may need to explicitly tell git where your branch begins, and where to move it to:

    git rebase --onto NEW_BASE OLD_BASE YOUR_BRANCH_NAME

    Where:

    • NEW_BASE is the name of the other branch that you wish to put your branch on top of; that would probably be main
    • OLD_BASE is the commit-hash of the latest commit in your branch's current history that is not part of your branch; this is essentially the place where you were when you originally cut your branch
    • YOUR_BRANCH_NAME is the name of your branch, the branch that is being moved

如何在Github的主要分支机构中复制所有内容?

装纯掩盖桑 2025-02-16 10:38:35

Magento的路由可能是案例敏感的,具体取决于服务器配置,

您的模块名称是 emps_mamIntegration ,但您的名称空间是 emps \ mamIntegration
我敢打赌,这是它在某些环境中而不是其他环境中工作的原因。

尝试将模块重命名为 EMPS_MamIntegration 或向我们展示您的register.php文件。还要确保在生产中启用模块。

Magento's routing might be case sensitive depending on server configuration

Your module name is EMPS_MAMIntegration but your namespace is Emps\MAMIntegration.
I would bet on this being the reason for it working on some environment and not the other.

Try renaming your module to Emps_MAMIntegration or show us your register.php file. Also make sure module is enabled on production.

Magento模块AJAX请求返回404错误

装纯掩盖桑 2025-02-16 09:44:51

您可以按照以下方式进行操作:

const response = await HttpClient.get<IIndustryGroupList[] | IAPIErrorResponse>(url, options);

You can do it in following way:

const response = await HttpClient.get<IIndustryGroupList[] | IAPIErrorResponse>(url, options);

如何定义Axios错误响应的类型

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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