usecase区块链
Ⅰ 我如何三种思维方式巧妙搞定雅思口语话题:科技和互联
文章:我如何三种思维方式巧妙搞定雅思口语话题:科技和互联网
据说都是智商和情商双高哦
——对比——
Old and Young
Do old people in your country like to use apps?Are children allowed to use mobile phones in your country? How to teach older generation to use new technology?Do children like to play with toys or computer games nowadays?Is it necessary for teenagers to learn to use computers?
Paper and Electronic Versions
Do you usually write by hand or write using a computer (typewriter or word-processor)? Do you think computers might one day replace handwriting?
Gender and Place
Do you agree that men are more obsessed with new technology than women? Is there any difference between technology in cities and in small towns?
Examiner: So, any idea?
我大概会应声倒地,直接被抬出考场
Fall to the ground and get a large bump on my forehead
Be carried/lifted out of the examination room
—不慌,鸽婆给你三道锦囊妙计—
a secret master plan, instructions for dealing with an emergency, wise counsel
NO.1 泔水汤
—坦白承认你的无知—
Admit: no hands-on experience with it
不知者无罪
Take a bit of time to gather your thoughts and make sure you don’t blurt out anything that gives away that you’re—well, completely stumped.
Think Aloud:fill up any empty airspace with words to avoid awkward silences
Great question. I’m just not familiar enough with XYZ to hazard a guess.
Hmm…that’s a great question. Let me think about that.
Your question raises a great point. That’s one of the several things I just don’t know about.
事出皆有因
Honestly, I know little about it. Here's why.
因为我虽然崇敬爱因斯坦、牛顿和爱迪生
Einstein, Newton, Edison
但是一点不懂高科技和互联网
虽说手机不离手喜欢3D电影玩过虚拟现实
addictive, irresistible, get hooked; 3D movies; virtual reality
但不会打游戏没见过时光机不会科技创新
谈谈小生活
Here’s what I can tell you
偶尔浏览果壳网、科学美国人、经济学人:
Guokr, Scientific American, The Economist
苹果小米华为OPPO三星魅族荣耀
Apple, Samsung, Nokia, Honor, BlackBerry, Lenovo
支付宝、淘宝、知乎、邮箱、微信
课堂讲座电视上学过:
第一次工业革命,推进蒸汽时代
Instrial Revolution, inaugurated the Age ofSteam
第二次工业革命,步入电气时代
the Age of Electricity
第三次科技革命,来到信息时代
Scientific Revolution, Information Age/era
编程、大数据、人工智能、赛博经济
programming, big data, artificial intelligence, cybereconomy
bitcoin, block chain, information encryption, quantum communication
新材料、煤炭清洁、空气净化
new materials, coal cleaning, air purification
干细胞、代孕、转基因、抗虫棉、人造血液
stem cells, surrogate, transgenic, insect resistant cotton, artificial blood
核能汽车、核能手表、弹道导弹
a nuclear car/watch, ballistic missile
创新链、产业链和资本链
Innovation/instrial/capital chain
深空深海深地网络空间安全和国防科技
Deep space/sea/land, cyberspace security, defense technology
逻辑推导:What, How, Why
NO.2 百味汤
—思辨性理论分析Critical Thinking—
A. 马斯洛需求层次理论
Maslow's Hierarchy of Needs
从对食物的需求过渡到互联网信息科技时代
对健康、安全、娱乐、爱和价值
对知识产权保护等更高级的需要
1.Biological and physiological needs- air, food, drink, shelter, warmth, sex, sleep.
2.Safety needs- protection from elements, security, order, law, stability, freedom from fear.
3.Love and belongingness needs- friendship, intimacy, trust, and acceptance, receiving and giving affection and love. Affiliating, being part of a group (family, friends, work).
4.Esteem needs- (i) esteem for oneself (dignity, achievement, mastery, independence) and (ii) the desire for reputation or respect from others (e.g., status, prestige). The need for respect or reputation is most important for children and adolescents and precedes real self-esteem or dignity.
5.Cognitive needs- knowledge and understanding, curiosity, exploration, need for meaning and predictability.
6.Aesthetic needs- appreciation and search for beauty, balance, form, etc.
7.Self-actualization needs- realizing personal potential, self-fulfillment, seeking personal growth and peak experiences. A desire “to become everything one is capable of becoming”.
8.Transcendence needs- A person is motivated by values which transcend beyond the personal self (e.g., mystical experiences and certain experiences with nature, aesthetic experiences, sexual experiences, service to others, the pursuit of science, religious faith, etc.).
*simplypsychology.org/maslow
B. 全球化与殖民主义:主流文化入侵
Post-colonialism & Cultural Imperialism
Impact on Global Communication
从互联网到全球联系的增强
从科技和文化霸权看帝国殖民
从创新发展到本土文化的逐渐模糊与丧失
宗教、语言、民俗的趋同
Cultural Imperialism: the extension of influence or dominance of one nation’s culture over others, through the exportation of cultural commodities.
Global communication: the communication practice occurring across national borders, social, political, and cultural divides. The need for global communication has increased e to the expanse of globalisation.
The World Systems Theory: an inter-regional and transnational division of labour with core, periphery, and semi-periphery countries.
In its conquest of Italy, the Roman Empire imposed Latin on the people of Etruria, replacing the Etruscan language, which ultimately led tothe demise of the language and other aspects of the Etruscan culture. Then, Latin was the lingua franca and today English isthe lingua franca of global communication
The expansion of the British Empire ring the eighteenth and nineteenth centuries: cultural form of imperialism, throughreligious proselytising, i.e. the imposition of Christianity on cultures with other religions.The British Empire also exerted its cultural power throughimposing ecational material on the colonies, promoting the empire through books and syllabuses, serving the interest of colonialism.
The assimilation of media:literature, film, television, Internet, and music.
US media and entertainment instries, like Hollywood and Disney, are able topenetrate the global market and export US-American cultural procts and values.
*linkedin.com/pulse/critical-examination-cultural-imperialism-its-impact-global-drysén/
C. 资本主义、信息共享与互联网
Capitalism and the Internet
资本主义剥削形式、人们工作方式的转变
new way to exploit the working class
without having to work in factories
时长加长,无形的工作与生产
more time investment, longer exploitation
enhance possibilities to enjoy their work
give rise to a new proletarian identity
eventual confrontation with capital owner
Internet is just the development of past ways of entertainment, communication and knowledge (games, libraries, letters, books, etc.) which helped spread ecation and information throughout society andlower classes as they became more and more reachable and affordable, whilst also,especially in the case of entertainment, alienating people from their nature (workers- not in a bad connotation).
New technology hastranscended the standard capitalist business model.
Intangible, conceptual assets: a large part of corporate wealth, likeintellectual property, trademarks, patents and right. Microsoft is not valued principally in physical capital assets, as was the case with big corporations in the past. What Microsoft claims to own isideas, ideas that we all need to run factories and offices and to communicate with each other.
As Thomas Jefferson put it,passing light on to another candle does not diminish the light from your own. Jefferson thought this was a good enough reason whyideas should not be treated like coal, candles and other commodities, but should be allowed to circulate freely for the common good.
*marxist.com/capitalism-internet-patents130306
*quora.com/What-would-Karl-Marx-think-about-the-internet
D. 科技创新和女权主义
Technology and Gender Gap
技术教育不足,科技行业需要却鲜有女性
男性主导、敌意的工作环境,高离职率低薪
Women have been left out of the mainstream of recorded technological development. Technology, increasingly so in instrialized societies, is male.
A feminist perspective can help us move from a hard technology society to a soft technology future in which values such asharmony with nature, subjectivity, co-operation, and non-exploitationbecome integral to technological development.
In the 1980s, women made up a little under40 percent of computer-science graates.Since then, the gender gap has grown: Currently, less than 20 percent of computer-science graates are women. In the earliest days of programming, ring World War II, building computers was deemed a macho thing, and programming was thought to be for typists. Later, when personal computers began to appear in homes and offices, they were promoted as apastime -- for boys.Contemporary bro culture has done nothing to attack this bias.
School should expand thefemale facultyand make thecurriculummore inviting to talented students withlimited exposure to computer science: assign classes according to students' past programming experience -- to prevent long-time enthusiasts fromintimidating novices.
bloomberg.com/view/articles/2017-09-06/how-to-close-the-gender-gap-in-tech
The tech instry's gender imbalance is no secret – only 17% of technology specific jobs are held by women.Projects to counter the problem, from conferences to mentorship programmes, are becoming widespread but are usually aimed at women already embarking on careers.
From toys to language, teaching girls basic skills and busting gender myths from an early age could encourage more women into tech careers.
theguardian.com/careers/2017/dec/01/closing-the-tech-gender-gap-starts-in-childhood
NO.3 人参汤
—熟悉互联网双刃剑的常见论点—
Ⅱ 软件开发方法
1:瀑布方法
所有软件方法的祖先是瀑布方法(waterfall methodology)。它之所以被称为瀑布方法是因为开发模块相互之间的依次流动,瀑布方法通过控制阀门的一系列活动组成。这些控制阀门决定一个给定的活动是否已经完成并且可以进入下一个活动。需求阶段处理决定了所有的软件需求。设计阶段决定整个系统的设计。代码在代码阶段编写。代码然后被测试。最后产品被发布。
对瀑布方法模型最基本的批评就是瀑布方法对于反馈事物发展状况耗时太长。软件的一些内容那个很容易被理解,而另一些内容则相反。因此,当用户对于手边出现的问题都没有很好理解的时候,开发人员试图先完成所有的需求(也就是说,将需求量化到实际的规格说明当中)是非常空难的。更进一步来说,如果在需求中出现一个错误,它将传播到设计阶段,传播到代码中等。同时一般不存在过程中返回的真正能力。因此,如果进入测试并且发现设计的一部分是无法工作的,那么就会进行修改并修补问题而交差,但是这种方法将会失去设计活动的所有上下文环境——你只是有目的地对系统权宜行事!
认识到这个问题后瀑布方法已经被修改成几种形式。例如螺旋式瀑布方法它继承并使用了多个瀑布模型。这种方法缩短了生命周期向下的时间;也就是说,为解决为题提供了迭代方案。
最终,大家无法脱离瀑布方法是因为它确实是合乎常规的方法。首先,这种方法可以决定将要构建的内容。接着,决定将要如何构建这些,下一步,世界构建这些内容。可以确保自己确实构建自己所需的东西(并且可以成功运行)。
2:统一过程
统一过程应用了基于处理系统首先考虑的最重要方面而实施的短期迭代开发。
开发一个寡欲各种用列(use case)的调查文档(也就是说,对用户与系统交互的简短描述),并且开始排除那些可能对整个系统成功造成风险的用列。只要适合,就可以在开发过程中添加或者删除用列。
统一过程的4个阶段定义如下:
初始(inception):系统仍然处于决定系统内容的阶段——系统将要完成什么以及系统的边界是什么。如果系统能够很好的理解,那么这个阶段就非常短。
细化(Elaboration):正在将体系结构的风险移至系统。一种表述该阶段的说法是,“你是否已经解决了所有难题?”或者“你知道如何完成你将要去完成的事情吗?”
构造(Construction)正在完成所有相关的用列来使系统为移交做好准备,也就是说,进入Beta版本。
移交(Transition)使系统通过它的最后发布阶段以及Beta版本。它可能包括软件的操作及维护。
这是一个关注于维护要素的敏捷过程,但是仍然采用了大量用例开发,间模等方面的传统实践。
3:极限编程:
极限编程的开发过程就是以代码为中心的方法。
让用户告知你一些有关系统是如何如用转的故事描述,基于故事相互之间的重要性来定制这些系统这样就可以为自己的团队提供一个故事集合,可以在一个给定的迭代中完成他们,大约两周时间——每周工作40个小时,你将团队划分,双人应付没一个故事,在代码被编写时提供确定数量的内建对等评审。你和你的同伴在编写自己代码的同时编写单元测试。在完成自己负责的那段代码后,将其拿到集成的机器上,放入代码基线,运行从所有人的代码中积累而成的单元测试。在完成iji负责的那段代码后,将会提供一个运行系统使用户可以评审来确保自己的工作满足他们的需要。
注意极限编程并没有将软件的设计设置成一个高级阶段。相反它认为那些最前端的设计对于整个系统开发不是很有帮助,并且随着实际开发的进行它最终还是被修改。
极限编程对于需要持续提供运行系统的软件卡发来说非常适用。当缺少用户介入或者项目规模很大时极限编程方法将会不好用,因为这时协调和设计活动实际上变得更重要了。
极限编程合理地考虑开发团体的能力,这样可以有效计划。
Ⅲ 如何用JavaScript实现区块链
<span style="font-family:Arial, Helvetica, sans-serif;">'use strict';</span>var CryptoJS = require("crypto-js");var express = require("express");var bodyParser = require('body-parser');var WebSocket = require("ws");var http_port = process.env.HTTP_PORT || 3001;var p2p_port = process.env.P2P_PORT || 6001;var initialPeers = process.env.PEERS ? process.env.PEERS.split(',') : [];class Block { constructor(index, previousHash, timestamp, data, hash) { this.index = index; this.previousHash = previousHash.toString(); this.timestamp = timestamp; this.data = data; this.hash = hash.toString(); }}var sockets = [];var MessageType = { QUERY_LATEST: 0, QUERY_ALL: 1, RESPONSE_BLOCKCHAIN: 2};var getGenesisBlock = () => { return new Block(0, "0", 1465154705, "my genesis block!!", "");};var blockchain = [getGenesisBlock()];var initHttpServer = () => { var app = express(); app.use(bodyParser.json()); app.get('/blocks', (req, res) => res.send(JSON.stringify(blockchain))); app.post('/mineBlock', (req, res) => { var newBlock = generateNextBlock(req.body.data); addBlock(newBlock); broadcast(responseLatestMsg()); console.log('block added: ' + JSON.stringify(newBlock)); res.send(); }); app.get('/peers', (req, res) => { res.send(sockets.map(s => s._socket.remoteAddress + ':' + s._socket.remotePort)); }); app.post('/addPeer', (req, res) => { connectToPeers([req.body.peer]); res.send(); }); app.listen(http_port, () => console.log('Listening http on port: ' + http_port));};var initP2PServer = () => { var server = new WebSocket.Server({port: p2p_port}); server.on('connection', ws => initConnection(ws)); console.log('listening websocket p2p port on: ' + p2p_port);};var initConnection = (ws) => { sockets.push(ws); initMessageHandler(ws); initErrorHandler(ws); write(ws, queryChainLengthMsg());};var initMessageHandler = (ws) => { ws.on('message', (data) => { var message = JSON.parse(data); console.log('Received message' + JSON.stringify(message)); switch (message.type) { case MessageType.QUERY_LATEST: write(ws, responseLatestMsg()); break; case MessageType.QUERY_ALL: write(ws, responseChainMsg()); break; case MessageType.RESPONSE_BLOCKCHAIN: handleBlockchainResponse(message); break; } });};var initErrorHandler = (ws) => { var closeConnection = (ws) => { console.log('connection failed to peer: ' + ws.url); sockets.splice(sockets.indexOf(ws), 1); }; ws.on('close', () => closeConnection(ws)); ws.on('error', () => closeConnection(ws));};var generateNextBlock = (blockData) => { var previousBlock = getLatestBlock(); var nextIndex = previousBlock.index + 1; var nextTimestamp = new Date().getTime() / 1000; var nextHash = calculateHash(nextIndex, previousBlock.hash, nextTimestamp, blockData); return new Block(nextIndex, previousBlock.hash, nextTimestamp, blockData, nextHash);};var calculateHashForBlock = (block) => { return calculateHash(block.index, block.previousHash, block.timestamp, block.data);};var calculateHash = (index, previousHash, timestamp, data) => { return CryptoJS.SHA256(index + previousHash + timestamp + data).toString();};var addBlock = (newBlock) => { if (isValidNewBlock(newBlock, getLatestBlock())) { blockchain.push(newBlock); }};var isValidNewBlock = (newBlock, previousBlock) => { if (previousBlock.index + 1 !== newBlock.index) { console.log('invalid index'); return false; } else if (previousBlock.hash !== newBlock.previousHash) { console.log('invalid previoushash'); return false; } else if (calculateHashForBlock(newBlock) !== newBlock.hash) { console.log(typeof (newBlock.hash) + ' ' + typeof calculateHashForBlock(newBlock)); console.log('invalid hash: ' + calculateHashForBlock(newBlock) + ' ' + newBlock.hash); return false; } return true;};var connectToPeers = (newPeers) => { newPeers.forEach((peer) => { var ws = new WebSocket(peer); ws.on('open', () => initConnection(ws)); ws.on('error', () => { console.log('connection failed') }); });};var handleBlockchainResponse = (message) => { var receivedBlocks = JSON.parse(message.data).sort((b1, b2) => (b1.index - b2.index)); var latestBlockReceived = receivedBlocks[receivedBlocks.length - 1]; var latestBlockHeld = getLatestBlock(); if (latestBlockReceived.index > latestBlockHeld.index) { console.log('blockchain possibly behind. We got: ' + latestBlockHeld.index + ' Peer got: ' + latestBlockReceived.index); if (latestBlockHeld.hash === latestBlockReceived.previousHash) { console.log("We can append the received block to our chain"); blockchain.push(latestBlockReceived); broadcast(responseLatestMsg()); } else if (receivedBlocks.length === 1) { console.log("We have to query the chain from our peer"); broadcast(queryAllMsg()); } else { console.log("Received blockchain is longer than current blockchain"); replaceChain(receivedBlocks); } } else { console.log('received blockchain is not longer than received blockchain. Do nothing'); }};var replaceChain = (newBlocks) => { if (isValidChain(newBlocks) && newBlocks.length > blockchain.length) { console.log('Received blockchain is valid. Replacing current blockchain with received blockchain'); blockchain = newBlocks; broadcast(responseLatestMsg()); } else { console.log('Received blockchain invalid'); }};var isValidChain = (blockchainToValidate) => { if (JSON.stringify(blockchainToValidate[0]) !== JSON.stringify(getGenesisBlock())) { return false; } var tempBlocks = [blockchainToValidate[0]]; for (var i = 1; i < blockchainToValidate.length; i++) { if (isValidNewBlock(blockchainToValidate[i], tempBlocks[i - 1])) { tempBlocks.push(blockchainToValidate[i]); } else { return false; } } return true;};var getLatestBlock = () => blockchain[blockchain.length - 1];var queryChainLengthMsg = () => ({'type': MessageType.QUERY_LATEST});var queryAllMsg = () => ({'type': MessageType.QUERY_ALL});var responseChainMsg = () =>({ 'type': MessageType.RESPONSE_BLOCKCHAIN, 'data': JSON.stringify(blockchain)});var responseLatestMsg = () => ({ 'type': MessageType.RESPONSE_BLOCKCHAIN, 'data': JSON.stringify([getLatestBlock()])});var write = (ws, message) => ws.send(JSON.stringify(message));var broadcast = (message) => sockets.forEach(socket => write(socket, message));connectToPeers(initialPeers);initHttpServer();initP2PServer();