小编dev*_*per的帖子

Java for循环声明外部初始化

根据我们所知道的形成Oracle for循环的文档:

for (initialization; termination; increment) {
    statement(s)
}
Run Code Online (Sandbox Code Playgroud)

例如,

class ForDemo {
    public static void main(String[] args){
         for(int i=1; i<11; i++){
              System.out.println("Count is: " + i);
         }
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么我们不能像这样在for循环之外声明初始化部分?

 class ForDemo {
    public static void main(String[] args){
         int i = 1;
         for(i; i<11; i++){
              System.out.println("Count is: " + i);
         }
    }
}
Run Code Online (Sandbox Code Playgroud)

java for-loop

9
推荐指数
3
解决办法
808
查看次数

指定的项目目录"'"不存在

自从我将Android Studio 3.0.1升级到3.1后,我就无法运行我的项目了.

    Executing task 'assemble'..    
        FAILURE: Build failed with an exception.
        * What went wrong:
        The specified project directory '' does not exist.
* Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    BUILD FAILED in 0s
    The specified project directory '' does not exist.
    15:52:35: Task execution finished 'assemble'.
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio

6
推荐指数
4
解决办法
2736
查看次数

Angular7 生命周期挂钩和路由

我只是好奇当我们在当前页面中使用 router.navigate 时会调用哪些生命周期钩子,比如说重新加载页面。

constructor(private router: Router) { }
reload () {
    this.router.navigate(['/currentpage']);
} 
Run Code Online (Sandbox Code Playgroud)

angular angular7

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

heapusage检测到可能由printf引起的内存泄漏

我正在用C中的链表实现优先级队列,但是当我打印pop操作时却遇到内存泄漏。我还有另一个内存泄漏,我也试图找到它。

另外,我使用heapusageby d99kris代替Valgrind

这是我使用时的堆摘要printf

HEAP SUMMARY:
in use at exit: 4112 bytes in 2 blocks
total heap usage: 10 allocs, 17 frees, 4536 bytes allocated
peak heap usage: 4256 bytes allocated
16 bytes in 1 block(s) are lost, originally allocated at:
LEAK SUMMARY:
definitely lost: 4112 bytes in 2 blocks
Run Code Online (Sandbox Code Playgroud)

这是没有printf以下内容的堆摘要:

HEAP SUMMARY:
in use at exit: 16 bytes in 1 blocks
total heap usage: 9 allocs, 10 frees, …
Run Code Online (Sandbox Code Playgroud)

c valgrind memory-leaks memory-management

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

Golang + Linux + Docker 错误:standard_init_linux.go:211:没有这样的文件或目录

这不是重复的,因为虽然错误相同,但我的用例与其他用例不同。

我正在编译一个 go 应用程序以使用 docker 进行部署:

  • 最新的 Arch Linux
  • 最新的 docker 版本,golang:alpine 镜像
  • 尝试使用 go version 1.13.3 和 1.14.4 linux amd64
  • 我没有 bash 脚本或错误的文件结尾。整个项目都写在这台 Linux 机器上
  • 我可以部署一个空的 go 应用程序,它只有一个 fmt 打印,没有任何错误

然而,

当我在我的 OSX 机器上构建它并将其发送到 linux 时,我可以将该可执行文件部署到 docker 而不出现任何错误

  • OSX 莫哈韦沙漠
  • 最新的码头工人
  • 去 1.13.3
  • GOOS=linux

错误 :

standard_init_linux.go:211: exec user process caused "no such file or directory"

linux go docker

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

汇编器和编译器之间的区别

我试图学习 MIPS 汇编语言,以更好地理解计算机是如何工作的。我通常编写 Java 和 JS,并且我知道 Java 使用编译器来执行我的代码。当我学习 MIPS 时,我遇到了汇编器这个词。

他们的工作方式有何不同?

assembly compilation mips

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

使用 Hardhat 部署智能合约时出错 - 错误 HH9:加载 Hardhat 配置时出错

尝试使用 Hardhat 部署智能合约但出现配置错误。

这是完整的错误详细信息

Error HH9: Error while loading Hardhat's configuration.
You probably tried to import the "hardhat" module from your config or a file imported from it.
This is not possible, as Hardhat can't be initialized while its config is being defined.
Run Code Online (Sandbox Code Playgroud)

所有插件似乎都已正确安装。

部署.js

const hre = require("hardhat");

async function main() {
  const TestContract = await hre.ethers.getContractFactory("TestContract");
  const superInstance = await TestContract.deploy("TestContractHAT", "SMC");
  await superInstance.deployed();
  console.log("contract was deployed to:", superInstance.address());
}

// We recommend this pattern to be able …
Run Code Online (Sandbox Code Playgroud)

solidity smartcontracts hardhat

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