落花随流水

文章 评论 浏览 30

落花随流水 2025-02-17 10:37:05

这很难说,因为您不是说是什么原因导致SWR重新验证,而是我知道的主要解决方案:

It's hard to say because you're not saying what causes SWR to revalidate but here are the main solutions I know of :

突变使用WRR数据(本地状态)而不重新验证?

落花随流水 2025-02-16 16:03:49

该错误意味着工人未在根处注册。请注意,服务工作者默认为目录的范围 的位置,该目录有效地成为其/。这并不意味着它是您应用程序的根源。

考虑以下内容:

public/
  foo/
    mockServiceWorker.js

工人的/范围将为/foo(给定您的网站是从/public提供的)。在您的情况下,这可能是问题。

要解决此问题:

  1. 确保您已在应用程序的根级别生成了工作文件。通常,这是/public文件夹。
  2. 检查您看到此警告的页面的URL位置。这是仅浏览器的警告,因此您可以检查运行时 - 它包含最有用的信息来调试此功能。也许testcafe将您的整个应用程序嵌套在某个路径下,这就是破坏工人功能的原因。如果是这样,请读取testcafe文档以在根路由下为您的应用提供服务,或分别配置serviceworker.scope作为测试设置的一部分,到Testcafe的位置的工作脚本)。

如果没有任何帮助,请为我们提供您尝试过的事物列表以及您收到的结果。

The error implies that the worker is not registered at the root. Note that a service worker defaults to the scope of the directory from where it's being served, and that directory effectively becomes its /. It doesn't mean it's the root of your application.

Consider this:

public/
  foo/
    mockServiceWorker.js

The / scope for the worker will be /foo (given your site is served from /public). This may be the issue in your case.

To resolve this:

  1. Make sure that you've generated the worker file in the root level of your application. Usually, it's the /public folder.
  2. Check the URL location of the page where you see this warning. This is a browser-only warning so you can inspect your runtime—it contains the most useful information to debug this. Perhaps Testcafe nests your entire app under some path, and that's what breaks the worker functionality. If that's the case, either read Testcafe docs to serve your app at the root route, or configure the serviceWorker.scope respectively, so the worker knows at which path it's being served (this may also require proxying the worker script to the Testcafe's location as a part of the testing setup).

If nothing helps, provide us with the list of things you've tried and what was the result you received.

MSW在使用testcafe时无法拦截请求,因为该页面不在工人范围之外

落花随流水 2025-02-16 13:57:07
table(factor(manager, employee))

a b c d e f g h 
3 2 1 0 1 0 1 0 
table(factor(manager, employee))

a b c d e f g h 
3 2 1 0 1 0 1 0 

在R中查找经理的直接报告计数

落花随流水 2025-02-16 12:24:02

https://www.npmjs.com/package/package/package/canvas-constructor

是ES6软件包,当您使用常见的JS(nodejs默认)时,您可以使用其他软件包或修改Nodejs项目以使用ES6标准。

要修改您的项目设置,您可能想遵循此答案。

https://stackoverflow.com/a/a/29415291/13776400

https://www.npmjs.com/package/canvas-constructor

is an ES6 package, while you are using common js (nodejs default) you can either use a different package or modify your nodejs project to use ES6 standards.

To modify your project settings you may wanna follow this answer.

https://stackoverflow.com/a/29415291/13776400

“没有出口主要的出口主要定义”错误node.js

落花随流水 2025-02-16 12:18:26

我可以在没有Google Workspace的情况下发送电子邮件吗?

是的,您可以使用Gmail API而无需工作空间,您只需要使用OAuth2而不是服务帐户并授权用户即可。

OAuth2要求用户同意访问其Google帐户。用户将需要至少授权您的代码一次。

在服务帐户中,您可以在Google Workspace帐户中使用域名范围的代表团定义访问权限。因此,不需要用户互动。

我可以将'type'添加到客户端ID.json中以使其像服务帐户一样工作?

根据您创建的客户端的类型,代码没有不同。如果创建Web客户端,则需要使用为Web客户端设计的代码。如果创建已安装的客户端凭据,则需要为已安装的客户端使用代码。

以下示例 java QuickStart 是为安装应用程序而设计的。它将打开代码正在运行的机器上的浏览器同意窗口。

Can I send email without Google Workspace?

