小编Pet*_*jda的帖子

如何检测用户是否在Firefox 42+中使用跟踪保护

Firefox 在v42.0中推出了一项名为跟踪保护的功能.它会阻止多个跟踪脚本,例如Google Analytics,Marketo,LinkedIn等.

控制台输出

我试图通过navigator.DoNotTrack它来检测它,但它unspecified在两种情况下都会返回- 在普通模式下浏览,在私人模式下浏览 - 在Mac上使用Firefox 42.0.

如何在JavaScript中检测用户是否正在查看启用了跟踪保护的网站,因为navigator.DoNotTrack失败了?

javascript firefox privacy navigator do-not-track

12
推荐指数
3
解决办法
4380
查看次数

错误:SimpleSmartContract 尚未部署到检测到的网络(网络/工件不匹配)

我开发了一个简单的智能合约。当我运行松露测试时,它显示以下错误:我是新手,所以我无法弄清楚。

\n

PS F:\\pracdap> 松露测试

\n
Compiling your contracts...\n===========================\n\xe2\x88\x9a Fetching solc version list from solc-bin. Attempt #1\n> Compiling .\\contracts\\Migrations.sol\n> Compiling .\\contracts\\SimpleSmartContract.sol       \n\xe2\x88\x9a Fetching solc version list from solc-bin. Attempt #1\n> Compilation warnings encountered:\n\n    Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "urce file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more informa\n--> /F/pracdap/contracts/SimpleSmartContract.sol\n\n\n> Artifacts written to C:\\Users\\HP\\AppData\\Local\\Temp\\test--1224-GWVOn3NGyps8\n> Compiled successfully using:\n   - solc: 0.8.3+commit.8d00100c.Emscripten.clang\n\n\n\n  Contract: SimpleSmartContract\n    1) should be deployed\n …
Run Code Online (Sandbox Code Playgroud)

solidity truffle network-error-logging

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

Solidity 中这个警告的含义是什么?

当我编写代码时,我在代码的第 10 行收到警告。谁能告诉我这个警告是什么意思?

我的代码

// SPDX-License-Identifier: UNLICENSED

pragma solidity >=0.5.0 < 0.9.0;

contract PracticeTest // It's a class
{
    string name ;
    uint256 age;

    constructor() public
    {
        name = "Ali";
        age = 21 ;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是警告

Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
  --> contracts/PracticeTest.sol:10:5:
   |
10 |     constructor() public
   |     ^ (Relevant source part starts here and spans across multiple lines).
Run Code Online (Sandbox Code Playgroud)

blockchain solidity remix

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

使用连字符引用对象的属性名称

我定义了一个对象,其属性名称中带有连字符。

var data = {
  "foo-bar": "value",
  "this-that": "another value"
}
Run Code Online (Sandbox Code Playgroud)

现在我需要在JS中引用这个属性,但这两种方式都会导致语法错误。

console.log( data.foo-bar )
Run Code Online (Sandbox Code Playgroud)

console.log( data."foo-bar" )
Run Code Online (Sandbox Code Playgroud)

所以我的问题是。如何在 JS 中访问名称中包含连字符的属性?


免责声明:服务器端功能需要对属性进行连字符命名,我真的不想重写别人的整个脚本来接受这样的输入参数。是的,我知道目前的方法并不是最干净的方法。

javascript

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

Docker-compose 多个服务监听同一端口、不同域

如何让多个 docker 服务监听相同的端口,仅使用不同的域?

是否可以定义,docker-compose或者我是否需要只在端口上侦听一项服务,然后根据域将流量重新路由到相应的服务?


此示例失败,因为它正在侦听整个网络(而不仅仅是域)

docker-compose up
Creating network "test-docker_default" with the default driver
Creating test-docker_static_1 ... done
Creating test-docker_app_1    ... 
Creating test-docker_app_1    ... error

ERROR: for test-docker_app_1  Cannot start service app: driver failed programming external connectivity on endpoint test-docker_app_1 (ef433ffad1af01ffa31cd8a69a8c15b69ca7e7b6935924d34891b92682570e68): Bind for 0.0.0.0:80 failed: port is already allocated

ERROR: for app  Cannot start service app: driver failed programming external connectivity on endpoint test-docker_app_1 (ef433ffad1af01ffa31cd8a69a8c15b69ca7e7b6935924d34891b92682570e68): Bind for 0.0.0.0:80 failed: port is already allocated
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml

version: '3.3'
services:

  app: …
Run Code Online (Sandbox Code Playgroud)

network-programming docker docker-compose

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

Solidity ParserError:预期为“;” 但得到了“{”

使用版本0.6.0

pragma solidity ^0.6.0;

contract Test {
    function sendValue(address payable recipient, uint256 amount) external {
        (bool success, ) = recipient.call{ value: amount }("");
    }
}
Run Code Online (Sandbox Code Playgroud)

Test.sol:5:42:ParserError:预期为“;” 但得到 '{' (bool success, ) =recipient.call{ value: amount }(""); ^

为什么会出现这个错误?

solidity

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

在测试网上使用 Remix 部署合约时出现的问题

我尝试使用 Remix 将合约部署到测试网(所有测试网都返回相同的消息),但出现此错误:

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { "code": -32000, "message": "gas required exceeds allowance (30000000) or always failing transaction" }
Run Code Online (Sandbox Code Playgroud)

但是当我尝试在 BSC Mainnet 中部署它时,一切正常,没有错误。有什么建议?

这是相关的代码

contract artemis is Context, IERC20, Ownable {
    // ...

    constructor() public {
        _rOwned[_msgSender()] = _rTotal;

        IUniswapV2Router02 _uniswapV2Router =
            IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);
        // Create a Pancakeswap pair for this new token
        uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
            .createPair(address(this), _uniswapV2Router.WETH());

        // …
Run Code Online (Sandbox Code Playgroud)

solidity smartcontracts remix

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

“未提供 SPDX 许可证标识符”警告 - 这是什么意思?

警告:源文件中未提供 SPDX 许可证标识符。在发布之前,请考虑向每个源文件添加包含“SPDX-License-Identifier:”的注释。对于非开源代码,请使用“SPDX-License-Identifier:UNLICENSED”。请参阅https://spdx.org了解更多信息。

solidity

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