小编Sea*_*lly的帖子

有没有办法将 Google 字体加载到 Devtools 中

我知道我可以在打开 Devtools 的情况下将我想使用的字体导入 CSS 文件。对于 Google 来说,将其庞大的字体库链接到 Devtools 似乎是轻而易举的事。有没有办法做到这一点?

google-chrome-devtools

5
推荐指数
2
解决办法
1300
查看次数

如何设置Web Workers的内容安全策略以在Edge / Safari中工作?

我一直在找回错误代码:18,尝试使用Web Worker时来自Edge和Safari的SecurityError。但是,在Firefox / Chrome中,工作人员很好。我正在使用传递零依赖数据处理函数的内联工作器。

我的CSP看起来:

add_header Content-Security-Policy "default-src 'self'; worker-src 'self' 'inline' *.example.com";
Run Code Online (Sandbox Code Playgroud)

我可以自己添加其他不错的东西,例如本地样式表和googleapis.com,但我很好奇如何使Worker不会引发安全错误

工作者方法的摘录

// Create an "inline" worker (1:1 at definition time)
    const worker = new Worker(
        // Use a data URI for the worker's src. It inlines the target function and an RPC handler:
        'data:,$$='+asyncFunction+';onmessage='+(e => {
            /* global $$ */

            // Invoking within then() captures exceptions in the supplied async function as rejections
            Promise.resolve(e.data[1]).then(
                v => $$.apply($$, v)
            ).then(
                // success handler - callback(id, SUCCESS(0), …
Run Code Online (Sandbox Code Playgroud)

javascript web-worker content-security-policy nginx-config

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

如何从存储过程中获取唯一标识符?

我觉得我是如此亲密,我似乎无法弄清楚如何使用存储过程从SQL Server获取GUID。它没有返回值,或者没有以正确的方式调用输出。

看了两天的文档后,我想到的是:

DROP PROCEDURE IF EXISTS create_product
GO

CREATE PROCEDURE create_product 
    (@Name VARCHAR(255),
     @Price DOUBLE PRECISION,
     @Image VARCHAR(255),
     @Free_Shipping BIT,
     @Description VARCHAR(MAX),
     @Shipping_Id UNIQUEIDENTIFIER,
     @PRODUCT_ID UNIQUEIDENTIFIER OUTPUT)
AS
    SELECT @PRODUCT_ID = NEWID();

    DECLARE @PRODUCT_DETAIL_ID UNIQUEIDENTIFIER;
    SET @PRODUCT_DETAIL_ID = NEWID();

    INSERT INTO Product (product_id, product_name, product_price, product_image,
                         product_free_shipping, product_detail_id) 
    VALUES (@PRODUCT_ID, @Name, @Price, @Image,
            @Free_Shipping, NULL);

    INSERT INTO ProductDetail (detail_id, detail_description, detail_product_id,
                               detail_product_meta_id, detail_shipping_id)
    VALUES (@PRODUCT_DETAIL_ID, @Description, @PRODUCT_ID,
            NULL, @Shipping_Id);

    UPDATE Product
    SET product_detail_id = @PRODUCT_DETAIL_ID
    WHERE product_id = @PRODUCT_ID; …
Run Code Online (Sandbox Code Playgroud)

sql-server stored-procedures

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