Yes you can use gmail api without workspace you will just need to use Oauth2 rather than a service account and authorize a user.

Oauth2 requires that a user consent to the access to their google account. A user will need to authorize your code at least once.

Where as service accounts allow you to preauthroize access defined using domain wide delegation within a google workspace account. So no user interaction would be required.

Can I just Add 'type' into Client ID.json to make it work like Service accounts.json?

No the code is different depending upon the type of client you have created. If you create a web client then you need to use code designed for a web client. If you create installed client credentials then you need to use the code for an installed client.

The following sample Java quickstart is designed for an installed app. It will open the browser consent window on the machine the code is running on.

我可以在没有Google Workspace(或服务帐户)的情况下使用Gmail API发送电子邮件吗?

落花随流水 2025-02-16 05:13:36
collection.count({ 
    "$expr": {
        "$gt": [
            { "$add": [ "$totalCoins", {"$divide":["$level",10000] ] },
            100.0004
        ]
    }
})

这个想法是计算硬币/级别更高的记录数量的数量。我在这里提出的想法是将水平除以最大级别 + 1(此处是最大9999),因此您始终以低于1个小数低。将硬币添加到其中时,您将获得100.0004,Coins.Level。然后,只是要相应地比较两个数字。

collection.count({ 
    "$expr": {
        "$gt": [
            { "$add": [ "$totalCoins", {"$divide":["$level",10000] ] },
            100.0004
        ]
    }
})

The idea is to count the number of records with higher coins/level than the user. The idea I put here is to divide the level by maximum level + 1 (here the level is max 9999) so you will always end up with lower than 1 decimal. When you add the coins to that you will get 100.0004, coins.level . Then it is just to compare two numbers accordingly.

根据猫鼬的收藏集中的两个字段查找播放器的等级

落花随流水 2025-02-16 01:50:43

我相信这是因为您没有将其链接到使用OG:Image的直接文件下载链接。

I believe this is happening because you are not linking it to a direct file download link with og:image.

为什么Facebook调试器加薪:爬虫接受Deflate和GZIP内容编码

落花随流水 2025-02-15 20:02:39

对于记事本++用户,可以通过: edit > eol conversion > unix(lf)

”屏幕截图上述步骤“

For Notepad++ users, this can be solved by: Edit > EOL Conversion > Unix (LF)

screenshot showing above steps

外壳脚本对编码和线路结尾敏感吗?

落花随流水 2025-02-15 19:22:33

该设计尚未提及:

多个谱系列

尽管有限制,如果您可以忍受,它非常简单,非常非常简单,非常非常非常高效的。功能:

  • 列:每个谱系级别一个,指的是所有父母,直到根部,低于当前项目的级别的级别设置为0(或null),
  • 对层次结构的深度如何为
  • 便宜的祖先有固定的限制,后代,水平
  • 廉价插入,删除,叶子的移动
  • 昂贵的插入物,删除,内部节点的移动

在这里遵循一个例子 - 鸟类的分类树,因此层次结构是类/订单/订单/家庭/族/属/物种 - 物种是最低水平 单元(在叶子节点的情况下对应于物种)

CREATE TABLE `taxons` (
  `TaxonId` smallint(6) NOT NULL default '0',
  `ClassId` smallint(6) default NULL,
  `OrderId` smallint(6) default NULL,
  `FamilyId` smallint(6) default NULL,
  `GenusId` smallint(6) default NULL,
  `Name` varchar(150) NOT NULL default ''
);

,1行= 1分类

+---------+---------+---------+----------+---------+-------------------------------+
| TaxonId | ClassId | OrderId | FamilyId | GenusId | Name                          |
+---------+---------+---------+----------+---------+-------------------------------+
|     254 |       0 |       0 |        0 |       0 | Aves                          |
|     255 |     254 |       0 |        0 |       0 | Gaviiformes                   |
|     256 |     254 |     255 |        0 |       0 | Gaviidae                      |
|     257 |     254 |     255 |      256 |       0 | Gavia                         |
|     258 |     254 |     255 |      256 |     257 | Gavia stellata                |
|     259 |     254 |     255 |      256 |     257 | Gavia arctica                 |
|     260 |     254 |     255 |      256 |     257 | Gavia immer                   |
|     261 |     254 |     255 |      256 |     257 | Gavia adamsii                 |
|     262 |     254 |       0 |        0 |       0 | Podicipediformes              |
|     263 |     254 |     262 |        0 |       0 | Podicipedidae                 |
|     264 |     254 |     262 |      263 |       0 | Tachybaptus                   |

。类别不会改变树上的水平。

This design was not mentioned yet:

Multiple lineage columns

Though it has limitations, if you can bear them, it's very simple and very efficient. Features:

  • Columns: one for each lineage level, refers to all the parents up to the root, levels below the current items' level are set to 0 (or NULL)
  • There is a fixed limit to how deep the hierarchy can be
  • Cheap ancestors, descendants, level
  • Cheap insert, delete, move of the leaves
  • Expensive insert, delete, move of the internal nodes

Here follows an example - taxonomic tree of birds so the hierarchy is Class/Order/Family/Genus/Species - species is the lowest level, 1 row = 1 taxon (which corresponds to species in the case of the leaf nodes):

CREATE TABLE `taxons` (
  `TaxonId` smallint(6) NOT NULL default '0',
  `ClassId` smallint(6) default NULL,
  `OrderId` smallint(6) default NULL,
  `FamilyId` smallint(6) default NULL,
  `GenusId` smallint(6) default NULL,
  `Name` varchar(150) NOT NULL default ''
);

and the example of the data:

+---------+---------+---------+----------+---------+-------------------------------+
| TaxonId | ClassId | OrderId | FamilyId | GenusId | Name                          |
+---------+---------+---------+----------+---------+-------------------------------+
|     254 |       0 |       0 |        0 |       0 | Aves                          |
|     255 |     254 |       0 |        0 |       0 | Gaviiformes                   |
|     256 |     254 |     255 |        0 |       0 | Gaviidae                      |
|     257 |     254 |     255 |      256 |       0 | Gavia                         |
|     258 |     254 |     255 |      256 |     257 | Gavia stellata                |
|     259 |     254 |     255 |      256 |     257 | Gavia arctica                 |
|     260 |     254 |     255 |      256 |     257 | Gavia immer                   |
|     261 |     254 |     255 |      256 |     257 | Gavia adamsii                 |
|     262 |     254 |       0 |        0 |       0 | Podicipediformes              |
|     263 |     254 |     262 |        0 |       0 | Podicipedidae                 |
|     264 |     254 |     262 |      263 |       0 | Tachybaptus                   |

This is great because this way you accomplish all the needed operations in a very easy way, as long as the internal categories don't change their level in the tree.

在关系数据库中存储层次数据的选项是什么?

落花随流水 2025-02-15 17:45:32

有问题的是,没有提到哪个OS用户正在使用(Windows/linux/Mac),

因为有几个答案可以在Mac和Linux上完美无瑕。

如果用户正在尝试在Windows上找到Python软件包的版本,则可以使用下面的命令。

在powershell中使用以下命令:

pip列表| findstr< packagename>

示例: - pip list | findstr请求

输出:请求2.18.4

In question, it is not mentioned which OS user is using (Windows/Linux/Mac)

As there are couple of answers which will work flawlessly on Mac and Linux.

Below command can be used in case the user is trying to find the version of a python package on windows.

In PowerShell use below command :

pip list | findstr <PackageName>

Example:- pip list | findstr requests

Output : requests 2.18.4

查找使用PIP安装哪个版本的软件包

落花随流水 2025-02-15 15:50:03

获取/获取您不与您共享任何公会的用户可以使用 client.users.users.users.fetch() 带有参数force设置为true在代码中类似以下:

let user = await client.users.fetch("ID", { force: true, cache: true })

To fetch/get a user that you don't share any guild with you can use Client.users.fetch() with parameter force set to true like in a code below:

let user = await client.users.fetch("ID", { force: true, cache: true })

如何让用户不与之共享公会? Discordjs

落花随流水 2025-02-15 12:45:09

尝试这个

mDatabase.orderByChild("cars").startAt(filter).addValueEventListner(new ValueEventListener() {
    @Override
    public void onDataChange(@NonNull DataSnapshot snapshot) {
        //TODO
    }

    @Override
    public void onCancelled(@NonNull DatabaseError error) {
        //TODO
    }
});

Try This One

mDatabase.orderByChild("cars").startAt(filter).addValueEventListner(new ValueEventListener() {
    @Override
    public void onDataChange(@NonNull DataSnapshot snapshot) {
        //TODO
    }

    @Override
    public void onCancelled(@NonNull DatabaseError error) {
        //TODO
    }
});

firebase数据库:如何在不指定密钥的情况下搜索任何地方

落花随流水 2025-02-15 07:18:51

您正在使用RSA身份验证吗?如果是这样,您很可能会作为用户usera进行身份验证。 Userb需要将USERA作为合作者添加到其GIT项目中。 https://docs.github.com/en/account-and-profile/setting-p-------------------------er-profile/setting-up--------------------------- github的个人元素/管理 - 访问自己的人重新定位/邀请 - 授权者到一个人的重新定位

Are you using RSA authentication? If so, you are most likely authenticating as your user, userA. userB needs to add userA as a collaborator to their git project. https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/inviting-collaborators-to-a-personal-repository

如何在不同的本地github项目中使用不同的用户名和密码

落花随流水 2025-02-14 14:00:19

这个Uikit Overrid在iOS 16中对我有用(尽管Back Button Text可能未对准):

@main
struct TestApp: SwiftUI.App {
    
    init() {
        // Back button
        let navBarAppearance = UINavigationBar.appearance()
        if let image = UIImage(named: "arrow.back") {
            navBarAppearance.backIndicatorImage = image
            navBarAppearance.backIndicatorTransitionMaskImage = image
        }
    }
...
}

本机刷新模式也可以与App File中的此覆盖作用(在另一台Stackoverflow文章中找到):

/// Prevents custom back button dismiss actions from preventing native swiping interactions (i.e. swipe to go back)
    extension UINavigationController: UIGestureRecognizerDelegate {
        override open func viewDidLoad() {
            super.viewDidLoad()
            interactivePopGestureRecognizer?.delegate = self
        }
    
        public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
            return viewControllers.count > 1
        }
    
        // To make it works also with ScrollView
        public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
            true
        }
    }

