centos8 安裝 docker
https://www.cnblogs.com/zbseoag/p/11736006.htmlposted @ 2020-05-06 12:57 狼愛(ài)上貍 閱讀(400) | 評(píng)論 (3) | 編輯 收藏
我胡漢三又回來(lái)了
2019年12月21日 #
posted @ 2020-05-06 12:57 狼愛(ài)上貍 閱讀(400) | 評(píng)論 (3) | 編輯 收藏
posted @ 2020-04-18 09:45 狼愛(ài)上貍 閱讀(295) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-22 08:22 狼愛(ài)上貍 閱讀(299) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-21 21:43 狼愛(ài)上貍 閱讀(247) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-20 21:52 狼愛(ài)上貍 閱讀(566) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-20 18:53 狼愛(ài)上貍 閱讀(192) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-19 17:10 狼愛(ài)上貍 閱讀(171) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-14 11:01 狼愛(ài)上貍 閱讀(480) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-09 18:20 狼愛(ài)上貍 閱讀(958) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-08 23:21 狼愛(ài)上貍| 編輯 收藏
posted @ 2020-03-07 19:08 狼愛(ài)上貍 閱讀(321) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-07 18:59 狼愛(ài)上貍 閱讀(216) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-03 18:43 狼愛(ài)上貍 閱讀(775) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-03 16:20 狼愛(ài)上貍 閱讀(126) | 評(píng)論 (0) | 編輯 收藏
===============CentOS 7.6================
1.查看系統(tǒng)時(shí)間
date
查看當(dāng)前系統(tǒng)時(shí)間以及時(shí)區(qū)
結(jié)果是:
Mon Jul 8 09:23:31 UTC 2019
2.更改系統(tǒng)時(shí)間時(shí)區(qū)
timedatectl set-timezone Asia/Shanghai
3.再次查看
date
結(jié)果是:
Mon Jul 8 17:25:28 CST 2019
4.可以重啟后查看,防止重啟后失效
reboot
=======================
posted @ 2020-03-02 21:11 狼愛(ài)上貍 閱讀(220) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-02 19:47 狼愛(ài)上貍 閱讀(126) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-02 18:34 狼愛(ài)上貍 閱讀(106) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-03-01 20:45 狼愛(ài)上貍 閱讀(3091) | 評(píng)論 (0) | 編輯 收藏
Catalina 10.15
系統(tǒng)posted @ 2020-03-01 20:43 狼愛(ài)上貍 閱讀(179) | 評(píng)論 (0) | 編輯 收藏
keytool -genkey -v -keystore ./key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
apk 輸出在:key.properties
storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=C:/Users/Administrator/AndroidStudioProjects/flutter_app/key.jks
build.gradledef localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_app"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
//signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
posted @ 2020-02-29 11:48 狼愛(ài)上貍 閱讀(346) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-25 18:18 狼愛(ài)上貍 閱讀(149) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-25 12:47 狼愛(ài)上貍 閱讀(947) | 評(píng)論 (0) | 編輯 收藏
2.0.0-rc
posted @ 2020-02-25 12:46 狼愛(ài)上貍 閱讀(404) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-25 11:40 狼愛(ài)上貍 閱讀(141) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-22 16:33 狼愛(ài)上貍 閱讀(339) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-22 14:46 狼愛(ài)上貍 閱讀(257) | 評(píng)論 (0) | 編輯 收藏
此前我的Ubuntu不是wubi方式安裝的,因?yàn)槁?tīng)說(shuō)此方式安裝有多種缺陷,于是我選擇U盤安裝。這時(shí)想要卸載Ubuntu了,想到卸載這個(gè)也會(huì)有些小阻礙,就寫下這篇博文表示記錄一下Ubuntu的正確卸載方法。
在每次開(kāi)機(jī)時(shí)都會(huì)有GURB菜單,這表示寫入到安裝Ubuntu的時(shí)候把GURB寫入到了MBR,所以卸載Ubuntu前首先需要將MBR重寫,去掉Ubuntu的GURB。如果朋友們不進(jìn)行這一步把Ubuntu強(qiáng)行干掉,會(huì)讓windows也直接GG。
重寫MBR有兩種方法:
一、放入Windows的安裝盤,進(jìn)入Windows安裝程序,進(jìn)入恢復(fù)控制臺(tái),輸入命令fixmbr。
二、使用MbrFix工具進(jìn)行修復(fù)。
我選擇的是MbrFix,下載地址:http://www.cnitblog.com/Files/CoffeeCat/MbrFix.rar
下載完成后運(yùn)行命令行,然后進(jìn)入存放MbrFix.exe的目錄下,輸入指令MbrFix /drive 0 fixmbr /yes,重啟就可以直接進(jìn)入windows了。
ps:輸入命令行提示"function failed.error 5:拒絕訪問(wèn)"如何解決?
找到MbrFix.exe,右擊屬性,進(jìn)入兼容性選項(xiàng)卡,勾選"以管理員身份運(yùn)行此程序",確定退出,然后重新輸入指令即可解決。
搞定第一步之后,右鍵我的電腦進(jìn)入管理,磁盤管理,如果是自己安裝的Ubuntu,應(yīng)該知道在安裝的時(shí)候分配了幾個(gè)分區(qū)在此系統(tǒng)上,如果只是雙系統(tǒng),除了Windows下有標(biāo)注卷名的其余應(yīng)該都是Ubuntu的分區(qū)。右鍵Ubuntu分區(qū),刪除卷,標(biāo)注藍(lán)條會(huì)變成綠條,把幾個(gè)分區(qū)全部刪除完成,右鍵新加卷一步一步完成恢復(fù)成為Windows的邏輯分區(qū)了。
來(lái)自:https://www.cnblogs.com/-Yvan/p/4975326.html
posted @ 2020-02-20 18:18 狼愛(ài)上貍 閱讀(1424) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-19 09:46 狼愛(ài)上貍 閱讀(194) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-12 09:37 狼愛(ài)上貍 閱讀(173) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-02-11 16:37 狼愛(ài)上貍 閱讀(1403) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-16 14:44 狼愛(ài)上貍 閱讀(125) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-12 16:17 狼愛(ài)上貍 閱讀(169) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-04 17:22 狼愛(ài)上貍 閱讀(141) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-03 19:03 狼愛(ài)上貍 閱讀(209) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-03 17:55 狼愛(ài)上貍 閱讀(341) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-01 13:52 狼愛(ài)上貍 閱讀(190) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-01 12:28 狼愛(ài)上貍 閱讀(1618) | 評(píng)論 (0) | 編輯 收藏
posted @ 2020-01-01 12:13 狼愛(ài)上貍 閱讀(171) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-29 22:57 狼愛(ài)上貍 閱讀(193) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-27 14:49 狼愛(ài)上貍 閱讀(273) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-26 16:09 狼愛(ài)上貍 閱讀(152) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-26 15:37 狼愛(ài)上貍 閱讀(114) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-26 15:31 狼愛(ài)上貍 閱讀(228) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-24 10:02 狼愛(ài)上貍 閱讀(641) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-24 10:01 狼愛(ài)上貍 閱讀(510) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-22 00:27 狼愛(ài)上貍 閱讀(99) | 評(píng)論 (0) | 編輯 收藏
最新內(nèi)容會(huì)更新在主站深入淺出區(qū)塊鏈社區(qū)
原文鏈接:Web3與智能合約交互實(shí)戰(zhàn)
在最初學(xué)習(xí)以太坊的時(shí)候,很多人都是自己創(chuàng)建以太坊節(jié)點(diǎn)后,使用geth與之交互。這種使用命令行交互的方法雖然讓很多程序員感到興奮(黑客帝國(guó)的既視感?),但不可能指望普通用戶通過(guò)命令行使用Dapp。因此,我們需要一種友好的方式(比如一個(gè)web頁(yè)面)來(lái)與智能合約交互,于是問(wèn)題的答案就是web3.js
。
Web3.js是以太坊官方的Javascript API,可以幫助智能合約開(kāi)發(fā)者使用HTTP或者IPC與本地的或者遠(yuǎn)程的以太坊節(jié)點(diǎn)交互。實(shí)際上就是一個(gè)庫(kù)的集合,主要包括下面幾個(gè)庫(kù):
web3-eth
用來(lái)與以太坊區(qū)塊鏈和智能合約交互web3-shh
用來(lái)控制whisper協(xié)議與p2p通信以及廣播web3-bzz
用來(lái)與swarm協(xié)議交互web3-utils
包含了一些Dapp開(kāi)發(fā)有用的功能Web3與geth通信使用的是 JSON-RPC ,這是一種輕量級(jí)的RPC(Remote Procedure Call)協(xié)議,整個(gè)通信的模型可以抽象為下圖。
在開(kāi)發(fā)初期,我們并沒(méi)有必要使用真實(shí)的公鏈,為了開(kāi)發(fā)效率,一般選擇在本地搭建測(cè)試鏈。在本文我們選擇的Ganache(在此之前使用的是testrpc,Ganache屬于它的升級(jí)版),一個(gè)圖形化測(cè)試軟件(也有命令行版本),可以一鍵在本地搭建以太坊區(qū)塊鏈測(cè)試環(huán)境,并且將區(qū)塊鏈的狀態(tài)通過(guò)圖形界面顯示出來(lái),Ganache的運(yùn)行界面如下圖所示。
從圖中可以看到Ganache會(huì)默認(rèn)創(chuàng)建10個(gè)賬戶,監(jiān)聽(tīng)地址是http://127.0.0.1:7545
,可以實(shí)時(shí)看到Current Block
、Gas Price
、Gas Limit
等信息。
目前以太坊官方全力支持的智能合約開(kāi)發(fā)環(huán)境是Remix IDE,我們?cè)诤霞s編輯頁(yè)面編寫如下代碼:
pragma solidity ^0.4.21; contract InfoContract { string fName; uint age; function setInfo(string _fName, uint _age) public { fName = _fName; age = _age; } function getInfo() public constant returns (string, uint) { return (fName, age); } }
代碼很簡(jiǎn)單,就是簡(jiǎn)單的給name
和age
變量賦值與讀取,接下來(lái)切換到 run 的 tab 下,將Environment
切換成Web3 Provider
,并輸入我們的測(cè)試鏈的地址http://127.0.0.1:7545
,這里對(duì)這三個(gè)選項(xiàng)做一簡(jiǎn)單說(shuō)明:
Javascript VM
:簡(jiǎn)單的Javascript虛擬機(jī)環(huán)境,純粹練習(xí)智能合約編寫的時(shí)候可以選擇Injected Web3
:連接到嵌入到頁(yè)面的Web3,比如連接到MetaMaskWeb3 Provider
:連接到自定義的節(jié)點(diǎn),如私有的測(cè)試網(wǎng)絡(luò)。如果連接成功,那么在下面的Account
的選項(xiàng)會(huì)默認(rèn)選擇 Ganache 創(chuàng)建的第一個(gè)賬戶地址。接下來(lái)我們點(diǎn)擊Create
就會(huì)將我們的智能合約部署到我們的測(cè)試網(wǎng)中。接下來(lái) Remix 的頁(yè)面不要關(guān)閉,在后面編寫前端代碼時(shí)還要用到合約的地址以及ABI
信息。
在這之前,先在終端創(chuàng)建我們的項(xiàng)目:
> mkdir info > cd info
接下來(lái)使用 node.js 的包管理工具 npm 初始化項(xiàng)目,創(chuàng)建package.json
文件,其中保存了項(xiàng)目需要的相關(guān)依賴環(huán)境。
> npm init
一路按回車直到項(xiàng)目創(chuàng)建完成。最后,運(yùn)行下面命令安裝web.js:
> npm install web3
注意: 在實(shí)際安裝過(guò)程中我發(fā)現(xiàn)web3在安裝完成后并沒(méi)有
/node_modules/web3/dist/we3.min.js
文件,這個(gè)問(wèn)題在 issue#1041中有體現(xiàn),但官方好像一直沒(méi)解決。不過(guò)可以在這里下載所需的文件,解壓后將dist
文件夾的內(nèi)容拷貝到/node_modules/web3
路徑下。
在項(xiàng)目目錄下創(chuàng)建index.html
,在這里我們將創(chuàng)建基礎(chǔ)的 UI,功能包括name
和age
的輸入框,以及一個(gè)按鈕,這些將通過(guò) jQuery 實(shí)現(xiàn):
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link rel="stylesheet" type="text/css" href="main.css"> <script src="./node_modules/web3/dist/web3.min.js"></script> </head> <body> <div class="container"> <h1>Info Contract</h1> <h2 id="info"></h2> <label for="name" class="col-lg-2 control-label">Name</label> <input id="name" type="text"> <label for="name" class="col-lg-2 control-label">Age</label> <input id="age" type="text"> <button id="button">Update Info</button> </div> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script> <script> // Our future code here.. </script> </body> </html>
接下來(lái)需要編寫main.css
文件設(shè)定基本的樣式:
body { background-color:#F0F0F0; padding: 2em; font-family: 'Raleway','Source Sans Pro', 'Arial'; } .container { width: 50%; margin: 0 auto; } label { display:block; margin-bottom:10px; } input { padding:10px; width: 50%; margin-bottom: 1em; } button { margin: 2em 0; padding: 1em 4em; display:block; } #info { padding:1em; background-color:#fff; margin: 1em 0; }
UI 創(chuàng)建好之后,在<script>
標(biāo)簽中間編寫web.js
的代碼與智能合約交互。首先創(chuàng)建web3
實(shí)例,并與我們的測(cè)試環(huán)境連接:
<script> if (typeof web3 !== 'undefined') { web3 = new Web3(web3.currentProvider); } else { // set the provider you want from Web3.providers web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545")); } </script>
這段代碼是web3.js Github提供的樣例,意思是如果web3
已經(jīng)被定義,那么就可以直接當(dāng)作我們的 provider 使用。如果沒(méi)有定義,則我們手動(dòng)指定 provider。
這里可能會(huì)存在疑問(wèn):為什么 web3 會(huì)被事先定義呢?實(shí)際上,如果你使用類似 MetaMask(一個(gè) Chrome 上的插件,迷你型以太坊錢包)這樣的軟件,provider 就會(huì)被自動(dòng)植入。
在上面代碼的基礎(chǔ)上,接下來(lái)設(shè)置默認(rèn)的以太坊賬戶:
web3.eth.defaultAccount = web3.eth.accounts[0];
在上文中我們使用 Ganache 已經(jīng)創(chuàng)建了 10 個(gè)賬戶了,這里我們選擇第一個(gè)賬戶當(dāng)作默認(rèn)賬戶。
接下來(lái)需要讓我們的web3
知道我們的合約是什么樣的,這里需要用到合約的 ABI(Application Binary Interface)。ABI
可以使我們調(diào)用合約的函數(shù),并且從合約中獲取數(shù)據(jù)。
在上文中我們已經(jīng)在 Remix 中創(chuàng)建了我們的合約,這時(shí)重新回到 Remix,在 Compile 的 tab 下我們點(diǎn)擊Details
出現(xiàn)的頁(yè)面中我們可以拷貝合約的ABI
,如下圖所示。
將其復(fù)制到代碼中:
var infoContract = web3.eth.contract(PASTE ABI HERE!);
接下來(lái)轉(zhuǎn)到 run 的tab,拷貝合約的地址,將其復(fù)制到下面的代碼中:
var info = InfoContract.at('PASTE CONTRACT ADDRESS HERE');
完成這些我們就可以調(diào)用合約中的函數(shù)了,下面我們使用 jQuery 與我們的合約進(jìn)行交互:
info.getInfo(function(error, result){ if(!error) { $("#info").html(result[0]+' ('+result[1]+' years old)'); console.log(result); } else console.error(error); }); $("#button").click(function() { info.setInfo($("#name").val(), $("#age").val()); });
以上的代碼就簡(jiǎn)單地實(shí)現(xiàn)了對(duì)合約中兩個(gè)函數(shù)的調(diào)用,分別讀取和顯示name
和age
變量。
到此我們就完成了全部的代碼,完整代碼可以在 InfoContract 中找到。在瀏覽器中打開(kāi)index.html
測(cè)試效果如下圖(輸入名字和年齡后刷新)。
本文的作者是蓋蓋,他的微信公眾號(hào): chainlab
☛ 深入淺出區(qū)塊鏈 - 系統(tǒng)學(xué)習(xí)區(qū)塊鏈,打造最好的區(qū)塊鏈技術(shù)博客。
posted @ 2019-12-21 14:46 狼愛(ài)上貍 閱讀(186) | 評(píng)論 (0) | 編輯 收藏
posted @ 2019-12-21 10:14 狼愛(ài)上貍 閱讀(131) | 評(píng)論 (0) | 編輯 收藏