问题:以太坊合约部署失败,报错:TypeError: param.map is not a function 或者 Error: Invalid number of parameters for "undefined". Got 2 expected 1!

解决:官方文档写的比较特别,所以被误导了。web3使用的是1.7.0

方法:
官方文档:

const myContract = await new web3.eth.Contract(JSON.parse(interface));    
myContract.deploy({
    data: '0x12345...',
    arguments: [123, 'My String']
})
.send({
    from: '0x1234567890123456789012345678901234567891',
    gas: 1500000,
    gasPrice: '30000000000000'
}, function(error, transactionHash){ ... })
.on('error', function(error){ ... })
.on('transactionHash', function(transactionHash){ ... })
.on('receipt', function(receipt){
   console.log(receipt.contractAddress) // contains the new contract address
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.then(function(newContractInstance){
    console.log(newContractInstance.options.address) // instance with the new contract address
});

阅读全文

问题:sqlalchemy的outerjoin外表时需要添加条件,使用filter过滤会到where中,而不是在on语句中

解决:使用and_

方法:

offset_num = (page - 1) * pagesize
q = select(
    User.uid, User.username, User.fullname, User.national_id, User.phone,
    User.gender, User.last_login, User.status, User.create_time,
    func.group_concat(UserRole.role_id).label('role_ids')).outerjoin(
    UserRole, and_(User.uid == UserRole.user_uid,
    UserRole.is_delete == obj_get['is_delete'])).filter(
    User.is_delete == obj_get['is_delete']).group_by(
    User.uid).offset(offset_num).limit(pagesize)
r = await db.execute(q)
return r.all()

阅读全文

问题:为什么用token代替cookie,用token的好处是什么?

解决:

1、cookie
cookie生成过程.jpg

缺点:

跨域限制;
请求接口时默认发送,不安全;
服务器session(redis实现)需要存储用户信息,数据量大时有性能压力;

阅读全文

问题:使用presto无法连接到hive metastore

解决:因为在presto中配置的hive.properties出错

方法:

vim etc/catalog/hive.properties
写入下面代码
connector.name=hive-hadoop2
hive.metastore.uri=thrift://vm007:9083

注:hive服务是安装在vm007,然后分发到各节点的,hive的metasotre是存储在vm014服务器的mysql中的

阅读全文