区块链以太坊学习笔记

2023-05-16

以太坊物联网区块链(一)

Web3js 与 java 连接区块链可以参考我github上的两个小demo
Ethereum-java
Ethereum-javascript

搭建私有链, 利用以太坊平台完成数据上链

如何搭建?

用Geth搭建一个区块链节点,本地主机就和区块链网络中主机一致了,(可以连接main链,和其它测试链,还有自定义链)。注:可以通过赋予chainid和networkid不同的值让本机成为连接在main链chainid(1),测试链chanid(2-4)或者自定义链chainid(其它,暂设置为666)
chainid 与 networkid 具体用途,建议设置成一样,后面省心

安装geth

一台新机器 Ubuntu 20.04LTS (虚拟机)
#新机器需要做以下两步
#更换清华的源,参考网上
#安装vim,参考网上
#执行下列命令
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install ethereum

创世块文件

#在桌面创建 mkdir privateblock && cd privateblock
#创建创世块文件genesis.json,并将下列内容放入genesis.json文件中
{
 "config": {
   "chainId": 666,
   "homesteadBlock": 0,
   "eip150Block": 0,
   "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
   "eip155Block": 0,
   "eip158Block": 0,
   "byzantiumBlock": 0,
   "constantinopleBlock": 0,
   "petersburgBlock": 0,
   "istanbulBlock": 0,
   "ethash": {}
 },
 "nonce": "0x0",
 "timestamp": "0x5ddf8f3e",
 "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "gasLimit": "0x47b760",
 "difficulty": "0x00002",
 "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "coinbase": "0x0000000000000000000000000000000000000000",
 "alloc": {
   "bc9a3ece02d7cb31cf63dfdfc48db0b82770d014": {
     "balance": "8000000000000000000000000000000"
   }
},
 "number": "0x0",
 "gasUsed": "0x0",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
#打开geth之前一定要进入privateblock目录,初始化创世块文件,每台主机只需要初始化一次
geth --datadir data init genesis.json

打开Geth客户端

Geth版本:
Welcome to the Geth JavaScript console!
instance: Geth/v1.10.8-stable-26675454/linux-amd64/go1.16.4
#下面是我编写的开启geth脚本
root@blockchain1:/home/chenhui/privateblock# cat frist_start_2.sh 
#!/bin/bash
nohup geth --datadir data --networkid 666 --http --http.corsdomain="*" --http.port 8545 --http.addr "0.0.0.0" --http.api db,web3,eth,debug,personal,net,miner,admin --allow-insecure-unlock --rpc.allow-unprotected-txs  --port 30303  --dev --dev.period 1  2>./console.log &

Geth操作命令

#创建账户 123为账户密码
personal.newAccount("12345678")
#查看第一个账户
eth.accounts[0]
#查看用户
eth.accounts
#查看矿工账户,若节点中有多个账户,默认第一个账户为矿工账户
eth.coinbase
#查看区块数量
eth.blockNumber
#通过区块号,查看区块信息
eth.getBlock(i)
#给账户地址取别名
user1=eth.accounts[0]
#通过别名获取金额
eth.getBalance(user1)
#转账之前需要解锁密码,直接回车,默认账号锁定密码为空,返回true成功
personal.unlockAccount(user1)
#账户之间转账,提交交易,但是还未经区块链网络确认
//可以在geth运行期间一直解锁账户
personal.unlockAccount(eth.accounts[0],"123",0)
"enode://238dec8d985d6959f8b99e94e8d343be4a3d0f6737972531b226ea154212d3cf315b536bd3f4463d29096a6c3853ab783f2e78faeb6a787259e888d782dec88c@115.29.67.40:30303"
eth.sendTransaction({from:user1,to:user2,value:web3.toWei(3,"ether")})

挖矿命令

#若本机挖矿成功,矿工地址就会有就会有一笔收益,可以通过eth.coinbase查看
eth.coinbase
#设置矿工地址
miner.setEtherbase(eth.coinbase)
#设置矿工
miner.setEtherbase(user3)
#挖矿,开启1个线程挖矿
miner.start(1)
#查看是否在挖矿
eth.mining
#结束挖矿
miner.stop()

# 挖出新区块后,立马停止
miner.start(1);admin.sleepBlocks(1);miner.stop();

查看交易指令

#查看本地交易池,待提交的交易
txpool.status
eth.getBlock("pending", true).transactions
#查看用户的以太币个数,用以太币表示,而不是Wei
web3.fromWei(eth.getBalance(eth.accounts[1]),'ether')
#通过交易链接,查看交易
eth.getTransaction("0x9f5e61f3d686f793e2df6378d1633d7a9d1df8ec8c597441e1355112d102a6ce")

将区块链数据同步到其它 peer 节点

当 peer 连接好了的时候,就自动完成同步了
#查看其它节点信息
admin.peers
#查看node信息
admin.nodeInfo
admin.nodeInfo.enode
区块链中,节点是p2p模式网络
#通过admin.addPeer()添加peer节点,添加节点1
admin.addPeer("enode://917e60c31d4cac6eb1af97fd971c96f172f386d5de04fadaf01b0e1ff38c49877e4a1fcd3275659e6fd19c9fb09fc5a93a50597ff9b87d261ca216706106923b@192.168.188.133:30303")
#查看是否有其它的peer
net.peerCount
#单位换算
web3.fromWei(100000000'ether')
#跨节点转账: 如果报错可能安装web3的版本太高
eth.sendTransaction({from:address1,to:address2,value:web3.toWei(3,"ether")})

如何验证区块链节点,同步了?

可以将BlockChain2和BlockChain3,分别在Geth的控制台下,使用admin.addpeer()连接到Cluster节点(第一个节点)。可以开启一个节点的挖矿程序,在别的系统中,查看区块,发现,另一台主机也在进行同步。
如何通过产生的交易地址,来查看交易内容?

开发框架Truffle

开发框架Truffle介绍

truffle 是一个部署合约的框架,提高效率

安装方式

1 添加 node 源
$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

2 安装 nodejs
$ sudo apt-get install -y nodejs

3 安装区块链测试环境
$ npm install -g ganache-cli
$ ganache-cli --version
Ganache CLI v6.12.2 (ganache-core: 2.13.2)
$ npm install -g ethereumjs-testrpc

4 安装truffle
$ sudo npm install -g truffle
5 终端创建一个目录
mkdir test
cd test
6 下载初始项目
truffle init
7 在contract 目录下编写智能合约Say.sol
pragma solidity ^0.5.0;
contract Say {
    string private content;
    function set(string memory  _msg) public {
        content=_msg;
    }
    function say()  public view returns(string memory ){
        return content;;
    }
}
~   
8 增加合约部署文件
#在目录migrations下新建2_deploy_contracts.js(1开头的文件不能删除,否则就会报错)
var Say = artifacts.require("./Say.sol");
module.exports = function(deployer) {
  deployer.deploy(Say);
};
9 编译合约 执行命令(应该在truffle目录下)
truffle compile   
//此时执行编译时,Fetching solc version list from solc-bin. Attempt #3
卡在这卡了很久?
解决办法:见bug

10 修改目录下的文件truffle-config.js 如下(host和port要根据自己的配置来定)部署合约到区块链上
module.exports = {
  networks:{
    development:{
      host:"localhost",
      port:8545,
      network_id:"20210821",
      gas:3000000
    }
  }
};

11 部署前先解锁账号,并启动挖矿
>personal.unlockAccount(user1)
>miner.start()  

12 然后执行部署,应该是在truffle目录下
truffle migrate 
此处报错,解决见bug5

truffle 开发 ,使用开发模式的前提是,之前一定要安装第三步,区块链测试环境

$ truffle Develop 
started at http://127.0.0.1:9545/
Accounts:
(0) 0x55cc26a61e5ed0946aee50e7895f1064ccd01da4
(1) 0x17f53146ab4ecb78fa9c9c3795ee84e77b46a7a9
(2) 0x37110b76c6951c94ced4b4d46ef99013b60652cf
(3) 0xc7910dc26d37ff4cc3b855527c4074ddb36f8942
(4) 0x70aac68de9e77ec836f431e048d287a8f9330a55

...

⚠️  Important ⚠️  : This mnemonic was created for you by Truffle. It is not secure.
Ensure you do not use it on production blockchains, or else you risk losing funds.

$ truffle(develop)> compile

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

truffle(develop)> truffle migrate

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Starting migrations...
======================
> Network name:    'develop'
> Network id:      5777
> Block gas limit: 6721975 (0x6691b7)

1_initial_migration.js
======================
   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0xf6dbd0e3400fc70664a6b60fa922377ee2b5f3ac6bb630ae20d951d05791c442
   > Blocks: 0            Seconds: 0
   > contract address:    0xE612CF8f9DDCCfB89D5aED08E9cDeFFb3711ABc6
   > block number:        1
   > block timestamp:     1630758669
   > account:             0x55Cc26A61E5eD0946aEe50e7895f1064cCD01dA4
   > balance:             99.999616114
   > gas used:            191943 (0x2edc7)
   > gas price:           2 gwei
   > value sent:          0 ETH
   > total cost:          0.000383886 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:         0.000383886 ETH

2_deploy_contracts.js
=====================
   Deploying 'Say'
   ---------------
   > transaction hash:    0x35fed518448b51036dd245c5f180d6af7c3e7050e5c166bff94f9360479e3ce2
   > Blocks: 0            Seconds: 0
   > contract address:    0x02db26E5099Ae13ad8282A82A7bD818e3030bC27
   > block number:        3
   > block timestamp:     1630758669
   > account:             0x55Cc26A61E5eD0946aEe50e7895f1064cCD01dA4
   > balance:             99.99908693
   > gas used:            222254 (0x3642e)
   > gas price:           2 gwei
   > value sent:          0 ETH
   > total cost:          0.000444508 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:         0.000444508 ETH
Summary
=======
> Total deployments:   2
> Final cost:          0.000828394 ETH
- Blocks: 0            Seconds: 0
- Saving migration to chain.
- Blocks: 0            Seconds: 0
- Saving migration to chain.

安装nodejs

//新建一个文件夹,然后初始化
$ mkdir nodejs && cd nodejs
$ npm init -f  //此处的-f会自动给你配好配置文件
$ npm install web3@^0.20.0
//若想 安装最新版web3 npm install web3
安装报错,见bug6 
查看,node内嵌web3版本的方式
chenhui@ubuntu:~/privateblock/nodejs$ node
> web3.version.api
Thrown:
ReferenceError: web3 is not defined
> var Web3 = require('web3')
undefined
> var web3 = new Web3(new Web.providers.HttpProvider("http://localhost:8545"))
Thrown:
ReferenceError: Web is not defined
> var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
undefined
> web3.version.api
'0.20.7'

nodejs 在命令行输入参数
var arguments = process.argv.splice(2)
arguments[0] arguments[1]

Bug 笔记

1. Fatal: Error starting protocol stack: listen tcp :30303: bind: address already in use

ps ax | grep geth
kill -9 <pid>

2.personal.unlockAccount(user1,“12345678”)

解锁失败,报错如下
GoError: Error: could not decrypt key with given password at web3.js:6357:37(47)
at native
at :1:30(4)

解决方案:可能是密码出错了,也可能是
尝试新建一个用户
eth.newAccount("123")
并将这个用户立马使用
personal.unlockAccount(eth.accounts[2])
输入密码:123

3.Error: etherbase must be explicitly specified

at web3.js:6357:37(47)
at get (web3.js:6257:66(14))
可能首次,没有创建用户

4.truffle compile编译这部分,可能需要弄很久

http://www.manongjc.com/detail/19-sczhvzvgfkmlgse.html

解决方案:https://learnblockchain.cn/question/1568
将 compiler 用别的方式下载下来,放到下面的目录~。
在这里插入图片描述
修改truffle-config.js中的去掉version注释
在这里插入图片描述
在这里插入图片描述

5.报错如下

undefined:1
b0VIM 8.1
^
SyntaxError: Unexpected token b in JSON at position 0
at JSON.parse ()

chenhui@ubuntu:~/privateblock/truffle$ truffle migrate
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Starting migrations...
======================
> Network name:    'development'
> Network id:      20210821
> Block gas limit: 4787948 (0x490eec)
1_initial_migration.js
======================
undefined:1
b0VIM 8.1
^
SyntaxError: Unexpected token b in JSON at position 0
    at JSON.parse (<anonymous>)
    at FS.getContractName (/usr/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/sources/fs.js:44:1)
    at FS.require (/usr/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/sources/fs.js:25:1)
    at /usr/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/resolver.js:53:1
    at Array.forEach (<anonymous>)
    at Resolver.require (/usr/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/resolver.js:52:1)
    at Object.require (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:172:1)
    at ResolverIntercept.require (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/ResolverIntercept.js:22:1)
    at /home/chenhui/privateblock/truffle/migrations/1_initial_migration.js:1:30
    at Script.runInContext (vm.js:144:12)
    at Script.runInNewContext (vm.js:149:17)
    at Object.file (/usr/lib/node_modules/truffle/build/webpack:/packages/require/require.js:94:1)
    at Migration._load (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:44:1)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Migration.run (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
    at Object.runMigrations (/usr/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
Truffle v5.4.9 (core: 5.4.9)
Node v14.17.6

解决:
1_initial_migration.js 这个文件是重要文件,不能删除,删除就会报上面的错误

6:chenhui@ubuntu:~/privateblock/nodejs$ npm install web3@0.20.0

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/frozeman/bignumber.js-nolookahead.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /home/chenhui/.npm/_logs/2021-09-05T08_29_15_774Z-debug.log

错误原因,没有安装git
解决办法: 用管理员权限安装git
sudo apt install git  
此错误好了,出现下列错误
chenhui@ubuntu:~/privateblock/nodejs$ npm install web3@0.20.0
npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://github.com/frozeman/bignumber.js-nolookahead.git /home/chenhui/.npm/_cacache/tmp/git-clone-40a3a4f4/.git
npm ERR! warning: templates not found in /tmp/pacote-git-template-tmp/git-clone-921abd23
npm ERR! fatal: unable to access 'https://github.com/frozeman/bignumber.js-nolookahead.git/': GnuTLS recv error (-54): Error in the pull function.
npm ERR! 
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/chenhui/.npm/_logs/2021-09-05T08_33_49_217Z-debug.log

错误原因:尝试
git config --global url.“https://”.insteadOf git://
再进行安装,没有成功,再尝试,报错

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://github.com/frozeman/bignumber.js-nolookahead.git
npm ERR! 
npm ERR! fatal: unable to access 'https://github.com/frozeman/bignumber.js-nolookahead.git/': GnuTLS recv error (-54): Error in the pull function.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-09-06T07_09_43_403Z-debug.log
执行:
git config --global url.git://github.com/.insteadOf https://github.com/

解决办法
执行:
git config --global url.git://github.com/.insteadOf https://github.com/
结果
在这里插入图片描述

7.连接MetaMask报错

报错问题:无法获取链 IC,您的 RPC URL 地址是正确的么?
原因是少了–http.port 8545 和 --http.addr “0.0.0.0”

下面是我开启geth的命令

#!/bin/bash
nohup geth --datadir data --networkid 666 --http --http.corsdomain="*" --http.port 8545 --http.addr "0.0.0.0" --http.api db,web3,eth,debug,personal,net,miner,admin --allow-insecure-unlock --rpc.allow-unprotected-txs  --port 30303  --dev --dev.period 1  2>./console.log &

连接成功图:
注意:链id 为genesis.json文件中的chainid ,而不是运行geth时的 networkid
如果上述错误,请确认,通过上述开启的 geth 的参数都没有遗漏

8.remix 部署合约上不了链,或者转账无法数据无法上链

解决方式:
1.将链id 和 网络id更换为相同的
2.把metamask卸载重新安装
3 .增大 gas limit
在这里插入图片描述

9.区块链编程,想通过调用区块链上的函数时,出现了跨域问题

test.html:1 
Access to XMLHttpRequest at 'http://10.69.177.223:8545/' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
index.js:106 
POST http://10.69.177.223:8545/ net::ERR_FAILED
test.html:1 
Access to XMLHttpRequest at 'http://10.69.177.223:8545/' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
index.js:106 
POST http://10.69.177.223:8545/ net::ERR_FAILED
errors.js:43 
Uncaught (in promise) Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (errors.js:43)
    at XMLHttpRequest.i.onreadystatechange (index.js:95)

错误原因,跨域的时候,之前只指定了http://remix.etherum.org,导致出现跨域问题, 后面将-http.corsdomain="" 改为 “”成功解决
下面是我开启geth的命令行指令

nohup geth --datadir data --networkid 666 --ipcdisable --rpc  --rpccorsdomain "*" --port 30303 --rpcport 8545  --rpcaddr "0.0.0.0" --http --http.corsdomain="*" --http.api db,web3,eth,debug,personal,net,miner,admin --vmdebug --rpcapi "db,eth,net,web3,admin,personal,miner" --allow-insecure-unlock 2>./console.log  &

10.当使用idea开发java时,使用

E:\Ethereum-java>mvn web3j:generate-sources
出现下列需要等待很久
Solidity version 0.4.25 is not installed. Downloading and installing it to ~/.web3j/solc/0.4.25
解决办法:开启科学上网工具,等待一下就会自己下载完毕

11 . java.lang.RuntimeException: java.lang.RuntimeException: Error processing transaction request: only replay-protected (EIP-155) transactions allowed over RPC

at org.web3j.tx.Contract.deploy(Contract.java:460)
at org.web3j.tx.Contract.deploy(Contract.java:506)
at org.web3j.tx.Contract.lambda$deployRemoteCall$5(Contract.java:549)
at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
at com.nwpu.eth.sol.SaySample.deploy(SaySample.java:42)
at com.nwpu.eth.sol.SaySample.main(SaySample.java:30)

解决办法在打geth时,-加入参数--rpc.allow-unprotected-txs

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

区块链以太坊学习笔记 的相关文章

  • 动态规划、贪心算法、分治算法的优缺点分析

    动态规划模型相对于静态规划模型的优点 xff1a 1 能够得到全局最优解 xff1b 2 可以得到一族最优解 xff1b 3 由于动态规划方法反映了动态过程演变的联系和特征 xff0c 在计算时可以利用实际知识和经验提高求解效率 动态规划模
  • 如何在vscode上运行调试C++(最简单的方法)

    Visual Studio Code vscode同样是微软出品的 支持 看上面的vside介绍吧 就省略了 人称宇宙第一编辑器 作为编辑器 它几乎支持所有的语言 对应语言风格的高亮 自动缩进 代码纠错 代码提示和代码补全等 要是有相应的编
  • visual studio中,已经安装完成后如何再安装其他组件(即在安装过程中未勾选的)怎么办?

    方法一 xff1a 控制面板 gt 程序 程序和功能 右键visual studio 单击更改 下面有三个按钮 单击更改 xff0c 把需要安装的组件全钩 xff0c 然后点击更改即可 1 在win10界面左下角搜索 控制面板 2 寻找程序
  • Unity can't be installed on this disk.The contents of this disk can't be changed.

    1 问题 在使用mac下Unity的时候 xff0c 通常情况下我们的方法都是通过Hub的安装按钮下载 但是 xff0c 很多时候上面并没有我们需要的版本 于是我们傻乎乎的通过点击上面的 xff1a 官方发布网站 进行下载 在下载的第五个步
  • Unity之【使用Blend-Tree】

    Blended Tree 材料准备创建Animator创建Controller配置混合树脚本代码效果演示 材料准备 人物模型和动画 直接去Unity素材库里找 xff0c 动画可以找可以自己录制 Unity编辑器 创建Animator 步骤
  • 【GIT】git个人笔记

    GIT个人手册 版本 日期 修订内容 作者 V01 2019 06 25 初稿 备注 xff1a 使用中不断迭代完善 xff0c 其他人使用中有其他总结的 xff0c 可以补充 目录 第一章 说明 一 1 1 GIT 中文手册 一 1 2
  • linux常用开关机指令

    关机命令 xff1a shutdown h now xff08 立刻进行关机 xff09 halt xff08 立刻进行关机 xff09 poweroff xff08 立刻进行关机 xff09 重启命令 xff1a shutdown r n
  • _vimrc (linux版)

    一般放在 xff1a etc vim span class token string 34 vimrc 34 span span class token function vim span config span class token f
  • 01_Unity事件函数OnMouseDown生效条件

    前言 Unity提供了OnMouseDown xff0c OnMouseEnter xff0c OnMouseExit等方法 xff0c 这些方法可以很方便的帮助我们处理鼠标的时间响应 但是需要注意他的生效条件 xff0c 最近我在制作视频
  • 算法题型:滑动窗口(leetcode 209)

    一 209 长度最小的子数组 难度中等 题目描述 给定一个含有 n 个正整数的数组和一个正整数 s xff0c 找出该数组中满足其和 s 的长度最小的连续子数组 如果不存在符合条件的连续子数组 xff0c 返回 0 示例 输入 s 61 7
  • 前端:bootstrap table表格属性、列属性、事件、方法

    目录 一 使用前提 二 基本属性 列参数 事件 方法 多语言 一 使用前提 1 在html中引用table相应的包 lt link rel 61 34 stylesheet 34 type 61 34 text css 34 href 61
  • Git学习(一):Git介绍、仓库和分支等基本概念解释

    目录 一 Git介绍 二 关于git仓库和分支的解释 1 仓库 2 分支 3 例子解释 4 本地与远程建立联系 5 git merge命令解释 6 Merge Request解释 7 尽量避免冲突的做法 8 Upstream概念及使用 9
  • Ubuntu 解决wps缺乏字体

    文章目录 Ubuntu 解决wps缺乏字体 Ubuntu 解决wps缺乏字体 移植windows字体 xff1a 复制 C Windows Fonts 下的字体 到 usr share fonts truetype windows font
  • TensorFlow2安装(超详细步骤-人工智能实践)

    TensorFlow2安装教程 1 前言1 1 版本记录1 2 工具简介 2 详细步骤及安装语句2 1 安装Anaconda2 2 TensoFlow安装2 3 验证是否成功2 4 PyCharm下载与安装2 5 PyCharm环境配置2
  • 图像识别-数据清洗

    1 删除不清晰的图片 xff08 由于图片是从视频里截取到的 xff0c 摄像头在移动的过程中 xff0c 会出现自动对焦 xff09 模糊图片示例 xff1a 2 删除重复度高的图片 xff08 相似度高的图片 xff0c 无法给模型提供
  • 【Linux】nm命令|查看动态库包含的函数符号

    目录 0 前言 1 nm简介 2 nm命令用法和参数说明 3 nm用法和结果说明 4 nm 提示 no symbol 的问题 xff08 strip xff09 0 前言 下文1 3 摘抄自 xff1a Linux nm命令详解 https
  • Xmanager 5远程连接CentOS7图形化界面

    1 安装Xmanager 5 下载链接 xff1a https pan baidu com s 1JwBk3UB4ErIDheivKv4 NA 提取码 xff1a cw04 双击xmgr5 wm exe进行安装 点击 下一步 选择 我接受许
  • ROS遇到问题:rosdep找不到

    当在catkin工作区创建好了包以后 xff0c 要rospack depends1 beginner tutorials xff0c 出现了以下的提示错误 xff1a rospack Error the rosdep view is em
  • 纯JavaScript实现一个带cookie的学生管理系统

    由来 之前写过一个Jsp amp Servlet版本的学生管理系统 发出来之后 xff0c 有一个网友找我给他写JavaScript版本的 xff0c 时间也过去很久了 xff0c 我估摸着他那门课已经结束了 xff0c 所以整理了一下代码
  • FreeRTOS互斥信号量与二值信号量使用时的区别

    1 互斥信号量 互斥信号量的申请与释放是要在同一个任务中进行的 xff0c 不能在一个任务中申请而在另一个任务中释放 互斥信号量主要解决的是 xff0c 我在用的时候 xff0c 别人都不能用 举个例子 xff0c 我在像一段内存中写数据的

随机推荐

  • 小白入门photoscan

    1 安装 我装的是photoscanPro 1 4 5版本 注 xff1a 刚开始是在官网上下载的 xff0c 要收费就点了试用 xff0c 结果当我等了一天把将近200张图片处理完后 xff0c 告诉我试用版不能保存文件 绝望 所以要是像
  • matlab学习(1)strsplit与strtok

    strsplit函数用法 xff1a lt 1 gt 默认使用空格符分割 返回一个cell数组 lt 2 gt 也可以指定第二个参数进行分割 lt 3 gt 第二个参数也可以时包含多个分隔符的元胞数组 lt 4 gt strsplit还可以
  • latex之注释快捷键

    注释快捷键 ctrl 43 T 注释掉选中区域 ctrl U 解除选中区域的注释
  • Ceres-solver安装(win10+vs2015)

    Ceres solver安装 Vs2015 43 win10 文件已经上传至 永久有效 网盘 xff1a https pan baidu com s 1Vj n2Nbp9WFVlbjuXV OxQ 密码 xff1a 3rvo 1 将网盘里的
  • 关于Intellij IDEA的pom.xml添加依赖后仍找不到

    1 在pom xml中添加了junit依赖 也执行了项目 gt reimport xff0c 在本地仓库也确实存在junit依赖包 xff0c 打开里面的jar包也确实有Test class After class等文件 但是编译时仍然说找
  • 【Dll调试】DLL调试方法

    dll本身是没法运行的 xff0c 必须在其它工程调用dll时候才会运行 所以 xff0c 调试dll首先要将调用dll的工程和dll工程联系起来 解决方案中添加dll工程 xff1a 现在dll 和 应用程序两个工程就都在一个解决方案里了
  • 【原创】linux下将Python命令默认指向为Python3

    linux下输入Python命令默认指向的是 usr bin python 因此 xff0c 为了方便使用 xff0c 安装了python3后 xff0c 我们一般会创建软链接使 usr bin python指向 usr bin pytho
  • C#开发窗体程序全过程(项目目录、格式、控件使用、文件读写)

    目录 第一章 xff1a WinForm基础 一 概述二 在VS中新建窗体程序三 窗体 xff08 Form xff09 第二章 xff08 上 xff09 xff1a 控件与窗体 一 文本编辑控件二 图片框 xff1a PictureBo
  • JAVA面试题大全(200+道题目)

    目录 一 Java 基础 1 JDK 和 JRE 有什么区别 xff1f 2 61 61 和 equals 的区别是什么 xff1f 3 两个对象的 hashCode 相同 xff0c 则 equals 也一定为 true xff0c 对吗
  • 【Audio】查看手机的声卡信息

    以我的旧手机华为P8青春版为例 xff0c 我没有root xff0c 所以权限有限 找到开发者选项 在设置中找到开发者选项 xff0c 然后打开usb调试 下载adb工具 这个网上有很多 xff0c 可以自行下载 xff0c 主要包含如下
  • Jetson TX2 ubuntu18设置VNC时DesktopSharing打不开

    Jetson TX2设置VNC时DesktopSharing打不开 1 1 编辑 org gnome Vino 来加入缺失的 enabled 参数 sudo gedit usr share glib 2 0 schemas org gnom
  • zRAM内存压缩技术分析及优化方向

    目录 1 zRAM出现的背景 2 zRAM软件架构 3 zRAM实现分析 3 1 zRAM驱动模块 3 2 数据流模块 3 3 压缩算法模块 3 4 zRAM读写流程 3 5 zRAM writeback功能 4 zRAM性能调优 4 1
  • 皮皮辉的假期计划

    皮皮辉的周六计划 上午南塘老街老外滩天一阁 下午有些计划还没开始就已结束了 xff08 哭泣脸 xff09 上午 在实习的地方自习 xff0c 计划着去宁波好玩的地方逛逛 南塘老街 宁波南塘老街由宁波城旅投资发展有限公司开发建设 xff0c
  • 皮皮辉学到的springboot

    springboot springboot项目创建项目操作步骤正式项目前的测试案例正式项目 springboot项目 spring boot 里有各种注释来完成各种功能 xff0c 相较于SSM框架更方便 创建项目操作步骤 新建项目时选择s
  • C语言刷题(13):写一个函数,输入一个4个数字,要求输出这个4个数字字符,但每两个数字间空一个字符。

    span class token macro property span class token directive keyword include span span class token string lt stdio h gt sp
  • C语言刷题(14):编写一个函数,由实参传来一个字符串,统计此字符串中字母,数字,空格和其他字符的个数

    span class token macro property span class token directive keyword include span span class token string lt stdio h gt sp
  • 学习笔记整理

    本文仅用于作者考研路上的学习与思考 xff0c 以便日后复习 xff0c 若有不对 xff0c 欢迎读者指正 操作系统 1 堆 xff0c 栈有什么区别 xff1f 从数据结构的角度来看 xff1a 栈 xff1a 在数据结构中 xff0c
  • linux命令之文件级的操作

    二 文件级的操作 1 查看文件大小 xff1a ls lah 2 查看文件行数 xff1a wc l 文件名 3 强制删除文件夹 xff1a rm r 文件夹 4 查看文件全路径 xff1a pwd 5 查看文件大小 xff1a ll 文件
  • OPNET仿真2.5节包交换例程无实验数据解决方案

    B站自制包交换链接 B站自制包交换链接 结果如下所示无结果数据 xff08 仿真例子依照基于5G通信与计算的物联网智能应用的2 5小节 xff09 排错一 xff1a 重新了绘制周边节点模型 包流的连接顺序会影响有没有ETE Delay的数
  • 区块链以太坊学习笔记

    以太坊物联网区块链 xff08 一 xff09 Web3js 与 java 连接区块链可以参考我github上的两个小demo Ethereum java Ethereum javascript 搭建私有链 利用以太坊平台完成数据上链 如何