This UIKit override is working for me in iOS 16 (Although back button text might be misaligned):

@main
struct TestApp: SwiftUI.App {
    
    init() {
        // Back button
        let navBarAppearance = UINavigationBar.appearance()
        if let image = UIImage(named: "arrow.back") {
            navBarAppearance.backIndicatorImage = image
            navBarAppearance.backIndicatorTransitionMaskImage = image
        }
    }
...
}

And the native swiping pattern also works with this override in App file (found on another StackOverflow article):

/// Prevents custom back button dismiss actions from preventing native swiping interactions (i.e. swipe to go back)
    extension UINavigationController: UIGestureRecognizerDelegate {
        override open func viewDidLoad() {
            super.viewDidLoad()
            interactivePopGestureRecognizer?.delegate = self
        }
    
        public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
            return viewControllers.count > 1
        }
    
        // To make it works also with ScrollView
        public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
            true
        }
    }

有没有办法可以覆盖导航视图工具栏中的默认返回按钮,而无需在每个次要视图中添加修饰符?

落花随流水 2025-02-14 01:52:08

实际上,我只是注意到,壳语法在某种程度上具有内置的行为,可以轻松重建数组,如问题所示,应删除项目。

# let's set up an array of items to consume:
x=()
for (( i=0; i<10; i++ )); do
    x+=("$i")
done

# here, we consume that array:
while (( ${#x[@]} )); do
    i=$(( $RANDOM % ${#x[@]} ))
    echo "${x[i]} / ${x[@]}"
    x=("${x[@]:0:i}" "${x[@]:i+1}")
done

请注意,我们如何使用Bash的X+=()语法构造数组?

实际上,您可以同时添加多个项目,即其他整个数组的内容。

Actually, I just noticed that the shell syntax somewhat has a behavior built-in that allows for easy reconstruction of the array when, as posed in the question, an item should be removed.

# let's set up an array of items to consume:
x=()
for (( i=0; i<10; i++ )); do
    x+=("$i")
done

# here, we consume that array:
while (( ${#x[@]} )); do
    i=$(( $RANDOM % ${#x[@]} ))
    echo "${x[i]} / ${x[@]}"
    x=("${x[@]:0:i}" "${x[@]:i+1}")
done

Notice how we constructed the array using bash's x+=() syntax?

You could actually add more than one item with that, the content of a whole other array at once.

从bash阵列中删除元素

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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