关于html:a标签实用功能
a标签实用功能唤醒拨号性能<a href="tel: 123">123</a> 唤出发送邮件<a href="mailto: 100@qq.com">发送邮件</a> 会唤醒默认邮箱 唤出发送短信<a href="sms: 189">发送短信</a>
a标签实用功能唤醒拨号性能<a href="tel: 123">123</a> 唤出发送邮件<a href="mailto: 100@qq.com">发送邮件</a> 会唤醒默认邮箱 唤出发送短信<a href="sms: 189">发送短信</a>
成果如如下: 源码如下,间接复制保留为 html 文件即可预览: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head><body><canvas id="canvas" width="300" height="300"> <p>道歉,您的浏览器不反对canvas</p> </canvas> <script> /** * 生成环形进度条 */ function toCanvas(id, color, progress) { //canvas进度条 var canvas = document.getElementById(id), ctx = canvas.getContext("2d"), percent = progress, //最终百分比 circleX = canvas.width / 2, //核心x坐标 circleY = canvas.height / 2, //核心y坐标 radius = 80, //圆环半径 cradius = 75, // canvas半径 lineWidth = 6, //圆形线条的宽度 fontSize = 20; //字体大小 //两端圆点 // function smallcircle1(cx, cy, r) { // ctx.beginPath(); // //ctx.moveTo(cx + r, cy); // ctx.lineWidth = 1; // ctx.fillStyle = '#06a8f3'; // ctx.arc(cx, cy, r, 0, Math.PI * 2); // ctx.fill(); // } // function smallcircle2(cx, cy, r) { // ctx.beginPath(); // //ctx.moveTo(cx + r, cy); // ctx.lineWidth = 1; // ctx.fillStyle = '#fff'; // ctx.arc(cx, cy, r, 0, Math.PI * 2); // ctx.fill(); // } //画圆 function circle(cx, cy, r, sAngle, eAngle, bColor = '#eee') { ctx.beginPath(); //ctx.moveTo(cx + r, cy); ctx.lineWidth = lineWidth; ctx.strokeStyle = bColor; // ctx.lineCap = 'round'; // ctx.arc(cx, cy, r, Math.PI * 1, Math.PI * 2); ctx.arc(cx, cy, r, sAngle, eAngle); ctx.stroke(); } //画弧线 function sector(cx, cy, r, startAngle, endAngle, _lineWidth) { ctx.beginPath(); //ctx.moveTo(cx, cy + r); // 从圆形底部开始画 ctx.lineWidth = _lineWidth; // 渐变色 - 可自定义 // var linGrad = ctx.createLinearGradient( // circleX-radius-lineWidth, circleY, circleX+radius+lineWidth, circleY // ); // linGrad.addColorStop(0.0, '#06a8f3'); // //linGrad.addColorStop(0.5, '#9bc4eb'); // linGrad.addColorStop(1.0, '#00f8bb'); // ctx.strokeStyle = linGrad; // 进度条色彩 ctx.strokeStyle = color; //圆弧两端的款式 // ctx.lineCap = 'round'; //圆弧 ctx.arc( cx, cy, r, startAngle, (Math.PI * (1.5 - ((1.5 / 100) * process))), true ); ctx.stroke(); } //刷新 function loading() { if (process >= percent) { clearInterval(circleLoading); } //革除canvas内容 ctx.clearRect(0, 0, circleX * 2, circleY * 2); //两头的字 ctx.font = fontSize + 'px April'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillStyle = '#999'; ctx.fillText(parseFloat(process).toFixed(0) + '%', circleX, circleY - 10); ctx.font = (fontSize - 4) + 'px April'; ctx.fillStyle = '##a7a7a7'; ctx.fillText('平安', circleX, circleY + 20); circle(circleX, circleY, radius + 14, 0, Math.PI * 2, '#e1f7f3'); //圆形 circle(circleX, circleY, radius, 0, Math.PI * 1.5, '#6bd8b3'); //圆弧 sector(circleX, circleY, radius-8, Math.PI * 1.5, 0, lineWidth * 2); //两端圆点 // smallcircle1(cradius + Math.cos(2 * Math.PI / 360 * 120) * radius, cradius + Math.sin(2 * Math.PI / 360 * 120) * // radius, 0); // smallcircle2(cradius + Math.cos(2 * Math.PI / 360 * (120 + process * 3)) * radius, cradius + Math.sin(2 * Math.PI / // 360 * (120 + process * 3)) * radius, 2); //管制完结时动画的速度 if (process / percent > 0.90) { process += 0.30; } else if (process / percent > 0.80) { process += 0.55; } else if (process / percent > 0.70) { process += 0.75; } else { process += 1.0; } } var process = 0.0; //进度 var circleLoading = window.setInterval(function() { loading(); console.log(11) }, 20); // loading(); } toCanvas('canvas','#6bd8b3', 32); </script></body></html>
--确认集群以后状态 crsctl check crs crs_stat -t --敞开集群以后服务 srvctl stop database -d raw srvctl stop asm -n s1-11g srvctl stop asm -n s2-11g srvctl stop nodeapps -n s1-11g srvctl stop nodeapps -n s2-11g --查看以后配置: [grids1-11g oracle]# oifcfg getif -global eth0 192.168.72.0 global public eth1 10.0.0.0 global cluster_interconnect --删除以后配置 [grids1-11g oracle]# oifcfg delif -global eth0 [grids1-11g oracle]# oifcfg delif -global eth1 [grids1-11g oracle]# oifcfg getif --从新增加 [grids1-11g oracle]# oifcfg setif -global eth0/192.168.200.0:public [grids1-11g oracle]# oifcfg setif -global eth1/11.11.11.0:cluster_interconnect [grids1-11g oracle]# oifcfg getif eth0 192.168.200.0 global public eth1 11.0.0.0 global cluster_interconnect ...
指标 追踪上面一段代码的流程: AnnotationConfigApplicationContextDemo /** * description * date 2021-06-30 11:21 **/public class AnnotationConfigApplicationContextDemo { public static void main(String[] args) { final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(SimpleConfig.class); User user = applicationContext.getBean(User.class); System.out.println("user:" + user);}}Configurationpublic class SimpleConfig { Beanpublic User user(){ return new User("xgimi", 10);}}public class User { private String name;private Integer age; ... 流程 外围逻辑都在AnnotationConfigApplicationContext的带参结构器中: public AnnotationConfigApplicationContext(Class<?>... componentClasses) { this(); register(componentClasses); refresh();}空结构器做了什么 先说答案: 两个事件,一是创立了BedefinitionReader、BeanDefinitionScanner,提供了扫描BeanDefinition的能力; 二是通过父类GenericApplicationContext的结构器创立了DefaultListableBeanFactory,提供底层的IOC能力。 初始化AnnotatedBeanDefinitionReader public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry) { //注入registry,并且初始化Environment对象 this(registry, getOrCreateEnvironment(registry));}提供注册beanDefinition的能力 public AnnotationConfigApplicationContext() { StartupStep createAnnotatedBeanDefReader = this.getApplicationStartup().start("spring.context.annotated-bean-reader.create"); this.reader = new AnnotatedBeanDefinitionReader(this); createAnnotatedBeanDefReader.end(); this.scanner = new ClassPathBeanDefinitionScanner(this);}咱们会在前面探索BeanDefinitionRegistry注册BeanDefinition的实质 获取环境对象 getOrCreateEnvironment这个办法进行页游的外部环境的创立并获取: private static Environment getOrCreateEnvironment(BeanDefinitionRegistry registry) { Assert.notNull(registry, "BeanDefinitionRegistry must not be null"); if (registry instanceof EnvironmentCapable) { return ((EnvironmentCapable) registry).getEnvironment(); } return new StandardEnvironment();}环境对象中蕴含了零碎环境变量,自定义属性等内容。 通过结构器能够看到,AnnotatedBeanDefinitwww.sangpi.comionReader底层保护了一个BeanDefinitionRegistry。实际上,他就是通过BeanDefinitionRegistry提供的注册能力,而AnnotationConfigApplicationContext自身就是一个BeanDefinitionRegistry;所以在调用AnnotatedBeanDefinitionReader结构器时,咱们传入的就是AnnotationConfigApplicationContext: 实际上是组合关系,AnnotationConfigApplicationContext中大部分的能力,包含注册beanDefinition,依赖查找,依赖注入,都是通过DefaultListableBeanFactory通过的底层能力反对。 如何将配置类注册为BeanDefinition 在AnnotationConfigApplicationContext中: ...
数据类型 计算机顾名思义就是能够做数学计算的机器,因而,计算机程序天经地义地能够解决各种数值。然而,计算机能解决的远不止数值,还能够解决文本、图形、音频、视频、网页等各种各样的数据,不同的数据,须要定义不同的数据类型。在Python中,可能间接解决的数据类型有以下几种: 小编举荐一个学python的学习老师围鑫(同音),前边一组是:mengy ,后边一组是:7762,把以上两组字母依照先后顺序组合起来即可,她会安顿学习的。,无论你是大牛还是小白,是想转行还是想入行都能够来理解一起提高一起学习!裙内有开发工具,很多干货和技术材料分享! 整数 Python能够解决任意大小的整数,当然包含负整数,在程序中的示意办法和数学上的写法截然不同,例如:1,100,-8080,0,等等。 计算机因为应用二进制,所以,有时候用十六进制示意整数比拟不便,十六进制用0x前缀和0-9,a-f示意,例如:0xff00,0xa5b4c3d2,等等。 浮点数 浮点数也就是小数,之所以称为浮点数,是因为依照迷信记数法示意时,一个浮点数的小数点地位是可变的,比方,1.23x109和12.3x108是相等的。浮点数能够用数学写法,如1.23,3.14,-9.01,等等。然而对于很大或很小的浮点数,就必须用迷信计数法示意,把10用e代替,1.23x109就是1.23e9,或者12.3e8,0.000012能够写成1.2e-5,等等。 小编举荐一个学python的学习老师围鑫(同音),前边一组是:mengy ,后边一组是:7762,把以上两组字母依照先后顺序组合起来即可,她会安顿学习的。,无论你是大牛还是小白,是想转行还是想入行都能够来理解一起提高一起学习!裙内有开发工具,很多干货和技术材料分享! 整数和浮点数在计算机外部存储的形式是不同的,整数运算永远是准确的(除法难道也是准确的?是的!),而浮点数运算则可能会有四舍五入的误差。 字符串 字符串是以''或""括起来的任意文本,比方 'abc' , "xyz" 等等。请留神,''或""自身只是一种示意形式,不是字符串的一部分,因而,字符串 'abc' 只有 a , b , c 这3个字符。如果 ' 自身也是一个字符,那就能够用""括起来,比方 "I'm OK" 蕴含的字符是 I , ' , m ,空格, O , K 这6个字符。 如果字符串外部既蕴含 ' 又蕴含 " 怎么办?能够用转义字符 \ 来标识,比方: <pre>'I\'m \"OK\"!'</pre> 示意的字符串内容是: <pre>I'm "OK"!</pre> 转义字符 \ 能够本义很多字符,比方 \n 示意换行, \t 示意制表符,字符 \ 自身也要本义,所以 \ 示意的字符就是 \ ,能够在Python的交互式命令行用print打印字符串看看: <pre>>>> print 'I\'m ok.'I'm ok.</pre> ...
Python 是一门更重视可读性和效率的语言,尤其是相较于 Java,PHP 以及 C 这样的语言,它的这两个劣势让其在开发者中大受欢迎。Python是一门优良的语言,它能让你在短时间内通过极少量代码就能实现许多操作。不仅如此,它还轻松反对多任务处理,比方多过程。 对这方面感兴趣,想要学习python或者想要理解python能够加伪:mengy7762 不喜爱Python的人常常会吐嘈Python运行太慢。然而,事实并非如此。尝试以下六个诀窍,来为你的Python利用提速。 诀窍一:要害代码应用内部性能包 Python简化了许多编程工作,然而对于一些工夫敏感的工作,它的体现常常不尽人意。应用C/C++或机器语言的内部性能包解决工夫敏感工作,能够无效进步利用的运行效率。这些性能包往往依附于特定的平台,因而你要依据本人所用的平台抉择适合的性能包。简而言之,这个诀窍要你就义利用的可移植性以换取只有通过对底层主机的间接编程能力取得的运行效率。以下是一些你能够抉择用来晋升效率的性能包: CythonPylnlnePyPyPyrex这些性能包的用途各有不同。比如说,应用C语言的数据类型,能够使波及内存操作的工作更高效或者更直观。Pyrex就能帮忙Python延展出这样的性能。Pylnline能使你在Python利用中间接应用C代码。内联代码是独立编译的,然而它把所有编译文件都保留在某处,并能充分利用C语言提供的高效率。 诀窍二:在排序时应用键 Python含有许多古老的排序规定,这些规定在你创立定制的排序办法时会占用很多工夫,而这些排序办法运行时也会迁延程序理论的运行速度。最佳的排序办法其实是尽可能多地应用键和内置的sort()办法。譬如,拿上面的代码来说: importoperator somelist = [(1,5,8),(6,2,4),(9,7,5)] somelist.sort(key=operator.itemgetter(0)) somelist Output = [(1, 5, 8), (6, 2, 4), (9, 7, 5)]somelist.sort(key=operator.itemgetter(1)) somelist Output = [(6, 2, 4), (1, 5, 8), (9, 7, 5)]somelist.sort(key=operator.itemgetter(2)) somelist Output = [(6, 2, 4), (9, 7, 5), (1, 5, 8)],在每段例子里,list都是依据你抉择的用作要害参数的索引进行排序的。这个办法不仅对数值类型无效,还同样实用于字符串类型。 诀窍三:针对循环的优化 每一种编程语言都强调最优化的循环计划。当应用Python时,你能够借助丰盛的技巧让循环程序跑得更快。然而,开发者们常常忘记的一个技巧是:尽量避免在循环中拜访变量的属性。譬如,拿上面的代码来说: lowerlist = ['this','is','lowercase'] upper = str.upper upperlist = [] append = upperlist.append ...
数据库,OS和磁盘读写的根本单位是块,也能够称之为(page size) block size。 数据库的块个别为8k,16k; OS的块则个别为4K; IO块更小,linux 内核要求IO block size <= OS block size. 磁盘IO除了IO block size , 还有扇区的概念(IO sector), 扇区是磁盘物理操作的根本单位, 而IO 块是磁盘操作的逻辑单位,一个IO块对应一个或多个扇区,扇区大小个别为512字节。 所以各个块大小的关系如下: DB block > OS Block >= IO Block> Disk Block ,而且他们之间放弃着整数倍的关系。比方DB 以mysql 为例, OS 以linux 为例: DB block size mysql> show variables like 'innodb_page_size'; | Variable_name | Value | | innodb_page_size | 16384 | 1 row in set (0.01 sec) OS block size IO block size Sector size ...
查问缓存设置1) 验证服务器是否反对查问缓存 show variables like '%have_query_cache%'; | Variable_name | Value | | have_query_cache | YES | 2) 查问缓存会受到以下3个零碎变量值的影响 show variables like 'query_cache%'; | Variable_name | Value | | query_cache_limit | 1048576 | //可能缓存的最大后果集大小 | query_cache_min_res_unit | 4096 | | query_cache_size | 1048576 | //决定为查问缓存调配的内存大小 | query_cache_type | OFF | //决定查问缓存的操作形式 | query_cache_wlock_invalidate | OFF | 那么mysql到底是怎么决定到底要不要把查问后果放到查问缓存中呢?是依据query_cache_type这个变量来决定的。 这个变量有三个取值:0,1,2,别离代表了off、on、demand。 mysql默认为开启 on (1) 如果是0,那么query cache 是敞开的。 如果是1,那么查问总是先到查问缓存中查找,即便应用了sql_no_cache依然查问缓存,因为sql_no_cache只是不缓存查问后果,而不是不应用查问后果。 如果是2,DEMAND没有应用sql_cache,如同依然应用了查问缓存 论断:只有query_cache_type没有敞开,sql查问总是会应用查问缓存,如果缓存没有命中则开始查问的执行打算到表中查问数据。 sql_cahce和sql_no_cache hints的应用为了测试sql语句的效率,有时候要不必缓存来查问。 应用SELECT SQL_NO_CACHE ...语法即可 SQL_NO_CACHE的真正作用是禁止缓存查问后果,但并不意味着cache不作为后果返回给query。 目前的SQL_NO_CACHE有两种解释: 1.对以后query不应用手游数据库已有缓存来查问,则以后query破费工夫会多点 ...
元编程就是指以操作指标为程序自身的行为个性的编程,而在ES6中减少了类型symbol,除了自定义的符号之外,还预约义了其余的一些内置符号,能够被称为内置符号。上面就来给大家介绍一下这些内置符号。 1. Symbol.iterator 这个符号示意任意对象上的一个专门的属性,语言机制会主动的在这个属性上寻找一个办法,这个办法会结构一个迭代器来耗费这个对象的值。… 开展和 for…of 循环会主动应用它。 咱们也能够通过自定义 Symbol.iterator 属性为任意对象值定义本人的迭代器逻辑,它将笼罩默认的迭代器。咱们相当于是定义了一种元编程的行为,提供给JavaScript其余局部(也就是运算符和循环构造)在解决定义的对象时应用。 2. Symbol.toStringTag 与 Symbol.hasInstance 在日常逻辑中经常出现的一个场景,判断一个值是什么类型,通常应用的是 toString() 和 instanceof 。 当初 ES6 中,能够定义这些操作的行为个性了。通过以上案例咱们能够看出页游的符号组: toStringTag 符号指定了在 字符串化时应用的字符串值。 hasInstance 符号是在结构器函数上的一个办法,承受实例对象值,通过返回 true 或者 false 来显示这个值是否能够被认为是一个实例。 在 Function.prototype 上 hasInstance 默认的页游www.pizei.com writable 是 false,不可写入。能够通过 Object.defineProperty() 来绕开它。 3. Symbol.species 这个符号管制要生成新的实例时,类的内置办法应用哪一个结构器。 内置原生结构器 Symbol.species 的默认行为是 return this 。 如果要定义生成新的实例的办法,应用new this.constructorSymbol.species ,而后继承的类就能够依据它来管制由哪个结构器来产生这些实例。 4. Symbol.toPrimitive 在ES6之前,对象为了某个操作(例如相加 + 或比拟 == )必须强制转换为原生类型时,是无法控制该行为的 ,当初能够通过Symbol.toPrimitive这个符号来管制这个行为。 Symbol.toPrimitive 办法依据调用 ToPrimitive 的运算冀望的类型,会提供一个类型(type) 指定 "string"、"number" 或 "default"。 以上就是es6 symbol的介绍了,心愿能帮到大家。
这片文章中会总结一下与a.equals(b)的区别,而后对源码做一个小剖析。 一,值是null的状况: a.equals(b), a 是null, 抛出NullPointException异样。a.equals(b), a不是null, b是null, 返回falseObjects.equals(a, b)比拟时, 若a 和 b 都是null, 则返回 true, 如果a 和 b 其中一个是null, 另一个不是null, 则返回false。留神:不会抛出空指针异样。null.equals("abc") → 抛出 NullPointerException 异样"abc".equals(null) → 返回 falsenull.equals(null) → 抛出 NullPointerException 异样Objects.equals(null, "abc") → 返回 falseObjects.equals("abc",null) → 返回 falseObjects.equals(null, null) → 返回 true二,值是空字符串的状况:1.a 和 b 如果都是空值字符串:"", 则 a.equals(b), 返回的值是true, 如果a和b其中有一个不是页游内的空值字符串,则返回false; 2.这种状况下 Objects.equals 与状况1 行为统一。 "abc".equals("") → 返回 false"".equals("abc") → 返回 false"".equals("") → 返回 trueObjects.equals("abc", "") → 返回 falseObjects.equals("","abc") → 返回 falseObjects.equals("","") → 返回 true三,源码剖析1.源码//java fhadmin.cnpublic final class Objects { ...
在线HTML转JS/JSON工具在线HTML转JS/JSON工具 本工具反对将HTML转JS/JSON工具,将HTML字符串转成JS的变量模式或JSON数组模式,个别用于JS字符串拼接。 https://tooltt.com/html2js/
1google code曾经汇合了几个JavaScript库,咱们能够从那里加载这些库而不用通过本人的服务器加载。这样的益处是节俭带宽,如果用户拜访过同样加载了这些库的网站后,JavaScript库会缓存在用户端,进步加载速度。 PLAIN TEXTJavaScript: // 加载jQuery google.load("jquery", "1.2.6"); // 本人的代码...<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script> 残缺阐明在此... 2,将匹配选择器元素对象保留在变量中。 尤其在循环体里,上面的做法影响运行效率: PLAIN TEXTJavaScript:var myList = $('.myList');}下面的代码在我的机器上耗时1066毫秒。除非我疯了才会将选择器表白示放在循环体里。应该这样做: JavaScript:for(i = 0; i <1000; i++){}下面的代码耗时只有224毫秒。想要更快还能够这样做: PLAIN TEXTJavaScript:var myListItems = '<ul>'; myListItems+='This www.walajiao.comis list item ' + i;myListItems+='</ul>'; $('myDiv').removeClass('off').addClass('on'); 如果要连贯的办法调用很多,jQuery同样和JavaScript一样能够将游戏代理语句分行书写: PLAIN TEXTJavaScript: .find('TABLE .firstCol').css('background' : 'red')$('#myTable') .css('background','red').find('.lastColumn')$.fn.makeRed = function(){}$('#myTable').find('.firstColumn').makeRed().append('hello'); 6,学会在适当的时候应用动画查看一下jQuery的源代码会发现jQuery库中很弱小的slideDown()和fadeIn()都是调用jQuery自身的animate()办法: PLAIN TEXTJavaScript: return this.animate({height: "show"}, speed, callback);return this.animate({opacity: "show"}, speed, callback);$('#myBox').mouseover(function(){ $(this).animate({"height": 200}, "slow");$('#myBox').mouseover(function(){}); 7,事件委托jQuery比以往更器重元素事件委托,这更能体现unobtrusively(无侵入)准则。在元素上增加太多的事件会升高效率,也不便书写和调试。而事件委托能用较少的代码实现同样的性能。 PLAIN TEXTJavaScript: $(this).css('background', 'red');var $j = jQuery.noConflict();$('#myImage').attr('src', 'image.jpg').load(function(){});运行后如果图片加载结束了,会弹出对话框。这是应用了回调函数。 ...
在线HTML实体转字符串工具在线HTML实体转字符串工具 本工具反对将HTML实体转成字符串或将字符串转成HTML字符实体,实现HTML字符串本义。 https://tooltt.com/html2str/
波及范畴svn,gitlab,github 筹备工作装置svn,git,openssl,idea社区版,jdk1.8 遇到问题1.gitlab,github eval $(ssh-agent -s)ssh-add ~/.ssh/other_id_rsa复制代码编辑 ~/.ssh/config GitLab.com serverHost gitlab.comRSAAuthentication yesIdentityFile ~/.ssh/config/private-key-filename-01 Private GitLab serverHost gitlab.company.comRSAAuthentication yesIdentityFile ~/.ssh/config/private-key-filename复制代码2.svn E120171 E120171手游参考:cd ~/.subverasionwww.diuxie.com/mkdir tmpcd tmpsvn co svn地址输出p(永恒的承受 accept permanently)输出用户名明码复制代码结束之后会下载,间接ctrl+c 退出,这时候问题已解决
主库环境比照充分利用主数据库原来环境,仅量不对主库参数配置做过多的批改。 从新创立口令文件 su - oracle$ orapwd file='/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl' password=oracle entries=10 force=y 批改配置lisener监听文件阐明:增加dgmgrl动态监听配置,为前面的dg broker配置打基础。 $ cat /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.233.200)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)))) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = orcl) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1) (SID_NAME = orcl))(SID_DESC = (GLOBAL_DBNAME = orcl_DGMGRL) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1) (SID_NAME = orcl))) ADR_BASE_LISTENER = /u01/app/oracle 其中的GLOBAL_DBNAME具备固定的格局:<db_unique_name>_DGMGRL.<db_domain>。批改配置tnsname.ora文件阐明:ORCL是主库的服务名,DG是备库的服务名。 $ vi /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora ORCL = (DESCRIPTION = ...
应用nginx做反向代理的时候,能够简略的间接把申请一成不变的转发给下一个服务。设置proxy_pass申请只会替换域名,如果要依据不同的url后缀来拜访不同的服务,则须要通过如下办法: 办法一:加"/"server { listen 8000;server_name abc.com;access_log "pipe:rollback /data/log/nginx/access.log interval=1d baknum=7 maxsize=1G" main;location ^~/user/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://user/;}location ^~/order/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://order/;}} server { listen 8000;server_name abc.com;access_log "pipe:rollback /data/log/nginx/access.log interval=1d baknum=7 maxsize=1G" main;location ^~/user/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For www.diuxie.com$proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://user/;}location ^~/order/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://order/;}}^~/user/示意匹配前缀是user的申请,proxy_pass的结尾有/, 则会把/user/*前面的手游门路间接拼接到前面,即移除user。 ...
代码来自头条号"前端小智",侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>悬浮马赛克</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { width: 100%; height: 100vh; background: #000; display: flex; justify-content: center; align-items: center; } .container { position: relative; width: 900px; display: flex; justify-content: center; align-items: center; } .piexl{ width: 900px; height: 900px; position: relative; background: #000; } img{ width: 100%; height: 100%; position: absolute; top: 0; left: 0; image-rendering: pixelated;/*pixelated 放大图像时, 应用最近街坊算法,因而,图像看着像是由大块像素组成的*/ } .piexl:hover img:nth-child(2){ transition: 2s; opacity: 0; } </style></head><body> <!-- 整体思路是用两张图片,一张大的,一张小的,小的图片放大后,应用image-rendering营造出马赛克的成果,hover之后再将小图的透明度设为0 --> <div class="container"> <div class="piexl"> <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi0.hdslb.com%2Fbfs%2Farticle%2Fb96dcaa60580e8be262c9f71d48af96d5c9ce47e.jpg&refer=http%3A%2F%2Fi0.hdslb.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627481719&t=6f8a30d69e5ce069a9fb3252059b27c3" alt=""> <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fpic%2F2%2Fe9%2Fcc3037c029_130_170.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1627481955&t=52bdffdd904079abf0c4aa9c82a71ff2" alt=""> </div> </div></body></html>
1 MySQL BLOB类型MySQL中,BLOB是一个二进制大型对象,是一个能够存储大量数据的容器,它能包容不同大小的数据。 插入BLOB类型的数据必须应用PreparedStatement,因为BLOB类型的数据无奈应用字符串拼接写的。 MySQL的四种BLOB类型(除了在存储的最大信息量上不同外,他们是等同的) 点击并拖拽以挪动 理论应用中依据须要存入的数据大小定义不同的BLOB类型。须要留神的是:如果存储的文件过大,数据库的性能会降落。如果在指定了相干的Blob类型当前,还报错:xxx too large,那么在mysql的装置目录下,找my.ini文件加上如下的配置参数: max_allowed_packet=16M。同时留神:批改了my.ini页游文件之后,须要重新启动mysql服务。2 向数据表中插入大数据类型//获取连贯Connection conn = JDBCUtils.getConnection(); String sql = "insert into customers(name,email,birth,photo)values(?,?,?,?)";PreparedStatement ps = conn.prepareStatement(sql);//java我的项目www fhadmin org// 填充占位符ps.setString(1, "张强");ps.setStringps.setDate(3, new Date(new java.util.Date().getTime()));// 操作Blob类型的变量FileInputStream fis = new FileInputStream("xhq.png");ps.setBlob(4, fis);//执行ps.execute(); fis.close();JDBCUtils.closeResource(conn, ps);点击并拖拽以挪动3 批改数据表中的Blob类型字段Connection conn = JDBCUtils.getConnection();String sql = "update customers set photo = ? where id = ?";PreparedStatement ps = conn.prepareStatement(sql);//java我的项目www.walajiao.com// 填充占位符// 操作Blob类型的变量FileInputStream fis = new FileInputStream("coffee.png");ps.setBlob(1, fis);ps.setInt(2, 25);ps.execute();fis.close();JDBCUtils.closeResource(conn, ps);点击并拖拽以挪动4 从数据表中读取大数据类型//java我的项目www fhadmin orgString sql = "SELECT id, name, email, birth, photo FROM customer WHERE id = ?";conn = getConnection();ps = conn.prepareStatement(sql);ps.setInt(1, 8);rs = ps.executeQuery();if(rs.next()){ ...
The log buffer is the memory area that holds data to be written to the log files on disk. Log buffer size is defined by the innodb_log_buffer_size variable. The default size is 16MB. The contents of the log buffer are periodically flushed to disk. A large log buffer enables large transactions to run without the need to write redo log data to disk before the transactions commit. Thus, if you have transactions that update, insert, or delete many rows, increasing the size of the log buffer saves disk I/O. ...
1.配置 pom <shiro.version>1.4.0</shiro.version> <!--shiro start--><dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-core</artifactId> <version>${shiro.version}</version></dependency><dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-web</artifactId> <version>${shiro.version}</version></dependency><dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-ehcache</artifactId> <version>${shiro.version}</version></dependency><dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring</artifactId> <version>${shiro.version}</version></dependency><!--shiro end--> MyShiroRealm.页游javapackage org.fh.realm;import java.util.Collection;import java.util.HashSet;import org.apache.shiro.authc.*;import org.apache.shiro.authz.AuthorizationInfo;import org.apache.shiro.authz.SimpleAuthorizationInfo;import org.apache.shiro.realm.AuthorizingRealm;import org.apache.shiro.session.Session;import org.apache.shiro.subject.PrincipalCollection;import org.fh.service.system.UsersService;import org.fh.util.Const;import org.fh.util.Jurisdiction;import org.fh.entity.PageData;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Lazy; public class MyShiroRealm extends AuthorizingRealm { @Autowired@Lazyprivate UsersService usersService;/** * 登录认证 */@Overrideprotected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { UsernamePasswordToken token = (UsernamePwww.sangpi.comasswordToken)authenticationToken; //UsernamePasswordToken用于寄存提交的登录信息PageData pd = new PageData();pd.put("USERNAME", token.getUsername());try {pd = usersService.findByUsername(pd);if (pd != null){ return new SimpleAuthenticationInfo(pd.getString("USERNAME"), pd.getString("PASSWORD"), getName()); }} catch (Exception e) {return null;}return null; ...
古代微服务架构都是分布式的,由十分多的服务组成。不同服务之间互相调用,组成简单的调用链路。以上的问题在链路调用中会产生放大的成果。简单链路上的某一环不稳固,就可能会层层级联,最终导致整个链路都不可用。因而咱们须要对不稳固的 弱依赖服务调用进行熔断降级,临时切断不稳固调用,防止部分不稳固因素导致整体的雪崩。熔断降级作为爱护本身的伎俩,通常在客户端(调用端)进行配置。 熔断策略Sentinel 提供以下几种熔断策略: 慢调用比例 ( SLOW_REQUEST_RATIO):抉择以慢调用比例作为阈值,须要设置容许的慢调用 RT(即最大的响应工夫),申请的响应工夫大于该值则统计为慢调用。当单位统计时长( statIntervalMs)内申请数目大于设置的最小申请数目,并且慢调用的比例大于阈值,则接下来的熔断时长内申请会主动被熔断。通过熔断时长后熔断器会进入探测复原状态(HALF-OPEN 状态),若接下来的一个申请响应工夫小于设置的慢调用 RT 则完结熔断,若大于设置的慢调用 RT 则会再次被熔断。 异样比例 ( ERROR_RATIO):当单位统计时长( statIntervalMs)内申请数目大于设置的最小申请数目,并且异样的比例大于阈值,则接下来的熔断时长内申请会主动被熔断。通过熔断时长后熔断器会进入探测复原状态(HALF-OPEN 状态),若接下来的一个申请胜利实现(没有谬误)则完结熔断,否则会再次被熔断。异样比率的阈值范畴是 [0.0, 1.0],代表 0% - 100%。 异样数 ( ERROR_COUNT):当单位统计时长内的异样数目超过阈值之后会主动进行熔断。通过熔断时长后熔断器会进入探测复原状态(HALF-OPEN 状态),若接下来的一个申请胜利实现(没有谬误)则完结熔断,否则会再次被熔断。留神异样降级 仅针对业务异样,对 Sentinel 限流降级自身的异样( BlockException)不失效。为了统计异样比例或异样数,须要通过 Tracer.trace(ex) 记录业务异样。示例: Entry entry = null;try { entry = SphU.entry(key, EntryType.IN, key); // Write your biz code here. // <<BIZ CODE>>} catch (Throwable t) { if (!BlockException.isBlockException(t)) { Tracer.trace(t);}} finally { if (entry != www.pizei.comnull) { entry.exit();}}开源整合模块,如 Sentinel Dubbo Adapter, Sentinel Web Servlet Filter 注解会主动统计业务异样,无需手动调用。熔断降级规定阐明熔断降级规定(DegradeRule)蕴含上面几个重要的属性: ...
CSCI2110Assignment 6Due: 12:00 noon, Monday, April 8, 2019The purpose of this assignment is to get you to create and use graphs, implement variousalgorithms on graphs, and further improve your programming skills.As discussed in class and the first tutorial, for each problem you will be provided witha description of the problem and a set of tests. These tests can be run on the submissionsystem (Mimir) or on the unix server for this course. You can also use these tests on yourown computer as illustrated in the first tutorial. Your code must compile. If it does notcompile, you will receive a 0 on the assignment.Figure 1: https://meepletown.com/wp-content/uploads/2011/03/TTR.jpg (Retrievedon February 12, 2019)Background: Ticket to Ride, the Board GameIn a popular board game, called “Ticket to Ride”1, the goal of the game is to build a railnetwork that covers the routes each player is given. A route is specified by the end-pointcities, and is constructed by building segments illustrated on the game board above. Forexample, to build a route between Boston and Winnipeg, a player may choose to build thesegments: Boston to Montreal, Montreal to Toronto, Toronto to Duluth, and Duluth toWinnipeg. The longer the segments the more expensive they are to build, and routes withmore segments take longer to build. Thus, it is in the player’s interest to build the routesshe is allocated in the most efficient way possible.1Published by Days of Wonder1CSCI2110 Winter 2019 Assignment 6Problem: Minimize Network LengthGiven a game board of rail segments and a list of routes, your task is to compute the totalcost of building a network of prescribed routes, assuming that the shortest distance for eachroute is chosen.For example, given the following game board and routes:Boston 2 MontrealBoston 2 New_YorkChicago 4 TorontoChicago 3 PittsburghMontreal 3 New_YorkMontreal 3 TorontoNew_York 2 WashingtonNew_York 2 PittsburghPittsburgh 2 TorontoPittsburgh 2 WashingtondoneWashington MontrealChicago New_YorkdoneFigure 2: Sample of possible rail segments and two routes.The resulting cost computation would be:The rail network consists of:Chicago 3 PittsburghMontreal 3 New_YorkNew_York 2 PittsburghNew_York 2 WashingtonThe total cost is: 10Figure 3: Segments and total cost of building a rail network for the specified routes andgame board in Figure 2Your task is to create a program that reads a game board and routes, and computeswhich segments should be constructed and the total cost.Write a program called RouteCost.java that reads in a game board and routes from theconsole (System.in) and outputs the set of segments to be built and the total cost.2CSCI2110 Winter 2019 Assignment 6InputYour program should read in the input using a Scanner object, which is instantiated withSystem.in. The input will comprise two sections with one or more lines in each section. Thefirst section contains the game board and comprises zero or more lines of the formC1 L C2where C1 and C2 are the end-points of a segment on the game board and L is the lengthof the segment. E.g., “Toronto 3 Montreal”. The section is terminated by a single word“done”.The second section contains the routes and comprises zero or more lines of the formC1 C1where C1 and C2 are the end-points of a route, comprising one or more segments. E.g.,“Montreal Washington”. The section is terminated by a single word “done”.Hint: All you need to use are the next() and nextInt() methods of the Scanner object.SemanticsThe game board is connected and all the city names are single words, e.g., “Las_Vegas”.You may assume that all game boards and all routes will be valid. All routes will havedistinct end-points (no cycles or 0-length routes).The segments are bidirectional, i.e., can be used in either direction, and the game boardrepresents a weighted undirected graph. Routes may intersect and may share segments.Segments need only be counted once though.The cost of a route is the sum of the lengths of the segments in the route. A rail networkis considered minimal if each route has minimum cost.OutputYour program should output to System.out. Each line should be terminated by a new linecharacter. The output should begin with the line:The rail network consists of:followed by the list of segments used in the rail network. Each segment should be indentedtwo (2) spaces, and the segments should be in sorted order, where the (C1, L, C2) precedes(C if C1 lexically precedes C01, or if C1 equals C01, then C2 must lexically precede C02.The format of the segments is the same format as the input.The list of segments should be followed by the lineThe total cost is: Twhere T is the sum of lengths of the segments. See Figure 3 for an example.3CSCI2110 Winter 2019 Assignment 6ExampleSample Input Sample OutputCharleston 2 RaleighChicago 3 PittsburghChicago 2 Saint_LouisChicago 4 OmahaChicago 3 DuluthDallas 2 Little_RockDallas 2 Oklahoma_CityDenver 4 OmahaDenver 4 Kansas_CityDenver 4 Oklahoma_CityDenver 2 Santa_FeDenver 3 Salt_Lake_CityDuluth 2 OmahaDuluth 6 HelenaHelena 4 WinnipegHelena 5 OmahaHelena 4 DenverHelena 3 Salt_Lake_CityKansas_City 2 Saint_LouisKansas_City 2 Oklahoma_CityKansas_City 1 OmahaLas_Vegas 3 Salt_Lake_CityLittle_Rock 3 NashvilleLittle_Rock 2 Oklahoma_CityLittle_Rock 2 Saint_LouisNashville 3 RaleighNashville 2 Saint_LouisNashville 4 PittsburghNew_York 2 WashingtonNew_York 2 PittsburghOklahoma_City 3 Santa_FePittsburgh 2 WashingtonPittsburgh 2 RaleighPittsburgh 5 Saint_LouisRaleigh 2 WashingtonSaint_Louis 2 ChicagodoneDenver WashingtonChicago Oklahoma_CitydoneThe rail network consists of:Chicago 2 Saint_LouisDenver 4 Kansas_CityKansas_City 2 Saint_LouisLittle_Rock 2 Oklahoma_CityLittle_Rock 2 Saint_LouisNashville 3 RaleighNashville 2 Saint_LouisRaleigh 2 WashingtonThe total cost is: 194CSCI2110 Winter 2019 Assignment 6Hints and Suggestions Use a 2-phase algorithm: Create a weighted graph representing the game board. Then,use Dijkstra’s shortest weighted path algorithm to find the shortest routes. The sample solution is under 200 lines of code. Your code must be well commented and indented. Please see the Assignments sectionfor this course on Brightspace for Code Style Guidelines. You may assume that all input will be correct. Be sure to test your programs using the provided tests or Mimir.GradingThe assignment will be graded based on three criteria:Functionality “Does it work according to specifications?”. This is determined in an automatedfashion by running your program on a number of inputs and ensuring that theoutputs match the expected outputs. The score is determined based on the numberof tests that your program passes. So, if your program passes tTtests, you will receivethat proportion of the marks.Quality of Solution “Is it a good solution?” This considers whether the solution is correct,efficient, covers boundary conditions, does not have any obvious bugs, etc. This isdetermined by visual inspection of the code. Initially full marks are given to eachsolution and marks are deducted based on faults found in the solution.Code Clarity “Is it well written?” This considers whether the solution is properly formatted,well documented, and follows coding style guidelines.If your program does not compile, it is considered non-functional and of extremely poorquality, meaning you will receive 0 for the solution.MarksFunctionality 20Quality of Solution 20Code Clarity 10Total 50Table 1: Marking scheme for Assignment 6.What to Hand InSubmit the source files for your program via Mimir as described in the first tutorial. Alink to Mimir is available on Brightspace. At least one of the submitted files must beRouteCost.java, which is where the main program starts to run. If you have more thanone Java file to submit, place them all in a zip file and submit that.WX:codehelp ...
History 对象History 对象保留了以后窗口拜访过的所有页面网址。因为平安起因,浏览器不容许脚本读取这些地址,然而容许在地址之间导航。浏览器工具栏的“后退”和“后退”按钮,其实就是对 History 对象进行操作。 如果 URL 的锚点值(即 hash)变了,也会在 History 对象创立一条浏览记录。 属性 history.length:以后窗口拜访过的网址数量(包含以后网页)。state:History 堆栈最上层的状态值。通常是 undefined,即未设置。办法 history.back():挪动到上一个网址,等同于点击浏览器的后退键。对于第一个拜访的网址,该办法无成果。forward():挪动到下一个网址,等同于点击浏览器的后退键。对于最初一个拜访的网址,该办法无成果。go():承受一个整数作为参数,以以后网址为基准,挪动到参数指定的网址,比方 go(1) 相当于 forward(),go(-1) 相当于 back()。如果参数超过理论存在的网址范畴,该办法无成果;如果不指定参数,默认参数为 0,相当于刷新以后页面。pushState():用于在历史中增加一条记录。不会触发页面刷新,只是导致 History 对象发生变化,地址栏会有反馈。如果 pushState 的 URL 参数设置了一个新的锚点值(即hash),并不会触发 hashchange 事件。replaceState():用来批改 History 对象的以后记录,其余都与 pushState() 办法截然不同。事件popstate:每当同一个文档的浏览历史(即history对象)呈现变动时,就会触发 popstate 事件。仅仅调用 pushState() 办法或 replaceState() 办法 ,并不会触发该事件,只有用户点击浏览器倒退按钮和后退按钮,或者应用 JavaScript 调用 history.back()、history.forward()、history.go() 办法时才会触发。Location 对象Location 对象是浏览器提供的原生对象,提供 URL 相干的信息和操作方法。通过 window.location 和 document.location 属性,能够拿到这个对象。 属性href:整个 URL。protocol:以后 URL 的协定,包含冒号 :。host:主机。如果端口不是协定默认的 80 和 433,则还会包含冒号 : 和端口。hostname:主机名,不包含端口。port:端口号。pathname:URL 的门路局部,从根门路 / 开始。search:查问字符串局部,从问号 ? 开始。hash:片段字符串局部,从 # 开始。username:域名后面的用户名。password:域名后面的明码。origin:URL 的协定、主机名和端口。// 以后网址为 http://user:passwd@www.example.com:4097/path/a.html?x=111#part1location.protocol // "http:"location.host // "www.example.com:4097"location.hostname // "www.example.com"location.port // "4097"location.pathname // "/path/a.html"location.search // "?x=111"location.hash // "#part1"location.username // "user"location.password // "passwd"location.origin // "http://user:passwd@www.example.com:4097"这些属性外面,只有origin属性是只读的,其余属性都可写。 ...
环境: SCOTTbook> ver1PORT_STRING VERSION BANNER x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production SCOTTbook> show parameter plsqlNAME TYPE VALUE plsql_ccflags stringplsql_code_type string INTERPRETEDplsql_debug boolean FALSEplsql_optimize_level integer 2plsql_v2_compatibility boolean FALSEplsql_warnings string DISABLE:ALL SCOTTook> alter session set plsql_code_type=native ;Session altered. $ ls -l /dev/shm/total 0 create or replace PROCEDURE testp2 ( P_ORG_NUM IN number, p_result OUT varchar2, p_seq OUT number) ASBEGIN p_seq := P_ORG_NUM; p_result:='';END;/ create or replace package testp1as procedure foo;end;/ ...
Hive的表生成函数一、explode函数explode(col):将hive一列中简单的array或者map构造拆分成多行。explode(ARRAY) 数组的每个元素生成一行explode(MAP) map中每个key-value对,生成一行,key为一列,value为一列 页游数据: 10 CLARK|KING|MILLER20 SMITH|JONES|SCOTT|ADAMS|FORD30 ALLEN|WARD|MARTIN|BLAKE|TURNER|JAMES 建表: create table emp2(deptno int,names array<string>)row format delimited fields terminated by '\t'collection items terminated by '|'; load data local inpath '/export/data/hivedatas/emp2.txt' into table emp2; select * from emp; 应用expload查问 select explode(names) as name from emp; 二、LATERAL VIEW侧视图LATERAL VIEW用法:LATERAL VIEW www.pizei.comudtf(expression) tableAlias AS columnAlias解释:用于和split, explode等UDTF一起应用,它可能将一列数据拆成多行数据,在此基础上能够对拆分后的数据进行聚合。 列转行 select deptno,name from emp2 lateral view explode(names) tmp_tb as name;1 三、Reflect函数reflect函数能够反对在sql中调用java中的自带函数 1、应用java.lang.Math当中的Max求两列中最大值创立hive表 create table test_udf(col1 int,col2 int) row format delimited fields terminated by ',';1–筹备数据 test_udf.txt ...
html input textarte placeholder 换行 <textarea class="form-control" name="remark" id="" placeholder="文本格式,换行分隔,最多100个,示例如下 139xxxx2009 139xxxx2020" rows="8"></textarea> br没有成果,用转义字符代替 为换行Line feed
代码来自头条号"前端小智", 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; flex-direction: column; background: #000; } input[type="radio"] { /* 设置底下的形态和大小*/ position: relative; width: 120px; height: 40px; outline: none; cursor: pointer; background: #000; -webkit-appearance: none; /*使元素看上去像什么, 但没看进去什么成果*/ margin: 10px; border-radius: 20px; box-shadow: -5px -5px 20px rgba(255, 255, 255, 0.1), 5px 5px 10px rgba(0, 0, 0, 1), inset -2px -2px 5px rgba(255, 255, 255, .5), inset 2px 2px 5px rgba(0,0,0,1 ), 0 0 2px #f1f1f1; } input[type="radio"]:checked { /* 被选中的时候扭转背景色*/ background: #20b7ff; transition: .5s; /* 应用transition过渡, 挪动时会有动画成果*/ } input[type='radio']::before { /* 应用伪元素设置下层的小按钮 */ content: ""; position: absolute; top: 0; left: 0; width: 80px; height: 40px; border-radius: 20px; transform: scale(0.98, 0.96); background: linear-gradient(to top, #000,#555); transition: .5s; box-shadow: 0 0 1px #232323; } input[type='radio']:checked::before{ /* 选中的时候扭转下层按钮的地位*/ left: 40px; } input[type='radio']::after{ content: ""; position: absolute; left: 65px; width: 4px; height: 4px; top: calc(50% - 2px); background: #555; border-radius: 50%; transition: .5s; } input[type='radio']:checked::after{ /*应用伪元素设置小圆点*/ left: calc(65px + 40px); background: #63cdff; box-shadow: 0 0 5px #63cdff,0 0 15px #63cdff,0 0 30px #63cdff; } </style></head><body> <label for=""><input type="radio" name='btn'></label> <label for=""><input type="radio" name='btn'></label></body></html>
COMP4650/6490 Document AnalysisAssignment 1 – IR In this assignment, your task is to index a document collection into an inverted index, and thenmeasure search performance based on predefined queries.A new document collection containing more than 10,000 government site descriptions, and a setof predefined queries, is provided for this assignment. The provided code implements most of aninformation retrieval system. This provided code is designed to be simple to understand andmodify, it is not particularly efficient nor scalable. When developing a real-world IR system youwould be better off using high performance software such as Apache Lucene.Throughout this assignment: ...
HTML篇HTML面试总结 CSSCSS面试总结 JSES6代码算法之类vue框架微信小程序
HTML5 有哪些新个性?HTML5 当初曾经不是 SGML 的子集,次要是对于图像,地位,存储,多任务等性能的减少。拖拽开释(Drag and drop) API 语义化更好的内容标签(header,nav,footer,aside,article,section)音频、视频API(audio,video)画布(Canvas) API天文(Geolocation) API本地离线存储 localStorage 长期存储数据,浏览器敞开后数据不失落;sessionStorage 的数据在浏览器敞开后主动删除表单控件,calendar、date、time、email、url、search 新的技术webworker, websocket, Geolocation移除的元素纯体现的元素:basefont,big,center,font, s,strike,tt,u;对可用性产生负面影响的元素:frame,frameset,noframes;反对HTML5新标签:IE8/IE7/IE6反对通过document.createElement办法产生的标签,能够利用这一个性让这些浏览器反对HTML5新标签,浏览器反对新标签后,还须要增加标签默认的款式:当然最好的形式是间接应用成熟的框架、应用最多的是html5shim框架 <!--[if lt IE 9]> <script> src="http://html5shim.googlecode.com/svn/trunk/html5.js"</script> <![endif]--> 如何辨别: DOCTYPE申明\新增的构造元素\性能元素Doctype作⽤? 严格模式与混淆模式如何辨别?它们有何意义?一、Doctype作用是什么?<!DOCTYPE>申明叫做文件类型定义(DTD),申明的作用为了通知浏览器该文件的类型。让浏览器解析器晓得应该用哪个标准来解析文档。<!DOCTYPE>申明必须在 HTML 文档的第一行,这并不是一个 HTML 标签。 二、严格模式和混淆模式的如何辨别?他们有什么意义?规范模式(严格模式)的排版和JS运作模式都是以该浏览器反对的最高规范运行。 在兼容模式(混淆模式或怪异模式)中,页面以宽松的向后兼容的形式显示,模仿老式浏览器的行为以避免站点无奈工作。 如何实现浏览器内多个标签页之间的通信?一、调用localStorage 在一个标签页外面应用localStorage.setItem(key,value)增加(批改、删除)内容;在另一个标签页外面监听storage事件。通过localstorge.getItem(key)存储的值,实现不同标签页之间的通信。 二、调用cookie+setInterval() 将要传递的信息存储在cookie中,每隔肯定工夫读取getCookie获取信息,即可随时获取要传递的信息。 行内元素有哪些?块级元素有哪些?空(void)元素有哪些?行内元素和块级元素有什么区别?行内元素有: a、b、span、img、input、select、strong 块级元素有: div、ul、ol、li、dl、dt、dd、h1、h2、h3、h4、 p 空元素: br、hr、img、input、link、meta 区别: 行内元素不能够设置宽高,不独占整行 块级元素能够设置宽高,独占整行 简述一下src与href的区别?src用于替换以后元素;href用于在以后文档和援用资源之间确立分割。 src是source的缩写,指向内部资源的地位,指向的内容将会嵌入到文档中以后标签所在位置 href是Hypertext Reference的缩写,指向网络资源所在位置,建设和以后元素(锚点)或以后文档(链接)之间的链接 <script src ="js.js"></script> <link href="common.css" rel="stylesheet"/> 浏览器本地存储 cookies,sessionStorage,localStorage 的区别?在较高版本的浏览器中,js提供了sessionStorage和globalStorage。在HTML5中提供了localStorage来取代globalStorage。 html5中的Web Storage包含了两种存储形式:sessionStorage和localStorage。 sessionStorage用于本地存储一个会话(session)中的数据,这些数据只有在同一个会话中的页面能力拜访并且当会话完结后数据也随之销毁。因而sessionStorage不是一种长久化的本地存储,仅仅是会话级别的存储。 而localStorage用于长久化的本地存储,除非被动删除数据,否则数据是永远不会过期的。 web storage和cookie的区别Web Storage的概念和cookie类似,区别是它是为了更大容量存储设计的。Cookie的大小是受限的,并且每次你申请一个新的页面的时候Cookie都会被发送过来,这样无形中节约了带宽,另外cookie还须要指定作用域,不能够跨域调用。 除此之外,Web Storage领有setItem,getItem,removeItem,clear等办法,不像cookie须要前端开发者本人封装setCookie,getCookie。 ...
1.如何了解HTML语义化? 2.默认状况下,哪些HTML标签是块级元素,哪些是内联元素?
5CCGD003W: 3D Graphics ProgrammingCoursework 1 – 2D Game (2020/21)Module leader Dr Anastassia AngelopoulouUnit Coursework 1 – REFERRED/DEFERREDWeighting: 40%Qualifying mark 30%Description 2D Game or GUI applicationLearning OutcomesCovered in thisAssignment:This assignment contributes towards the following LearningOutcomes (LOs):▪ LO1 Use appropriate data structures for storing vertices,faces and edges that define the shape of objects andmanipulate such objects by applying differenttransformations;▪ LO2 Be able to design and implement 2D real-timescenes that respond to user interaction;▪ LO5 Be able to critically assess the current problems andappreciate some of solutions available through practicalexercises and demonstrate knowledge and appreciationof some research related issues in computer graphics;▪ LO6 Communicate and present ideas by oral, visual andwritten meansHanded Out: 09/06/2021Due Date 06/07/2021 at 13:00Expected deliverables cpp file(s)Method ofSubmission:Electronic submission on BBType of Feedback andDue Date:Formative feedback will be provided during tutorial sessions.Verbal feedback on the submitted CW will be provided duringthe CW presentation/viva. Students are encouraged to recordthis feedback at this time.Note: All marks will remain provisional until formally agreed byan Assessment Board.3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W2 @Dr Anastassia AngelopoulouAssessment regulationsRefer to Student Handbook guide for undergraduate students for a clarification ofhow you are assessed, penalties and late submissions, what constitutes plagiarismetc.Penalty for Late SubmissionIf you submit your coursework late but within 24 hours or one working day of thespecified deadline, 10 marks will be deducted from the final mark, as a penalty forlate submission, except for work which obtains a mark in the range 40 – 49%, inwhich case the mark will be capped at the pass mark (40%). If you submit yourcoursework more than 24 hours or more than one working day after the specifieddeadline you will be given a mark of zero for the work in question unless a claim ofMitigating Circumstances has been submitted and accepted as valid.It is recognised that on occasion, illness or a personal crisis can mean that you fail tosubmit a piece of work on time. In such cases you must inform the Campus Office inwriting on a mitigating circumstances form, giving the reason for your late or nonsubmission.You must provide relevant documentary evidence with the form. Thisinformation will be reported to the relevant Assessment Board that will decidewhether the mark of zero shall stand. For more detailed information regardingUniversity Assessment Regulations, please refer to the followingwebsite:BCS Criteria meeting inthis assignment:2.1.1 Knowledge and understanding of facts, concepts, principles& theories2.1.5 Deploy theory in design, implementation and evaluation ofsystems2.1.8 Knowledge of management techniques to achieveobjectives2.2.1 Specify, design or construct computer-based systems2.2.4 Deploy tools effectively2.3.2 Development of general transferable skills4.1.2 Knowledge and understanding of mathematical andstatistical principles4.1.3 Knowledge and understanding of computational modelling4.2.1 Specify, deploy, verify and maintain computer-basedsystems3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W3 @Dr Anastassia AngelopoulouCoursework OneNotes:1) In order to pass the referred coursework significant improvements over anypreviously submitted version must be demonstrated.2) You MUST attend a viva – this is part of the assessment. No viva – MAXIMUMmark of 30%3) For referred cws only, in the viva you need to explain the improvements youhave made to previous submitted versions.This coursework is worth 40% of the total module mark.Please read carefully and read all sections. Raise any issues about this courseworkearly with your lecturer/tutor. Also see additional support code on the Blackboardsite for the module under Assessment.Learning Outcomes: ...
Lambda表达式是Java SE 8中一个重要的新个性。lambda表达式容许你通过表达式来代替性能接口。 lambda表达式就和办法一样,它提供了一个失常的参数列表和一个应用这些参数的主体(body,能够是一个表达式或一个代码块)。 Lambda表达式还加强了汇合库。 Java SE 8增加了2个对汇合数据进行批量操作的包: java.util.function 包以及java.util.stream 包。 流(stream)就如同迭代器(iterator),但附加了许多额定的性能。 总的来说,lambda表达式和 stream 是自Java语言增加泛型(Generics)和注解(annotation)以来最大的变动。 语法格局: (参数)->{语句块} 其中只有一个参数的化()能够省略 Lambda表达式能够实现的操作: 1、实现接口的实例化或抽象类的实例化 比方咱们线程的创立: 之前都是这样创立的: Public class My_Main { Public static void main(String[] args){ New Thread(new Runnable(){ Public void run(){ System.out.www.sangpi.comprint(“子线程输入”); } }).start(); } } 可是应用Lambda表达式却能够这样写: Public class My_Main2 { Public static void main(String[] args){ ...
def as_view(cls, **initkwargs): """ Store the original class on the view function. This allows us to discover information about the view when we do URL reverse lookups. Used for breadcrumb generation. """ # 判断 queryset 是否是 QuerySet 对象 if isinstance(getattr(cls, 'queryset', None), models.query.QuerySet): def force_evaluation(): raise RuntimeError( 'Do not evaluate the `.queryset` attribute directly, ' 'as the result will be cached and reused between requests. ' 'Use `.all()` or call `.get_queryset()` instead.' ) cls.queryset._fetch_all = force_evaluation # 调用父类的 as_view 办法 view = super().as_view(**initkwargs) view.cls = cls view.initkwargs = initkwargs # Note: session based authentication is explicitly CSRF validated, # all other authentication is CSRF exempt. # 禁用了 csrf 认证 return csrf_exempt(view)通过这行代码 view = super().as_view(**initkwargs) ,能够晓得 APIView 的 as_view 办法也调用了父类 View 的 as_view 办法,源码如下 : ...
StudentName: COMPSCI 351 TEST 1 - Model SolutionsSECOND SEMESTER 2020/2021COMPUTER SCIENCEFundamentals of Database SystemsTime Allowed: FORTY FIVE (45) minutesNOTE:– The test is closed book.– No calculators are permitted.– Attempt ALL questions in this test.– A maximum of 30 marks is available in this test.1 The Relational Model of Data.(a) Consider the relation schema Client. It stores the client number cid, the client namecname and client birthday cbday. Which superkeys does the following relation overClient satisfy? [3 marks]cid cname cbdayCatherine 01/02/1990Catherine 03/04/1986Caleb 03/04/1986Solution (1 mark for the two keys; 1 mark for the three proper superkeys; 1 mark ifnothing else has been defined):– {cid},– {cid,cname},– {cid,cbday},– {cid,cname,cbday},– {cname,cbday}(b) Consider the relation schema Lawyer. It stores the number lno and name lname ofa lawyer, and the practice lpractice the lawyer works in. Write down a single relationover Lawyer that– satisfies the two keys {lno,lname} and {lname,lpractice},– violates all superkeys not contained in the keys above, and– has as few tuples as possible. [4 marks]One solution (1 mark for violating {lname}, 1 mark for violating {lno,lpractice}, 1mark for satisfying the keys, 1 mark for not introducing anything else):lno lname lpracticeHarvey PearsonHarvey Specter LittMike Specter Litt(c) Consider the relation schema Laywer from before, as well as the relation schemaPartner with attributes pno, pname, and psince, expressing which year a lawyer hasbeen a partner since. Write down a single relation over Lawyer and a single relationover Partner that– satisfy the foreign keys [pno]⊆Lawyer[lno] and [pname]⊆Lawyer[lname] onPartner, and– do not satisfy Partner[pno,pname]⊆Lawyer[lno,lname] (inclusion dependency)which requires for each tuple t over Partner a tuple tover Lawyer such thatt[pno, pname] = t0[lno, lname] holds, and– each have as few tuples as possible. [3 marks]One solution (1 mark for each of the bullet points above)Partnerpno pname psinceHarvey 2011Lawyerlno lname lpracticeMike PearsonHarvey Pearson2SQL. Consider the relational database schema {Client, Lawyer, Case} as given below:– Client={cid, cname, cbday} with key {cid}– Lawyer={lno, lname, lpractice} with key {lno}– Case={cid, lno, date, verdict} with key {cid, lno, date} and foreign keys• [cid] ⊆ Client[cid]• [lno] ⊆ Lawyer[lno].(a) Write an English language description of the following query:SELECT c.lno, c.date, COUNT(c.id) AS number of casesFROM Case cWHERE c.verdict <> ‘guilty’GROUP BY c.lno, c.dateHAVING COUNT(∗) >= 2;[4 marks]Solution (1 mark each):– For each lno and date, what is the number of cases– a lawyer with the lno has represented on the date– where the verdict is different from guilty– and provided there were at least two cases?(b) Write the following query in SQL: What is the id of clients that had all their caseshandled by lawyers named Annalise or Annamae? [3 marks]Solution (1 mark for the first two lines, 2 marks for the sub-query including all theconditions in the WHERE clause):SELECT c.cidFROM Case cWHERE NOT EXISTS ( SELECT ∗FROM Case c1, Lawyer lWHERE c.cid=c1.cid AND c1.lno=l.lno ANDl.lname <> ‘Annamae’ AND l.lname <> ‘Annalise’ ) ;(c) Write the following query in SQL: What are the names of clients that were representedby at least two different lawyers from Pearson on the same day? [3 marks]Solution (several different solutions possible; 1 mark for correct join; 1.5 marks for thecorrect conditions in the WHERE clause; 0.5 marks for correct attribute in the SELECTclause):SELECT c.cnameFROM Case c1, Case c2, Client c, Lawyer l1, Lawyer l2WHERE c1.cid=c.cid AND c2.cid=c.cid AND c1.lno=l1.lno ANDc2.lno=l2.lno AND l1.lpractice=‘Pearson’ ANDl2.lpractice=‘Pearson’ AND c1.date=c2.date AND c1.lno <> c2.lno;3Relational algebra. Consider the relational database schema {Client, Lawyer, Case}as given below:– Client={cid, cname, cbday} with key {cid}– Lawyer={lno, lname, lpractice} with key {lno}– Case={cid, lno, date, verdict} with key {cid, lno, date} and foreign keys• [cid] ⊆ Client[cid]• [lno] ⊆ Lawyer[lno].Write relational algebra queries using only operators defined on the lecture slides.(a) Write an English language description of the following query:date,lno(verdict=guilty(Case)) ÷ lno(lpractice=Pearson(Lawyer))[3 marks]Solution (1 mark each):– What are the dates on which– every lawyer that works in the practice Pearson– is involved in some case with verdict guilty?(b) Write in relational algebra: What is the id of clients that had all their cases handledby lawyers named Annalise or Annamae? [3 marks]Solution (1 mark each):– Q1 = lno(lname=‘Annalise’(Lawyer) ∪ lname=‘Annamae’(Lawyer))– Q2 = cid(Case − (Q1 ./ Case))– Q3 = cid(Client) − Q2(c) Write in relational algebra: What are the names of clients that were representedby at least two different lawyers from Pearson on the same day? [4 marks]Solution (1 mark each):– Q1 = lno7→lno0,verdict7→verdict0(Case) ./ Case ./ lpractice=‘Pearson’(Lawyer)– Q2 = Q1 − lno=lno0(Q1)– Q3 = cid(Q2) ./ Client– Q4 = cname(Q3) WX:codehelp
一、简述开发前后端拆散架构的我的项目,往往调试后端Web接口须要用到POSTMAN工具。尽管POSTMAN工具的性能十分弱小,然而申请参数很多的状况下,咱们手写这些参数和数据还是十分麻烦的。因而咱们须要一个调试后端Web接口更加简便的办法。恰好Swagger提供了RESTAPI调用形式,咱们不须要借助任何工具的状况下,拜访Swagger页面,就能够对Web接口进行调用和调试,这种调试形式的效率要远超POSTMAN软件。 二、pom.xml中导入Swagger的依赖 <dependency> <groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version></dependency><dependency> <groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>2.9.2</version></dependency> 三、创立Swagger的配置类@Configuration@EnableSwagger2public class SwaggerConfig { //java我的项目 www fhadmin org@Beanpublic Docket createRestApi() { Docket docket = new Docket(DocumentationType.SWAGGER_2); // ApiInfoBuilder 用于在Swagger界面上增加各种信息 ApiInfoBuilder builder = new ApiInfoBuilder(); builder.title("XXXX零碎"); ApiInfo apiInfo = builder.build(); docket.apiInfo(apiInfo); // ApiSelectorBuilder 用来设置哪些类中的办法会生成到游戏REST API中 ApiSelectorBuilder selectorBuilder = docket.select(); selectorBuilder.paths(PathSelectors.any()); //所有包下的类 //应用@ApiOperation的办法会被提取到REST API中 selectorBuilder.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)); docket = selectorBuilder.build(); /* * 上面的语句是开启对JWT的反对,当用户用Swagger调用受JWT认证爱护的办法, * 必须要先提交参数(例如令牌) */ //存储用户必须提交的参数 List<ApiKey> apikey = new ArrayList(); //规定用户须要输出什么参数 apikey.add(new ApiKey("token", "token", "header")); docket.securitySchemes(apikey); //如果用户JWT认证通过,则在Swagger中全局无效 AuthorizationScope scope = newwww.sangpi.com AuthorizationScope("global", "accessEverything"); AuthorizationScope[] scopeArray = {scope}; //存储令牌和作用域 SecurityReference reference = new SecurityReference("token", scopeArray); List refList = new ArrayList(); refList.add(reference); SecurityContext context = SecurityContext.builder().securityReferences(refList).build(); List cxtList = new ArrayList(); cxtList.add(context); docket.securityContexts(cxtList); return docket;四、测试Web接口package com.gaoyang.emos.wx.controller;import com.gaoyang.emos.wx.common.util.ResponseResult;import io.swagger.annotations.Api;import io.swagger.annotations.ApiOperation;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;//java游戏我的项目 www fhadmin org@RestController@RequestMapping("/test")@Api("测试Web接口")public class TestController { ...
CSCI 1100作业代做、CS1 Multiverse作业代写、Python试验作业代做、Python编程语言作业代写CSCI 1100 — Computer Science 1 Homework 8CS1 Multiverse: ClassesOverviewThis homework is worth 100 points toward your overall homework grade, and is due Thursday,April 25, 2019 at 11:59:59 pm. Please download hw08_files.zip. and unzip it into the directoryfor your HW 8. You will find multiple data files to be used for tests.The goal of this assignment is to work with classes. You will be asked to write a simulation engineand use classes to encapsulate data and functionality. You will have a lot of design choices to make.While we have done simulations before, this one will be more complex. It is especially importantthat you start slowly, build a program that works for simple cases, test it and then add morecomplexity. We will give lots of partial credit even if you do not get all the answers right. We willprovide test cases of increasing difficulty. Make sure you develop slowly and test thoroughly.Submission InstructionsIn this homework, for the first time, you will be submitting multiple files to Submitty that togethercomprise a single program.Please follow these instructions carefully.You must submit three files. A file called Person.py that contains your Person class, a file calledUniverse.py that contains your Universe class and a file called hw8.py that contains your mainprogram.As always, make sure you follow the program structure guidelines. You will be graded on programcorrectness as well as good program structure.Remember as well that we will be continuing to test homework assignments for similarity. So,follow our guidelines for the acceptable levels of collaboration. You can download the guidelinesfrom the Course Materials section of Submitty if you need a refresher. Note that guidelines alsoforbid using someone else’s code from a previous semester. Make sure the code you submit is trulyyour own.Enter the multiverse: UniversesMany TV shows and movies make use of the theory of a multiverse. According to this theory manyuniverses very similar to ours exist at the same time. In fact, different versions of us may existin these universes as well. These alternate versions are very similar to us but may differ in veryfundamental ways. For example see regular and evil Spock from the original Star Trek (left), theCouncil of Ricks from Rick and Morty (middle) and the recent Council of Wells from Flash (right).Other examples include evil Willow and Xander. We can go on and on, but you get the point.Same individual but with a few fundamental differences that arise because they are from a differentuniverse.In this homework, you will have multiple universes each identified by their name. Assume eachuniverse has the same dimensions, a rectangle between coordinates (0,0) at the upper left cornerand (1000,1000) at the lower right corner. Each universe has some attributes: The name of the universe given by a string. A list of rewards in that universe.Each reward has the following information: x, y, points, and name,where x,y is the location the reward is located in this universe, it has the point value (points)and the (name) which describes the reward.A list of portals, each can transport you to a different universe.Each portal has the following information: from_x, from_y, to_name, to_x, to_ywhich means that the portal is at location from_x,from_y in the current universe and ittransports you to location to_x,to_y in universe with name to_name.In the early tests for the homework, we will assume that there is a single universe with rewards,but no portals. As the plot thickens, we will add the portals and other universes.You must implement a universe class to hold the above information and store it in a file calledUniverse.py. At a minimum, your Universe class must have a constructor (__init__) functionand a string representation (__str__) function.As you implement the main program, you may find other useful methods for this class that willsimplify your program.Here is an example universe from a test case:Universe: EasyCS1 (4 rewards and 0 portals)Rewards:at (40,60) for 10 points: instant set knowledgeat (100,200) for 40 points: bonus 5 points on one homeworkat (200,400) for 30 points: instant knowledge of list comprehensionat (600,800) for 50 points: good variable name generation abilityPortals:NoneMultiverse: IndividualsIn your simulation, you will track individuals moving along the universe. Each individual will havethe following attributes:name, radius, home_universe, x, y, dx, dy, current_universe, rewardsEach individual is from a specific universe (though we only use this to print where they are from).They are represented as a circle with a given radius. Their current location is given by x, y andthe current_universe they are on. Individuals have a speed given by their movement along x andy axis, stored in (dx, dy). Eventually individuals may stop or slow down, we will see how later.You will be given an initial location and speed for each individual. They will all start moving intheir current universe, but may move to other universes through portals. They may also pick uprewards over time, which you want to store. Initially, rewards will be empty. We will be interestedin the awards the individual picked up as well as their total point value.Implement a person class to hold the necessary data for each person. Store this in a file calledPerson.py.As in universes, you may find that implementing some methods for each person class may signifi-cantly simplify your main code.Here are some example individuals from one of our test cases.Scientist of EasyCS1 in universe EasyCS1at (20,30) speed (20,30) with 0 rewards and 0 pointsEngineer of EasyCS1 in universe EasyCS1at (600,800) speed (-40,-10) with 0 rewards and 0 pointsCS1 Multiverse: The Main IdeaHere is the main idea of the simulation: In this simulation, you have (potentially) many universesand many individuals. Each individual is initially in their own universe at a specified location.At each step of the simulation, each individual moves one time (i.e., x += dx, y += dy). Then,we check a number of conditions. Each condition is checked in the same order the individuals aregiven from the input file: ...
42028: Assignment 1 – Autumn 2019 Page 1 of 4Faculty of Engineering and Information TechnologySchool of Software42028: Deep Learning and Convolutional Neural NetworksAutumn 2019ASSIGNMENT-1 SPECIFICATIONDue date Friday 11:59pm, 19 April 2019 (Extended!)Demonstrations Optional, If required.Marks 30% of the total marks for this subjectSubmission 1. A report in PDF or MS Word document (5-pages max) Google Colab/iPython notebooksSubmit to UTS Online assignment submission Note: This assignment is individual work.SummaryThis assessment requires you to develop three different classifiers namely, KNN,SVM and Neural network, for handwritten digit classification. The features to usedfor classification can be either Histogram-Of-Oriented-Gradients (HoG) or LocalBinary Pattern(LBP), and raw images/pixels.Students need to provide the code (ipython Notebook) and a final report for theassignment, which will outline a brief comparative study of the classifier’sperformance.Assignment ObjectivesThe purpose of this assignment is to demonstrate competence in the followingskills. To ensure firm understanding of basic machine learning basics. This will facilitateunderstanding of advanced topics. To ensure that students understand the basics of image classification, featureextraction using the traditional machine learning techniques.42028: Assignment 1 – Autumn 2019 Page 2 of 4Tasks:Description:Implement a simple kNN classifier for digit classificationImplement a Linear classifier using SVM for digit classificationImplement a Linear classifier using Neural Network for digit classificationCompare the three implementations in terms of classification accuracy.Write a short report on the implementation, linking the concepts and methodslearned in class, and also provide comparative study on the accuracies obtainedfrom combination of different classifiers and features.Features to used: Any least two from the list given below:a. HoGb. LBPc. Raw image/pixels valuesd. Any other feature of your choiceDataset to be used: MNIST (English handwritten numerals).Report Structure:The report should include the following sections:Introduction: Provide a brief outline of the report and also briefly explainthe features and classifier combination used for experiments.Dataset: Provide a brief description of the dataset used with some sampleimages of each class.Experimental results and discussion:a. Experimental settings: Provide information on the classifier settings(e.g: KNN: value of k for kNN classifier; SVM: kernel and otherparameters used in SVM classifier; ANN: number of inputneurons/nodes, activation function, loss function, output layerinformation etc.)b. Experimental Results:i. Confusion matrix for the highest accuracy achieved, with avery short description, with some result image sample(optional)ii. Comparative study: sample table formatClassifier/Feature HOG LBP Raw Inputiii. Discussion: Provide your understanding on why there was anerror in the accuracy, and difference in the performance of theclassifiers. You may also include some image samples whichwere wrongly classified.42028: Assignment 1 – Autumn 2019 Page 3 of 4Conclusion: Provide a short paragraph detailing your understanding on theexperiments and results.Deliverables:Project Report (5 pages max)Google Colab or Ipython notebook, with the codeAdditional Information:Assessment SubmissionSubmission of your assignment is in two parts. You must upload a zip file of theIpython/Colab notebooks and Report to UTS Online. This must be done by the DueDate. You may submit as many times as you like until the due date. The finalsubmission you make is the one that will be marked. If you have not uploaded your zipfile within 7 days of the Due Date, or it cannot be run in the lab, then your assignmentwill receive a zeromark. Additionally, the result achieved and shown in theipython/colab notebooks should match the report. Penalties apply if there areinconsistencies in the experimental results and the report.PLEASE NOTE 1: It is your responsibility to make sure you have thoroughly tested yourprogram to make sure it is working correctly.PLEASE NOTE 2: Your final submission to UTS Online is the one that is marked. It doesnot matter if earlier submissions were working; they will be ignored. Download yoursubmission from UTS Online and test it thoroughly in your assigned laboratory.Return of Assessed AssignmentIt is expected that marks will be made available 2 weeks after the submission via UTSOnline. You will be given a copy of the marking sheet showing a breakdown of the marks.QueriesIf you have a problem such as illness which will affect your assignment submissioncontact the subject coordinator as soon as possible.Dr. Nabin SharmaRoom: CB11.07.124Phone: 9514 1835If you have a question about the assignment, please post it to the UTS Online forumfor this subject so that everyone can see the response.If serious problems are discovered the class will be informed via an announcement on UTSOnline. It is your responsibility to make sure you frequently check UTS Online.PLEASE NOTE : If the answer to your questions can be found directly in any of the 42028: Assignment 1 – Autumn 2019 Page 4 of 4following subject outline assignmentspecification UTS Online FAQ UTS Online discussion boardYou will be directed to these locations rather than given a direct answer.Extensions and Special ConsiderationIn alignment with Faculty policies, assignments that are submitted after the DueDate will lose 10% of the received grade for each day, or part thereof, that theassignment is late. Assignments will not be accepted after 5 days after the Due Date.When, due to extenuating circumstances, you are unable to submit or present anassessment task on time, please contact your subject coordinator before theassessment task is due to discuss an extension. Extensions may be granted up to amaximum of 5 days (120 hours). In all cases you should have extensions confirmed inwriting.If you believe your performance in an assessment item or exam has been adverselyaffected by circumstances beyond your control, such as a serious illness, loss orbereavement, hardship, trauma, or exceptional employment demands, you may beeligible to apply for Special Consideration (https://www.uts.edu.au/curren....Academic Standards and Late PenaltiesPlease refer to subject outline. ...
代码来自头条号'前端小智',侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>悬停水波纹</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ height: 100vh; background: #000; display: flex; align-items: center; justify-content: center; } .container{ position: relative; display: flex; /* flex-direction: column; */ align-items: center; } a{ position: relative; width: 150px; height: 55px; text-align: center; line-height: 55px; margin: 10px; text-transform: uppercase; background: #191919; color: #fff; letter-spacing: 2px; text-decoration: none; overflow: hidden; } span{ position: relative; display: block; width: 100%; height: 100%; z-index: 100; transition: 0s ease-in; } a:hover span{ transition: 0.4s ease-in; transform: translateY(-100%); } a::before{ content: ""; width: 250px; height: 250px; background: #2299ff; border-radius: 50%; position: absolute; bottom: -250px; left: 50%; transform: translateX(-50%); transition: 0.4s ease-in; } a:hover::before{ bottom: -150px; } a:nth-child(2)::before{ bottom: 60px; } a:nth-child(2):hover::before { bottom: -40px; } </style></head><body> <div class="container"> <a href="#"> <!--还只能用a标签, 不然不会换行--> <span>button</span> <span>button</span> </a> <a herf="#"> <span>button</span> <span>button</span> </a> </div></body></html>
FusionCharts Suite XT是全面的跨平台、跨浏览器JavaScript图表套包,其中包含FusionCharts XT、PowerCharts XT 、FusionWidgets XT、FusionMaps XT。反对 ASP、 ASP.NET、 PHP、 JSP、 ColdFusion、 Ruby on Rails、 JavaScript、甚至简略的HTML页面。它是你值得信赖的JavaScript图表解决方案,目前在寰球有45万用户抉择Fusioncharts来制作业余的JavaScript图表。 应用金字塔图来比拟数据,例如产品一年的销售数据。金字塔图由多个段组成,每个段代表一个数据点。金字塔线段绝对于整个金字塔的高度,示意特定数据点的值。 如您所知,金字塔图中的每个线段代表一个数据集,线段的高度代表该数据集的值。为了将段彼此辨别开来,您能够为它们的背景、边界等独自配置它们。在金字塔段左近,能够显示该金字塔的标签和值。 金字塔图 显着特色 单击交互式金字塔切片将它们与主金字塔离开。右键单击图表并抉择查看 2D 以将 3D 金字塔无缝转换为 2D 金字塔。以 2D 模式渲染金字塔,更好地管制边框和填充属性。将值显示为理论值或百分比。应用智能标签防止金字塔标签重叠。在图表的侧面或核心搁置标签。为每个金字塔切片应用自定义工具文本。如果您违心,能够将每个金字塔切片链接到无效的指标,例如网页、Javascript 函数,甚至是深刻图表。创立一个简略的金字塔图 应用上面给出的数据构建寰球财产金字塔(瑞士信贷 2013 年)图表,以理解当年世界财产的散布状况: 要创立金字塔图,请依照以下步骤操作: 在 JSON 数据中,按"<attributeName>": "<value>"格局设置属性及其对应的值。应用type属性指定图表类型。要渲染金字塔图,请设置pyramid。应用renderAt属性设置容器对象。应用width和height属性指定图表的维度。应用dataFormat属性设置要传递给图表对象的数据类型 (www.diuxie.comJSON/XML) 。设置对象value内的data属性以显示数据的数值。设置label属性以指定金字塔线段的标签。应用上述代码失去的寰球财产金字塔图如下所示: 您能够为金字塔图配置多个性能和外观属性。 绘制二维金字塔并自定义边框属性 默认状况下,金字塔图表出现为带有上下文菜单的 3D游戏 图表,您能够应用该菜单在 2D 和 3D 显示模式之间切换。然而,您能够将金字塔图表配置为在首次加载时以 2D 模式出现,而无需应用上下文菜单。您还能够自定义金字塔图的边框属性以取得更好的视觉示意。 应用以下属性来渲染具备自定义边框属性的 2D 金字塔图: 将is2D属性设置为1以 2D 出现图表。将showPlotBorder属性设置为1, 以显示绘图边框。将plotBorderColor属性值设置为绘图边框色彩的十六进制代码。设置plotBorderThickness属性值以指定绘图边框的粗细(以像素为单位)。设置(transparent) 和(opaque)plotBorderAlpha之间的属性值以指定绘图边框的透明度。参考上面给出的代码: { "chart": { "is2D": "1","showPlotBorder": "1","plotBorderThickness": "1","plotBorderAlpha": "100","plotBorderColor": "#333333"}} 将showLabelsAtCenter属性值设置为“1”,以在图表核心显示标签。参考上面给出的代码: ...
目前 Spring Boot 2.5.0 RC1 曾经公布,其开发团队示意将在 5 月 20 日正式 GA。咱们梳理了一下大家比拟关系和感兴趣的一些变更。 一、 运行端点变更Secure info endpoint(平安的 info 端点)默认状况下/info端点不再对 web 公开。此外,如果援用了 Spring Security,则默认状况下端点须要通过身份验证能力拜访。 优雅关机反对 GET 申请咱们流量申请到此接口执行业务逻辑的时候,若服务端此时执行关机 (kill),Spring boot 默认状况会间接敞开容器(tomcat 等),导致此业务逻辑执行失败。在一些业务场景下:会呈现数据不统一的状况,事务逻辑不会回滚。在 spring boot 2.3 版本,反对优雅停机性能。 记录停机日志通过以下属性咱们能够在 JVM 退出时候,记录资源开释日志等。 logging.register-shutdown-hook 新增 Quartz 的 Actuator EndpointActuator 中新增了一个 /quartz端点。它提供了无关Quartz作业和触发器的详细信息。 拜访 /actuator/quartz$ curl ' -i -X GET 返回利用配置的工作信息 { "jobs" : { "groups" : [ "samples", "tests" ]}, "triggers" : { "groups" : [ "samples", "DEFAULT" ]}} 二、加强容器化性能1、War 包反对分层Spring Boot 的Maven和Gradle插件当初都容许您创立用于 Docker 的分层WARs。分层WARs的工作形式与 springboot 晚期版本中提供的分层JAR反对相似。查看 Gradle 和 Maven 参考文档理解更多详细信息。 ...
fooking是一个分布式游戏网关,次要用于承载长连贯,将客户端的数据包残缺的转发给后端,后端服务解决完之后由fooking转发给客户端。如同听起来有点像nginx+fpm?嗯!没错,如果是单纯的request/response,跟nginx相似;但在游戏中经常出现要被动推数据给客户端,而没有request,比方:A发消息给B,B是没有request的,只有response.嗯哼?就这些性能?听上也没什么吸引力啊。。当然不只如此,他包含:1、分布式网关配置,只须要简略配置就能动静增加网关,以提供更多的连贯数量;2、SESSION维持,每个连贯会有惟一sessionid,后端只须要指定sessionid发送音讯即可,不必关怀这个连贯在哪台机器上;3、组播,N个用户退出到一组,只须要向组名发送音讯即可,不必关怀这个组有多少人(当然你非要本人去循环session发送我也阻止不了你);4、服务器状态监控,能够察看到以后有多少组服务器,总共有多少连贯,每台服务器上有多少连贯,哪些闲暇,哪些忙碌;5、客户端连贯与断开事件告诉;6、后端无语言限度,遵循fastcgi协定即可; 劣势 1、节约硬件,游戏通常刚开区压力比拟大,过段时间人少了就没多少压了,配置多台服务器齐全能够循环开服;2、后端无痛热更,例如php-fpm重启或者是热更代码,客户端齐全没有觉察;3、开发不便,跟开发web一样,只需将要发送的数据间接输入即可(须要增加Content-Length用于确定包大小,详见协定阐明) 4、PHP谬误能在log文件里和盘托出,并且谬误不会对fooking有任何影响 架构 fooking由一个router与多个gateway组成,所有gateway都会去连贯router,后端被动推送的音讯由router派发给gateway,而后由gateway转发客户端.request/response模式下不须要router干涉,仅仅是gateway与backend(php-fpm)通信. 协定 网关为什么会有协定?既然是音讯转发,就必须将一个包残缺的发到后端,而不是让后端来检测包是否残缺;协定分为两种,一种是前端协定,一种是后端协定前端协定是指游戏的客户端与fooking的交互协定,这个很简略,32位int + data(筹备下个版本反对lua进行自定义协定).后端协定是应用Fastcgi,这就意味着,后端无所谓什么语言,只须要遵循fastcgi协定即可,我是phper,当然举荐应用fpm;注: 后端返回的数据必须有Content-Lengthwww.cungun.com标识返回数据长度,否则一律视为不返回数据到客户端,另外数据是由后后向前切取,比方输入内容为abcdef,而Content-Length: 3,那么客户端会收到def.. 编译 在fooking目录下执行make即可,启动须要cd src 配置 具体的配置请详见src/config.lua与src/router.lua 启动router ./fooking router.lua 启动gateway ./fooking config.lua example 已做了个简略的聊天室,位于example/chat应用办法:1、应用nginx或者apache将目录指向example/chat目录,并批改index.html的服务器IP与端口(须要拜访index.html和chat.swf)2、运行python flash.py(flash的平安沙箱,因为客户端是应用flash socket)3、配置router.lua和config.lua,而后启动router和gateway4、拜访localhost/index.html
1、解析规定: 1、html字符串被浏览器接管后一句一句读取并解析2、如果解析到link标签,便发送申请获取css;3、解析到script标签,发送申请获取js后并执行相应的代码4、解析到img后会申请图片资源5、在解析html过程中构建dom树,解析css等过程中构建渲染树,递归布局后进行页面绘制 2、开始解析html //解析器通常会把工作调配给两个组件:分词程序负责把输出的html切分成非法的序列;解析程序依照句法规定去剖析而后构建句法树。<html> <body> <p>hello taya</p> <div><p>hiiiiii</p></div></body></html>1234567该html解析成DOM树后为: HTMLHtmlElementHTMLBodyElementHTMLParagraphElementTextHTMLDivElementHTMLParagraphElementText3、css选择器的读取程序是从右向左、选择器性能解释 taya div.ty span{ color:red }1它的读取程序是:span => div class:ty => id:taya先找到全局的span,而后从第一个开始向上寻找class为ty的div,而后再寻找id为taya的元素,如果没有匹配项则放弃本条门路,从下一个span开始寻找。如果是自左向右,便变成了深度遍历并随同着大量的回溯节点,十分耗费性能这也是为什么在性能方面:id选择器 > 类选择器 > 元素选择器 4、js解析 1、js是单线程,只能依照先后顺序执行2、浏览器解析是异步的,当须要申请内部资源时是不会影响html加载的,然而如果遇到js文件,则会将解析挂起,因为js中可能会有针对DOM的操作(js优化咱们须要尽可能地去防止)3、js解析器会先进行预解析,即找到所有的变量、函数等进行初始化赋值为undefined,把函数取出来成为一个函数块,寄存到仓库中,而后再解析js代码,和仓库进行匹配 依据以上的机制,能解释很多词法作用域的问题: 1:console.log(a)let a = 1console.log(a)//后果: undefined 1 2: //如果应用let,这个例子就没有用了,会报错。console.log(taya) //function taya(){console.log("4")}var taya = "sdsd"console.log(taya) //sdsdfunction taya(){console.log("11")}console.log(taya) //sdsdvar taya = "3"console.log(taya) //3function taya(){console.log("4")}console.log(taya) //3解析:在js预解析时,如果变量和函数重名,只会保留函数块,所以第一个taya输入为函数在解析时,只有+ - * / % =等字符时能力更改仓库中的值,所以后续的taya输入不为函数了 3:var a = 1;function fc(){ console.log(a)a = 2}fc()console.log(a)输入:1 2解析:执行fc()函数时,发现外部并没有定义任何变量,第一行输入a,仓库内是空的,便向内部寻找,找到了全局变量a。 4:var a = 1;function fc(a){ console.log(a)a = 2}fc(1)console.log(a)//输入:1 1 ...
IS71083A Financial Data ModellingCoursework AssignmentImplementing an Incremental (online) Training Algorithmfor Density Neural NetworksDesign and implement an incremental backpropagation algorithm for training density neural networks(DNN). DNN networks compute not only the mean of the target distribution, but also the variance with asecond output node. That is why you have to develop the backprop algorithm to train all weights leadingto each of the two output nodes in DNN given in the figure below. Start the training process usingplausible randomly generated weights. After the design of the training algorithm, apply it to model andforecast a time series, generated using the Mackey-Glass equation (available in the lecture handouts).Use more lagged inputs and hidden units if necessary to achieve better predictions.sumDesign a working prototype of the incremental backpropagation for DNN density networks in Matlab.The prototype development should include data structures for the input-to-hidden and hidden-to-outputconnections, and loops for the forward and backward pass.References:D.A.Nix and E.Weigend (1994). Estimating the mean and variance of the target probability distribution,In: Proc. 1994 IEEE Int. Conf. on Neural Networks (ICNN'94), Orlando, FL, pp. 55-60.Nikolay Nikolaev and Hitoshi Iba (2006)."Adaptive Learning of Polynomial Networks: Genetic Programming, Backpropagation and Bayesian Methods",Springer, New York, pp. 256 - 262. ...
Part 2: Write Small Functions / ProgramsPart 2: Write Small Functions / ProgramsInstructions[P2 Q1] Find all duplicates in a list[P2 Q2] No Repeats![P2 Q3] Adding up letters[P2 Q4] Longest consecutive sequence[P2 Q5] Testing PourInstructionsComplete the following questions.[P2 Q1] Find all duplicates in a listWrite a function find_duplicates() that takes in a list of integers from 1 to n, where n is thelength of the list. The function returns the first value that is repeated in the list.If the parameter is not a list or the elements in the list are outside the range, return -1 . If noelements are repeated, then return 0 .RESTRICTIONSOnly allowed: variables, if statements, while loops. Functions: len() , int() , float() ,type() , isinstance() . String methods: format() . List operators and methods: create [ ] ,list() , append() . Keywords: elif , else , return , break , continue , def , self , None , try ,raise , except , finally , is , import sys . Any exception handling.Remember: Do NOT use for loops or the in keyword. Do NOT use min() / max() ,enumerate() / zip() or sorted() . Do NOT use negative indexing (e.g. ls[-1] ) or slicing (e.g.[1:] ). Do NOT use other list operations and methods. Marks will be deducted.[P2 Q2] No Repeats!Write a program which continuously asks for user input until the a repeated value is given. Theprogram should then print out Input number <number> is not unique! and terminate.print(find_duplicates([1, 2, 3, 2])) # 2print(find_duplicates([1, 1, 2, 2])) # 1print(find_duplicates([4, 3, 1, 2])) # 0print(find_duplicates([1, 2, 2, 0])) # -1print(find_duplicates([])) # 0print(find_duplicates((1, 2, 3))) # -1RESTRICTIONSOnly allowed: variables, if statements, while loops. Functions: len() , int() , float() ,type() , isinstance() , input() , print() . String methods: format() . List operators andmethods: create [ ] , list() , append() . Keywords: elif , else , return , break , continue ,def , None , try , raise , except , finally , is , import sys . Any exception handling.Remember: Do NOT use for loops or the in keyword. Do NOT use min() / max() ,enumerate() / zip() or sorted() . Do NOT use negative indexing (e.g. ls[-1] ) or slicing (e.g.[1:] ). Do NOT use other list operations and methods. Marks will be deducted.[P2 Q3] Adding up lettersWrite a function word_sum() that takes in a string and returns the sum according to the followingrules:Each letter in the alphabet is given a number corresponding to their position in the alphabet,i.e. 'a' has value 1 , 'b' has value 2 , 'c' has value 3 , ... 'z' has value 26 . Lettersshould be case insensitive.Numeric digits have the same value as their true numeric counterparts, i.e. '1' has value 1 ,'2' has value 2 , etc.Characters which are not a letter in the alphabet and not a digit have a value of 0 .The sum to be returned should be an integer equal to sum of all the corresponding values of thecharacters. If the input is not of the correct type, raise a TypeError with the message Inputmust be a string.RESTRICTIONSOnly allowed: variables, if statements, while loops. Functions: len() , int() , float() ,type() , isinstance() . String methods: format() . List operators and methods: create [ ] ,list() , append() . Keywords: elif , else , return , break , continue , def , self , None , try ,raise , except , finally , is , import sys . Any exception handling.$ python3 no_repeats.pyGive me an input: # aGive me an input: # bGive me an input: # 375Give me an input: # c#Give me an input: # bInput number 5 is not unique!print(word_sum('abc')) # 6print(word_sum('ab*c!')) # 6print(word_sum('123ab')) # 9print(word_sum('!@#0')) # 0print(word_sum('')) # 0print(word_sum(123)) # TypeErrorRemember: Do NOT use for loops or the in keyword. Do NOT use other string or listoperations and methods. This includes, but is not limited to isalpha() , isnumeric() ,isalnum() and isdigit() . Do NOT use min() / max() , enumerate() / zip() or sorted() . DoNOT use negative indexing (e.g. ls[-1] ) or slicing (e.g. [1:] ). Marks will be deducted.[P2 Q4] Longest consecutive sequenceA consecutive sequence is one where the next number is 1 more than the previous one (e.g. 3, 4,5, 6, etc.). Write a function longest_consecutive_sequence() that takes as input a list of integersand returns the starting index of the first longest consecutive sequence.If the list value is not an integer, ignore it. If no consecutive sequence of two or greater exists or ifthe given input is not a list, return -1 .RESTRICTIONSOnly allowed: variables, if statements, while loops. Functions: len() , int() , float() ,type() , isinstance() . String methods: format() . List operators and methods: create [ ] ,list() , append() . Keywords: elif , else , return , break , continue , def , self , None , try ,raise , except , finally , is , import sys . Any exception handling.Remember: Do NOT use for loops or the in keyword. Do NOT use min() / max() ,enumerate() / zip() or sorted() . Do NOT use negative indexing (e.g. ls[-1] ) or slicing (e.g.[1:] ). Do NOT use other list operations and methods. Marks will be deducted.[P2 Q5] Testing PourWrite four good unit tests for the pour_into() method from the Filling in Bottles question,without repeating the same style of test case. Give the inputs and expected outputs by filling inthe corresponding fields in the text file template. Also, give your reasoning for each test case inthe justification section.SCAFFOLDprint(longest_consecutive_sequence([7, 1, 2, 3, 6, 9, 2, 5, 6, 7])) # 1print(longest_consecutive_sequence([8, 4, 3, 1, 5, 6])) # 4print(longest_consecutive_sequence([9, 10, 11, 13, 14, 15, 16])) # 3print(longest_consecutive_sequence([2, "a", 3, 4])) # 2print(longest_consecutive_sequence([1, 1, 1, 1, 1])) # -1print(longest_consecutive_sequence([0])) # -1TEST 1Justification:Inputs:Bottle 1 capacity:Bottle 1 current amount:Bottle 2 capacity:Bottle 2 current amount:Amount (input argument):Expected output:Bottle 1 current amount:Bottle 2 current amount:TEST 2Justification:Inputs:Bottle 1 capacity:Bottle 1 current amount:Bottle 2 capacity:Bottle 2 current amount:Amount (input argument):Expected output:Bottle 1 current amount:Bottle 2 current amount:TEST 3Justification:Inputs:Bottle 1 capacity:Bottle 1 current amount:Bottle 2 capacity:Bottle 2 current amount:Amount (input argument):Expected output:Bottle 1 current amount:Bottle 2 current amount:TEST 4Justification:Inputs:Bottle 1 capacity:Bottle 1 current amount:Bottle 2 capacity:Bottle 2 current amount:Amount (input argument):Expected output:Bottle 1 current amount:Bottle 2 current amount: WX:codehelp ...
前言最近刚好应用CompeletableFuture优化了我的项目中的代码,所以跟大家一起学习CompletableFuture。 一个例子回顾 Future因为CompletableFuture实现了Future接口,咱们先来回顾Future吧。 Future是Java5新加的一个接口,它提供了一种异步并行计算的性能。如果主线程须要执行一个很耗时的计算工作,咱们就能够通过future把这个工作放到异步线程中执行。主线程持续解决其余工作,解决实现后,再通过Future获取计算结果。 来看个简略例子吧,假如咱们有两个工作服务,一个查问用户根本信息,一个是查问用户勋章信息。如下, public class UserInfoService { public UserInfo getUserInfo(Long userId) throws InterruptedException { Thread.sleep(300);//模仿调用耗时 return new UserInfo("666", "捡田螺的小男孩", 27); //个别是查数据库,或者近程调用返回的}} public class MedalService { public MedalInfo getMedalInfo(long userId) throws InterruptedException { Thread.sleep(500); //模仿调用耗时 return new MedalInfo("666", "守护勋章");}}接下来,咱们来演示下,在主线程中是如何应用Future来进行异步调用的。 public class FutureTest { public static void main(String[] args) throws ExecutionException, InterruptedException { ExecutorService executorService = Executors.newFixedThreadPool(10); UserInfoService userInfoService = new UserInfoService(); MedalService medalService = new MedalService(); long userId =666L; long startTime = System.currentTimeMillis(); //调用用户服务获取用户根本信息 FutureTask<UserInfo> userInfoFutureTask = new FutureTask<>(new Callable<UserInfo>() { @Override public UserInfo call() throws Exception { return userInfoService.getUserInfo(userId); } }); executorService.submit(userInfoFutureTask); Thread.sleep(300); //模仿主线程其它操作耗时 FutureTask<MedalInfo> medalInfoFutureTask = new FutureTask<>(new Callable<MedalInfo>() { @Override public MedalInfo call() throws Exception { return medalService.getMedalInfo(userId); } }); executorService.submit(medalInfoFutureTask); UserInfo userInfo = userInfoFutureTask.get();//获取个人信息后果 MedalInfo medalInfo = medalInfoFutureTask.get();//获取勋章信息后果 System.out.println("总共用时" + (System.currentTimeMillis() - startTime) + "ms");}} ...
Assessment TaskIAB303 Data Analyticsfor Business InsightSemester I 2019Assessment 2 – Data Analytics NotebookName Assessment 2 – Data Analytics NotebookDue Sun 28 Apr 11:59pmWeight 30% (indicative weighting)Submit Jupyter Notebook via BlackboardRationale and DescriptionFoundational to addressing business concerns with data analytics is an understanding ofpotential data sources, the kinds of techniques that may be used to process and analysethose data, and an ability to present the final analytics in a way that is meaningful for thestakeholders.This assessment will involve the creation a Jupyter notebook, demonstrating yourunderstanding of the technical process required to address a business concern using dataanalytics.You will use your knowledge from the workshops together with the techniques practiced in thepractical lab sessions, and apply both to a selected business scenario. You will not onlyperform the necessary steps, but also provide an explanation of your decision process.Learning OutcomesA successful completion of this task will demonstrate: ...
COMP3004/COMP4105Designing Intelligent AgentsCourseworkColin JohnsonOverviewThe coursework for this module is based around you designing intelligent autonomousagents and an environment with which they interact, setting those agents a task, asking oneor more questions about that task, and evaluating it using experimental methods. You willthen present the results from this in a report, which will also explain the context for the work. DetailsAn autonomous intelligent agent is a program that operates in a particular environment, perceives aspects of that environment, and then carries out actions that change thatenvironment to carry out some task. Typically, these actions are a mixture of responses to itsperception and proactive actions such as exploration. Your task for this coursework is to design an agent-based system containing the followingfour aspects:An Environment. This is the (virtual) place where the agents will operate. It could be one of: A simulation of a physical environment in which mobile robotic agents move. Thiscould be the simulation used in the classes earlier in the semester (perhapsextended), a robot environment such as The Player Project(http://playerstage.sourceforg... or a project in Unity or a similar gameenvironment if you are familiar with one from elsewhere. A chatbot environment such as the ones used in the classes. The blackboard system used in the class where we discussed language agentswriting poetry The Bristol Stock Exchange system introduced in the classes later in the semester(https://github.com/davecliff/... or a similar simulation of someaspect of the economy or society A game environment such as Ms. PacMan (https://gym.openai.com/envs/M... v0/), the Open Racing Car Simulator (http://torcs.sourceforge.net), RoboCup(https://www.robocup.org/leagu... or similar (see e.g. http://www.gvgai.net) One of the more complex task environments from the OpenAI Gym(https://gym.openai.com)There is no need to develop the environment yourself—the focus of the project will be on theagents in the environment (chatbots, robots, trading agents, game-playing agents, autonomous drivers, etc.) – but it is likely that you will set up the details of the environmentto address your specific question. You are allowed to use the code from the classes, butplease try to make it clear broadly which parts of the code are taken from the class examples, and which is your own work (we appreciate that this is sometimes complicated to do at aline-by-line level, but you should indicate this in broad terms). Autonomous Agents. You should introduce one or more autonomous agents into theenvironment, which use some kind of AI to solve a task. Examples of AI could be an AI planning system such as Goal Oriented ActionPlanning (http://alumni.media.mit.edu/~... a search algorithm such asA* search, a genetic or swarm search, a reinforcement learning algorithm, fuzzy logic, or a hard-coded reactive or state-machine AI. The task will be one relevant to the environment: e.g. a robot vacuum cleanerclearing up dirt, a chatbot taking an order from a customer, a trader trying to optimiseits returns, a game player trying to get a high score in a game, etc. Within reason, you can use any language to do this. If you are planning to use anythingother than Python, Java, Matlab/Octave, JavaScript, and standard web technologies such asHTML/CSS, then please mention this in your topic approval. A Question. You should be asking a specific question (or a set of related questions) aboutyour system. For example: How do different approaches (a genetic algorithm, an A* search algorithm, a hard- coded heuristic) compare in terms of task performance? How does the performance of the system change as we vary the number of agents init? If the system is trained on one version of the environment, does that learning transferover to a new version of the environment How do different kinds of communication/coordination between agents effect theefficiency of those agents on the task How much improvement does storing some information (e.g. a map of theenvironment) make compared to carrying out the task in a purely reactive way? How do different kinds of sensing/perception systems affect the capacity of the agentto carry out its task? How sensitive is the agent to error/noise?A Set of Experiments. You should answer your question by carrying out a set of experiments. Remember the structure that we talked about in one of the lectures: implement code that carries out a run of the agent’s behaviour and measuresperformance then, run that code multiple times to get a measure of average performance then, repeat that process for the different conditions in your question, and usedescriptive statistics, charts/visualisation, and/or inferential statistics (e.g. significance tests) to test your questionThen, you are in a position to discuss the question using these experimental results as yourevidence. ExamplesHere are a few examples of things that you could do. You don’t have to do one of these—indeed, we would prefer you to come up with your own idea—but, these would all beacceptable project ideas if you want to do them: To take the “robot vacuum cleaner” from the early classes, and experiment withdifferent numbers of robots, and different coordination strategies (e.g. robots try tostay a fixed distance from each other, compared to sharing a map that they build up) Contrast random, fixed and planned orders of asking questions in a chatbot, and see(perhaps by doing a brief user test) which one is better. Take a number of different trading strategies and run them in the Bristol StockExchange system with varying amounts of noise/uncertainty, to see how robust eachstrategy is. Take the “avoid the cats” problem from the class, and compare a number ofstrategies for the problem: warning the cats vs. moving out of the way, and learningwhen to act based on a simple statistical approach vs. a decision-tree approach. Consider the problem of planning a robot’s movement around a mapped environment(e.g. the map generated from WiFi triangulation introduced in one of the classes). Contrast A* search and genetic algorithms on this problem, and compare them bothagainst random wandering. Topic ApprovalYou should submit a short description of your project idea (around a paragraph, 100 word)on the Moodle page by 15:00 on the 7th May 2021. We will then give you feedback onwhether the project is an acceptable one, and how it might be modified or improved. You donot have to wait until then before submitting your idea; we will start looking at them from mid- April onwards. SubmissionBy 3pm on 18th June 2021 should submit the following. This may be extended if you have asupport plan or extenuating circumstances. Late submissions will incur a penalty of 5% perworking day, up to 25th June 2021, after which you will receive a mark of zero. COMP3004A report, around 2500 words (a little longer if you need it), where you describe: The core ideas of your project; clearly state the question that you are trying to answer A review of relevant ideas, technologies and research papers How you designed the environment and agents in order to address that question Technologies used, and challenges that you met in doing the implementation How you set up and ran your experiments The results from your experiments A discussion of the question in light of the experimental results A conclusion, where you summarise the work, reflect on its successes and limitations, and briefly mention some ideas for how you would take the work forward if you hadmore timeA copy of your code, either as an upload or a link to a repositoryAnything else that you think would be helpful for the markers, e.g. sample outputs from yoursystem, a link to a brief video demonstrating it working, etc. COMP4105A report, around 2000 words (a little longer if you need it), where you describe: The core ideas of your project; clearly state the question that you are trying to answer How you designed the environment and agents in order to address that question Technologies used, and challenges that you met in doing the implementation How you set up and ran your experiments The results from your experiments A discussion of the question in light of the experimental results A conclusion, where you summarise the work, reflect on its successes and limitations, and briefly mention some ideas for how you would take the work forward if you hadmore timeA report, about 1500-2000 words, where you give an extended review of relevant ideas,technologies and research papersA 10-minute presentation about your work (dates/times will be arranged)A copy of your code, either as an upload or a link to a repositoryAnything else that you think would be helpful for the markers, e.g. sample outputs from yoursystem, a link to a brief video demonstrating it working, etc. Academic IntegrityThis is an individual assessment that should consist of your own unaided work. You shouldmake any direct quotations clear both by using quotation marks and by providing a clearreference to the paper immediately after the quotation. If you are building on someone else’scode (e.g. our code from the classes, open-source projects, etc.), please make it clear whichaspects of the code are your work through the use of comments. The University has detailedadvice about academic integrity, and submissions that demonstrate a lack of that integritywill be treated under appropriate disciplinary procedures. How the Work will be MarkedMarking will take into account: background research and how you have used it to contextualise your work the choice of task environment and how you have used it/adapted it for your specificproject the effective use of artificial intelligence and agent-based systems ideas from thecourse and your wider studies in designing your autonomous agents how clear your question(s) are, how well the experiments have been designed toanswer them, and your level of rigour in planning and analysing the experiments how well the report answers the question by using the evidence from the experiments the overall clarity and structure of the report, appropriate use of scientific andtechnical English, and the quality of charts, diagrams, pseudocode where relevant the quality of reflection on the successes and limitations of the work (for students doing a presentation) the structure of the presentation, the clarity ofexplanations, and good use of slides or other visual aidsCOMP3004 Marking SchemeEach of the following descriptors gives a broad idea of the achievement expected for a markin that range. Clearly, individual projects may fall short in some areas and show excellencein others. The marking should also be adjusted to reflect the intrinsic difficultly of the project. Band Guidelines90-100 Marks in this range are reserved for a superb all-round performance. Work done inall aspects of the project go beyond even high expectations. The student hasshown a thorough understanding of the problem. All expected tasks have beensuccessfully completed, the project shows depth and engagement with researchideas, and everything has been completed to a high standard. The report couldform the basis of a publishable conference/workshop paper. 80-89 Excellent contributions to all areas of the project. Exceeded expectations in someareas. Demonstrates knowledge and understanding of the project that is beyondstandard resources covered in the module. Clear appreciation of the project as awhole, its adequacies, limitations and possibilities for future development. Theproject demonstrates insight and depth beyond that usually expected inundergraduate work. 70-79 Very good contributions to all areas of the project. Successful completion of theproject tasks. Demonstrated initiative and creative problem-solving ability. Able toundertake the work in a competent and independent manner. Able to reflectaccurately on adequacy and limitations of the project’s achievements. 60-69 Good appreciation of background. A good attempt at applying this to the task, withdemonstrated ability to cope with difficulties. Good technical skills in several areas. Whilst most of the core aims of the project have been achieved, it might come alittle short in some areas. Good reflective understanding of the project. 50-59 Satisfactory background reading and a competent attempt at their tasks. Reasonable technical competence demonstrated. The core task completedsatisfactorily, but little achieved beyond that. Able to reflect satisfactorily on theproject. 40-49 Pass level. Competent background reading and appreciation of the project area. Basic technological competence. Some areas of the core tasks may beincomplete, but a decent attempt has been made at them. Able to reflect in alimited way on the project. 30-39 Unsatisfactory. Some attempt has been made at the background reading butclearly only partial understanding of project topic. Incomplete attempt at the coretasks. Weak technical competence. Little ability to reflect adequately on theproject. 20-29 Inadequate background reading, but shows some limited understanding of howideas can be linked to the task. Minimal attempt at the core tasks, showing poorunderstanding. A substantial amount of work is still needed to achieve the coretasks. Minimal reflection on the project. 10-19 Minimal attempt at background reading, inappropriate use of material, almost noattempt at core tasks. Very poor understanding of the problem. Minimal or noreflection on the project. 0-9 No or almost no significant attempt.COMP4105 Marking SchemesEach of the following descriptors gives a broad idea of the achievement expected for a markin that range. Clearly, individual projects may fall short in some areas and show excellencein others. The marking should also be adjusted to reflect the intrinsic difficulty of the project. Presentation COMP4105Band Guidelines9-10 A professional-level presentation of exceptional clarity and very clear structure, with very high-quality slides or other visual aids that flow seamlessly with thespoken presentation7-8 A clearly structured presentation, which explains all aspects of the project well, andwhich has high-quality slides or other visual aids that are tied in strongly with thespoken presentation5-6 Pass level. A competent presentation that has a decent structure, gives acompetent description of most aspects of the project, and where the slides andother visual aids are largely clear and related to the spoken presentation3-4 A presentation that has some level of organisation but where the topics are notpresented in a clear order or where the presentation jumps from topic-to-topic, some explanations not clear, visual aids provided but not very clear and/or not veryrelated to the spoken presentation1-2 A presentation that mentions some aspects of the project work but is largelydisorganised to the point where it cannot be followed and where most explanationsare unclear, and where visual aids are unclear and/or not related to the spokenpresentation0 No significant attempt at presentationReview report COMP4105Band Guidelines90-100 A professional-level review of the literature/technology, demonstrating a clear anddeeply analytical/critical understanding of relevant work, an original structure to thereview, insightful links between the various papers and technologies reviewedleading to an innovative thematic analysis, and a very clear link to the project work. 80-89 A clear and deeply analytical/critical understanding of relevant work, an insightfulstructure to the review, a clear thematic understanding making links between thevarious papers and technologies clear, and a very clear link to the project work. 70-79 A clear and analytical/critical understanding of relevant work, a structure to thereview, links between the various papers and technologies brought out, and a clearlink to the project work. 60-69 A clear understanding of relevant work with some analysis/critique, some structureto the review, some thematic links between papers and technologies identified, and connected in parts to the project work. 50-59 Pass level. A competent understanding of relevant work with some attempt atanalysis/critique in parts, some structure to the review, occasional attempts tomake thematic links between papers and technologies, and broadly related to theproject work. 40-49 Understanding of some relevant work but incomplete/misunderstood in parts, withlittle analysis/critique, largely unstructured, not many links betweenpapers/technologies, link with project not very clear30-39 Some papers/technologies have been studied and there is some understanding, but much is incomplete/misunderstood/irrelevant, no meaningful analysis/critique, papers/technologies presented independently, link with project not very clear20-29 A few papers/technologies have been looked at, but understanding is low andthere is no analysis/critique, no links between items studied, minimal structure,little link with project. 10-19 A couple of paper/technologies have been mentioned, but with very littleunderstanding, no links between them or structure, and not clear how they relate tothe project0-9 No or almost no significant attempt.Project work COMP4105Band Guidelines90-100 Marks in this range are reserved for a superb all-round performance. Work done inall aspects of the project go beyond even high expectations. The student hasshown a thorough understanding of the problem. All expected tasks have beensuccessfully completed, the project shows depth and engagement with researchideas, and everything has been completed to a high standard. The report couldform the basis of a publishable conference/workshop paper. 80-89 Excellent contributions to all areas of the project. Exceeded expectations in someareas. Demonstrates knowledge and understanding of the project that is beyondstandard resources covered in the module. Clear appreciation of the project as awhole, its adequacies, limitations and possibilities for future development. Theproject demonstrates insight and depth beyond that usually expected inundergraduate work. 70-79 Very good contributions to all areas of the project. Successful completion of theproject tasks. Demonstrated initiative and creative problem-solving ability. Able toundertake the work in a competent and independent manner. Able to reflectaccurately on adequacy and limitations of the project’s achievements. 60-69 Good appreciation of background. A good attempt at applying this to the task, withdemonstrated ability to cope with difficulties. Good technical skills in several areas. Whilst most of the core aims of the project have been achieved, it might come alittle short in some areas. Satisfactory or good reflective understanding of theproject50-59 Pass level. Competent background reading and appreciation of the project area. Basic technological competence. Some areas of the core tasks may beincomplete, but a decent attempt has been made at them. Able to reflect in alimited way on the project. 40-49 Unsatisfactory. Some attempt has been made at the background reading butclearly only partial understanding of project topic. Incomplete attempt at the coretasks. Weak technical competence. Little ability to reflect adequately on theproject. 30-39 An attempt has been made at the background reading but clearly only partialunderstanding of project topic. Attempt at the core tasks, but not much achievedoverall. Weak technical competence. Minimal reflection on the project. 20-29 Inadequate background reading, but shows some limited understanding of howideas can be linked to the task. Minimal attempt at the core tasks, showing poorunderstanding. A substantial amount of work is still needed to achieve the coretasks. Minimal reflection on the project. 10-19 Minimal attempt at background reading, inappropriate use of material, almost noattempt at core tasks. Very poor understanding of the problem. Minimal or noreflection on the project. 0-9 No or almost no significant attempt. WX:codehelp ...
作者:Dmitri Pavlutin译者:前端小智起源:dmitripavutin有幻想,有干货,微信搜寻 【大迁世界】 关注这个在凌晨还在刷碗的刷碗智。 本文 GitHub https://github.com/qq449245884/xiaozhi 已收录,有一线大厂面试残缺考点、材料以及我的系列文章。 当你决定学习 JS 是有可能是因为你想成为一个前端或后端开发人员。然而你该如何开始呢? 怎样才能无效轻松地学习 JS? 在这篇文章中,我将分享我学习 JavaScript 的一些教训和准则,并在这个学习过程中如何放弃能源。 留神:JavaScript基础知识次要了关键字,数据类型,运算符,变量,表达式,函数,闭包,对象,原型继承,类,this,promise,async/await。1.循序渐进斯蒂芬·金(Stephen King)是我最喜爱的作家之一。 他出版了约61部小说。 其中许多已改编成电影和电视剧。 当金在采访中被问到“你怎么写?”时,他答复: 一次一个字写一本好书没有捷径或灵丹妙药:一次只写一个字。他一个字一个字,一分钟一分钟,一小时一小时 循序渐进地写一本书,直到实现。 循序渐进的准则也实用于学习JavaScript语言。学习JavaScript没有捷径或灵丹妙药:咱们须要一步一步地了解该语言的每个概念。 2.抉择喜爱的学习形式有很多形式能够学习 JS :浏览书籍,观看视频课程,技术平台。 2.1 书籍我更喜爱从书本上学习,书籍让我以本人的步调缓缓地理解信息,使我能够屡次浏览了解艰难的局部。 扭转我对 JS 了解的是从头到尾浏览《JavaScript权威指南(第6版)》。这本书以一种可拜访的形式传授所有简略到高级的概念。 如果你也喜爱看书,我举荐你读上面的书 JavaScript权威指南(第6版)Head First HTML5 Programming(中文版)你不晓得的JavaScript上/中/下JavaScript高级程序设计(第4版)仅仅读书是不够的,你须要一种办法来记住这些信息,我通过这些练习来坚固常识。 首先,在浏览时在笔记本上写下一些想法。 之所以无效,是因为当咱们记下这个想法时,咱们会对其进行更多思考并放弃好奇的状态,反复是技能之母。 这是我在浏览《JavaScript:权威指南》时做的笔记: 其次,应用在线 JS编辑器(例如jsitor或codesandbox)运行书中遇到的代码片段。 2.2 视频课程视频课程比书本更具互动性。视频 UP 主能从人类可了解的形式解释这些难懂的概念。另外,在作者的领导下,咱们能够通过创立实在的应用程序来进行实际。 JavaScript初学者课程列表: Modern JavaScript From The Beginning (by Brad Traversy)The Modern Javascript Bootcamp Course (by Colt Steele and Stephen Grider)JavaScript进阶JavaScript 深入浅出2.3 技术平台平时摸鱼也能够看看一些技术平台,有些还是很不错的,举荐几个: 思否掘金CSDN头条3.不要过分谋求完满,即刻开始就是最好的开始无论抉择学习形式(从书籍,视频课程或技术平台),都须要从头到尾保持的实现它。 ...
December 18, 2017 [6GEN715 PROJECT INSTRUCTIONS] 6GEN715 – Computer GraphicsProject InstructionsDr. Yawei Liang at RMC2017-12o The project is worth 20% of your final mark of this course.o The final report is to be completed by Dec. 29, 2017. A project mark of zero will be assignedif you submit anything late.o Project presentations are to be during the last but one day of teaching. OverviewObjective: In a group of not more than 4 students, you have to use OpenGL to create a virtualhome on a piece of land, such as:And there is at least one tree beside your dream home and your program should enable to viewthe virtual environment from different viewpoints.December 18, 2017 [6GEN715 PROJECT INSTRUCTIONS]Dr. Yawei Liang, RMCC Page 2Three steps are designed to fulfil this project: ...
CSCE 474/874: Introduction to Data Mining Spring 2021Homework 3 March 02, 2021AssignmentImplement the k-means algorithm to perform clustering and compare your results withthe results from Weka.• Assume that all the attributes are continuous variables.• Your program must allow the number of clusters (k) to be specified as input.• Your program must allow the epsilon (change in the sum of the distances from thecluster centers) to be specified as input.• Your program must allow the number of iterations to be specified as input.Your program should stop if either the number of iterations is reached or if the change inthe total sum of the squares of the distances (SSD) falls below epsilon.Plot the runtime of the algorithm as a function of number of clusters, number ofdimensions and size of the dataset (number of transactions).Plot the goodness of clustering as a function of the number of clusters and determine theoptimal number of clusters.Compare the performance of your algorithm with that of Weka and summarize yourresults.For this assignment you will work in teams. Use the dataset from the domain you will beworking on for the project. If the data is not suitable, you may use one from the Wekadataset.All code must be written by the members of your team. You may NOT use any codefrom ANY OTHER source, including other students and the Internet.Due DateThe assignment is due on March 16 is worth 100 points.HandinHand in a report along with the listing of your program, the output generated from the runof the test file on Canvas. Make sure that you have uploaded a signed copy of theContributions form. Prepare and submit two files as follows:• Your report named as “Lastname1_Lastname2.pdf” in pdf format. The signedcontributions form should be used as the cover page of your report.• A zip file named “Lastname1_Lastname2.zip” that includes everything else (yourprogram, the output generated from the run of the test file, etc.). You must include a README file that describes the usage of your program. Make sure yourimplementation can successfully execute on the CSE server.Grading GuidelinesImplement the k-means algorithm to perform clustering in a dataset. (50 points)• Your implementation will be tested on cse.unl.edu server using the command youprovided in the README file. (30 points)• In the report, you should write a paragraph about your program design (10 points)Plot the runtime of the algorithm as a function of number of clusters, number ofdimensions and size of the dataset (number of transactions). (20 points)• In the report, you should write a paragraph to summarize the observation andelaborate on it.Plot the goodness of clustering as a function of the number of clusters and determine theoptimal number of clusters. (20 points)• In the report, you should write a paragraph to summarize the observation andelaborate on it.Compare the performance of your algorithm with that of Weka and summarize yourresults. (10 points)• Summarize the differences (if there is any) and elaborate on it (why/how). WX:codehelp ...
CSE355/AMS345 Programming AssignmentJie GaoFor this programming assignment you can use your favorite platform and favorite programming languagein your implementation. The task is to implement one of the following algorithms as listed below. Graham Scan Algorithm for computing convex hull for points in the plane.Input: the coordinates of n points.Output: a convex polygon representing the convex hull.Triangulation of a simple polygon.Input: the vertices of the polygon.Output: a triangulation of the polygon.Given a triangulation, use the flip algorithm to turn it into a Delaunay triangulation.Input: a set of points and their triangulation.Output: a Delaunay triangulation of the same points.We will provide sample input and sample output files for each algorithm in separate files.You will get 80% of the total grade if your program assumes no degeneracy, i.e., no three points are ona line, no four points on a circle, etc. To get full marks you will need to handle possible degeneracies in theinput.Submission requires a zipped folder of all source files together with a README file explaining how torun your program. If needed, you may be asked to show a demo of your program to the TA.Please submit to blackboard the final program and README file by Dec 16th.In the inputs and outputs below, a set of points, a polygon, and a triangulation may be specified asfollows: Set of points: the first line shows the number of points. After that, each line shows the [x, y] coordinatesof one input point.Example:3[5, 26][76, ?23][20, 221] Polygon: same as the set of points, with its vertices given in counterclockwise order.Department of Computer Science, Stony Brook University, Stony Brook, NY 11794. Email: jgao@cs.sunysb.edu1 Triangulation: this assumes a reference set of points. The points are assigned indices in the followingorder: the first point has index 1, the second point has index 2, etc.The triangles are listed as follows: the first line gives the total number of the triangles in the triangulation.After that, each line is a triple of indices [i, j, k] representing a triangle spanning three verticeswith indices i, j, k.Example: a (trivial) triangulation of 3 points.3[5, 26][76, 23][20, 221]1[1, 2, 3] For your implementations, you may assume that the number of points n ≤ 100 and all coordinatevalues x, y are integers s.t. x, y ∈ [250, 250].WX:codehelp
CS102B Course Project: The Hangman GameFall 2018, SUSTechBackgroundHangman is a paper and pencil guessing game for two or more players. One playerthinks of a word and the other(s) tries to guess it by suggesting letters within a certainnumber of guesses. In this project, we restrict the number of players to two.The word to guess is represented by a row of dashes, representing each letter of theword. If the guessing player (or guesser) suggests a letter which occurs in the word,the other player writes it in all its correct positions. If the suggested letter does notoccur in the word, the other player draws one element of a hanged man stick figure asa tally mark. The guesser can win by guessing all the letters that appear in the word,thereby completing the word, before the diagram is completed.The following example illustrates a player (the guesser) trying to guess the word“hangman”, which is selected by the other player, using a strategy based solely onletter frequency. As the player continues, a part of the stick figure on the noose isadded. Once a full body is drawn, the game is over, and the guesser loses the game.1Word:Misses:Guess: _ _ _E2Word:Misses:Guess: _ _ _ET3Word:Misses:Guess: _ _ _E, TA4Word:Misses:Guess: A _ A E, TO5Word:Misses:Guess: A _ A E, O, TI6Word:Misses:Guess: A _ A E, I, O, TS7Word:Misses:Guess: A _ A E, I, O, S, TN8Word:Misses:Guess: A N _ A NE, I, O, S, TRGameOverWord:Misses:Guess: A N _ A NE, I, O, R, S, TThe guessing player has lost this game as the diagram had been completed before allthe letters were guessed. Learn more about the hangman game via the links below:https://www.webhangman.com/ha...https://www.hangman.org.uk/ho...Project RequirementsYour task is to implement the two-player hangman game. The computer will think ofa word and the user will guess the word. You should find a team mate to finish theproject. It is also fine if you work alone. Below are the detailed requirements. ...
Assignment 6: Multi-threaded Map Reduce in RustAssignment 6: Multi-threaded Map Reduce in RustDue Sunday by 11:59pmPoints 50Submitting a file uploadAvailable after May 23 at 8amStart AssignmentIntroductionIn this assignment, you'll write a program that will get you familiar with writing multi-threaded programs in Rust.Learning OutcomesWrite simple programs in Rust (Module 9, MLO 2)Compile, debug, manage and run Rust programs (Module 9, MLO 3)Explain the facility for threads provided by Rust (Module 10, MLO 2)Map ReduceAccording to the Wikipedia article on MapReduceMapReduce is a programming model and an associated implementation for processing and generating big data sets with aparallel, distributed algorithm on a cluster.A MapReduce program is composed of a map procedure, which performs filtering and sorting (such as sorting students by firstname into queues, one queue for each name), and a reduce method, which performs a summary operation (such as counting thenumber of students in each queue, yielding name frequencies).InstructionsFor this assignment, we are providing you with a single-threaded Rust programprocesses input numbers to produce a sum. The program contains extensive comments that explain the functionality and give directionson what parts of code you are allowed to change (look for comments starting with CHANGE CODE).Assignment 6: Multi-threaded Map Reduce in RustHere is a description of the program: currently the main() function does the followingGenerates data for the rest of the programCalls generate_data() to generates a vector of numbers that serves as input for the rest of the program.Partitions the dataCalls partition_data_in_two() which partitions the input numbers into two partitionsPerforms the map stepCalls map_data() for each of the two partitions, which returns the sum of all the numbers in that partition.Performs the reduce stepGathers the intermediate results produced by each call to map_data()Calls reduce_data() that sums up the intermediate results produced by the map step to produce the final sum of all the inputnumbers.You have to modify the program to accomplish the following tasks:Modify the program to create 2 threads, each of which concurrently runs the map_data() function on one of the two partitionscreated by the program given to you.Add code for the function partition_data() to partition the data into equal-sized partitions based on the argument num_partitionsIn case num_elements is not a multiple of num_partitions, some partitions can have one more element than other partitionsAdd code to the function main() toPartition the data into equal-size partitionsCreate as many threads as the number of partitions and have each thread concurrently run the map_data() function to processone partition eachGather the intermediate results returned by each threadRun the reduce step to process the intermediate results and produce the final resultSee detailed comments in the provided program to see how you can go about making the required changes.Example UsageHere are some example executions of the program.An execution of the program with 5 partitions and 150 elements.Assignment 6: Multi-threaded Map Reduce in RustSince the number of elements is a multiple of the number of partitions, it is required that each partition should have the samenumber of elements.However, there is no requirement about which element is put into which partition. Thus the intermediate sums in your solution can bedifferent from what is shown below../main 5 150Number of partitions = 2size of partition 0 = 75size of partition 1 = 75Intermediate sums = [2775, 8400]Sum = 11175Number of partitions = 5size of partition 0 = 30size of partition 1 = 30size of partition 2 = 30size of partition 3 = 30size of partition 4 = 30Intermediate sums = [435, 1335, 2235, 3135, 4035]Sum = 11175An execution of the program with 6 partitions and 150 elements../main 6 150Number of partitions = 2size of partition 0 = 75size of partition 1 = 75Intermediate sums = [2775, 8400]Sum = 11175Number of partitions = 6size of partition 0 = 25size of partition 1 = 25size of partition 2 = 25size of partition 3 = 25size of partition 4 = 25size of partition 5 = 25Intermediate sums = [300, 925, 1550, 2175, 2800, 3425]Sum = 11175An execution of the program with 5 partitions and 153 elements.In this example the number of elements is not a multiple of the number of partitions.Based on the requirement that some partitions can have one element more than other partitions, in this case 3 partitions must have31 elements and 2 partitions must have 30 elements.Assignment 6: Multi-threaded Map Reduce in RustIn the example shown below, the 3 partitions with 31 elements are at position 0, 1 and 2 in the vector of partitions, and the 2partitions with 30 elements are at position 3 and 4 in that vector. However, there is no requirement about the order in which partitionsthat have one more element than other partitions appear in the vector of partitions. Thus, the order of the partitions in your solutioncan be different from what is shown below../main 5 153Number of partitions = 2size of partition 0 = 76size of partition 1 = 77Intermediate sums = [2850, 8778]Sum = 11628Number of partitions = 5size of partition 0 = 31size of partition 1 = 31size of partition 2 = 31size of partition 3 = 30size of partition 4 = 30Intermediate sums = [585, 1486, 2387, 3135, 4035]Sum = 11628HintsThe function thread::spawn() returns JoinHandle<T> where T is the type of thereturn value of the function the thread runs. This means thatBecause map_data() returns an integer of type usizeIf you spawn a thread that runs map_data()thread::spawn() will return a value of type JoinHandle<usize>What to turn in?Required: Upload one file main.rs with all of your code.When you resubmit a file in Canvas, Canvas can attach a suffix to the file, e.g., the file name may become main-1.rs . Don'tworry about this name change as no points will be deducted because of this.Optional: If you have any meta-comments about the program, create a file README.txt with these comments, and upload it withyour submission as a separate file (i.e., don't zip up the two files together).Grading CriteriaAssignment 6: Multi-threaded Map Reduce in Rust ...
精度问题汇总 想用无限的位来示意无穷的数字,显然是不可能的,因而会呈现一些列精度问题: 浮点数精度问题,比方 0.1 + 0.2 !== 0.3大数精度问题,比方 9999 9999 9999 9999 == 1000 0000 0000 0000 1toFixed 四舍五入后果不精确,比方 1.335.toFixed(2) == 1.33浮点数精度和 toFixed 其实属于同一类问题,都是因为浮点数无奈准确示意引起的,如下: (1.335).toPrecision(20); // "1.3349999999999999645"而对于大数精度问题,咱们能够先看上面这个游戏代码片段: // 能准确示意的整数范畴下限,S为1个0,E为11个0,S为53个1Math.pow(2, 53) - 1 === Number.MAX_SAFE_INTEGER // true// 能准确示意的整数范畴上限,S为1个1,E为11个0,S为53个1-(Math.pow(2, 53) - 1) === Number.MIN_SAFE_INTEGER // true// 能示意的最大数字,S为1个0,E为971,S为53个1(Math.pow(2, 53) - 1) * Math.pow(2, 971) === Number.MAX_VALUE // true// 能示意的最靠近于0的负数,S为1个0,E为-1074,S为0Math.pow(2, -1074) === Number.MIN_VALUE // true通过以上能够明确, [MIN_SAFE_INTEGER, MAX_SAFE_INTEGER] 的整数都能够准确示意,然而超出这个www.sangpi.com范畴的整数就不肯定能准确示意。这样就会产生所谓的大数精度失落问题。 解决思路 首先思考的是如何解决浮点数运算的精度问题,有 3 种思路: 思考到每次浮点数运算的偏差十分小(其实不然),能够对后果进行指定精度的四舍五入,比方能够parseFloat(result.toFixed(12));将浮点数转为整数运算,再对后果做除法。比方0.1 + 0.2,能够转化为(1*2)/3。把浮点数转化为字符串,模仿理论运算的过程。先来看第一种计划,在大多数状况下,它能够失去正确后果,然而对一些极其状况,toFixed 到 12 是不够的,比方: ...
CSE 332 Lab 5: OOP DesignDue by Wednesday December 12th at 11:59 pmFinal grade percentage: 20 percent - 15 percent implementation, 5 percent ReadmeObjective:This lab is intended to extend your understanding and use of C++ object-oriented programmingtechniques, and to give you more experience using common design patterns.To complete this lab, you will be given some starter code in your repository. You should buildadditional functionality from there, documenting your thought process for each implementationdecision you make in your Readme. The project we will be working on is a CalendarApplication(I know 330 already has a calendar project...sorry!), however the goal is to designthe software to be very extensible. For this lab, your documentation will be worth much morethan in previous labs. Make sure you think through your design decisions thoroughly anddocument them thoroughly as well. The code I’ve provided is a very bare bones calendar, withcurrently very little functionality. You will be adding functionality is this lab. Below is a briefdescription of the provided code. ...
Tomcat拜访所有的资源,都是用Servlet来实现的,所以Tomcat又叫Servlet容器,什么都交给Servlet来解决。当然,动态资源也不例外。动态资源能够了解为前端的固定页面,如css,html,js,jpg,png等。对于动态资源,Tomcat最初会交由一个叫做DefaultServlet的类来解决,DefaultServlet解决动态资源的过程就是Tomcat响应动态资源。 代码 可能你习惯性的关上Tomcat,在部署了一个利用之后,就开始查看其运行后果,或者更多的关注Servlet内的逻辑是否正确。至于动态资源解决这个事,可能未曾注意过。那咱们一起来看看,Tomcat是如何响应动态资源的。 实质上讲,Tomcat对于所有的动态资源,会做对立解决。也就是在所有你没有配置URL匹配的中央,Tomcat这个全局对立解决的配置就开始接管工作了。那么,假使咱们没有配置这个货色,它怎么失效呢? 在Tomcat的conf目录下,就是有全局配置文件server.xml在同一个目录下,有一个web.xml,关上它之后,你会发现这样的阐明: The default servlet for all web applications, that serves static resources. It processes all requests that are not mapped to other servlets with servlet mappings. 再向下,你会看到对于这个全局解决的Servlet申明,也就是解决动态资源的DefaultServlet类。此处,它还有一个名为listings的初始化参数,默认值为false。这个参数次要作用,是在没有welcome文件时,管制利用目录内的文件是否容许列表显示。如果设置为true,就会常见的FTP服务器一样,把利用目录下的文件都列了进去,像上面这个样子。当然,这个款式也是能够自已定义的。 那么,既然url-pattern配置的是 / ,那不就应该响应所有的申请了么? 对,咱们下面阐明中也提到了,是匹配所有你没定义的Servlet-mapping的申请。而之所以本人定义的Servlet能够优先失效,则是因为Tomcat内的Servlet配置,是严格依照申明程序初始化,并按此程序响应申请,一层层按此比对,有一个能够响应申请,就用其解决。 上面咱们来看DefaultServlet中,动态资源响应解决的局部游戏源码,文件位于org.apache.catalina.servlets.DefaultServlet文件中。首先是这个文件,个别资源申请,都会走GET办法。 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Serve the requested resource, including the data content serveResource(request, response, true, fileEncoding); ...
一、步骤一:组件的构建(组件的命名用驼峰命名法,或者短横线分隔命名) 办法一:extend构建应用Vue结构器,创立一个“子类”,参数是一个蕴含组件选项的对象,其中,data选项中必须是函数 var author = Vue.extend({ template: "<p><a :href='url'>{{author}}</a></p>", data : function() { return { author : 'vamous', 办法二:template标签构建法 template标签构建,需在标签上加id属性用以前期注册<template id="myCom"> <div>这是template标签构建的组件</div></template> 办法三:template标签构建法(能够把组件作为独自的一个*.vue文件寄存,用时用import引入) <template> <div>这是template标签构建的组件</div></template> <script> import bus from '../common/bus';export default { data() { return { collapse: false, fullscreen: false, name: 'linxin', message: 2 } }, computed:{ username(){ let username = localStorage.getItem('ms_username'); return username ? username : this.name; } }, methods:{ // 用户名下拉菜单抉择事件 handleCommand(command) {if(command == 'loginout'){ www.pizei.comlocalStorage.removeItem('ms_username') this.$router.push('/login'); </script>二、步骤二:组件的注册 ...
对于mysql load语句在binlog中的记录形式: 整顿自 实战45讲+本人的一些了解 一:binlog_format=statement 这个 load 语句记录到 binlog 里当前,怎么在备库重放呢? 因为 /server_tmp/t.csv 文件只保留在主库所在的主机上,如果只是把这条语句原文写到 binlog 中,在备库执行的时候,备库的本地机器上没有这个文件,就会导致主备同步进行。 所以,这条语句执行的残缺流程,其实是上面这样的。 主库执行实现后,将 /server_tmp/t.csv 文件的内容间接写到 binlog 文件中。 往 binlog 文件中写入语句 load data local infile ‘/tmp/SQL_LOAD_MB-1-0’ INTO TABLE db2.t。 把这个 binlog 日志传到备库。 备库的 apply 线程在执行这个事务日志时: a. 先将 binlog 中 t.csv 文件的内容读出来,写入到本地长期游戏目录 /tmp/SQL_LOAD_MB-1-0 中; b. 再执行 load data 语句,往备库的 db2.t 表中插入跟主库雷同的数据。 执行流程如图 2 所示: 图 2 load data 的同步流程 留神,这里备库执行的 load data 语句外面,多了一个“local”。它的意思是“将执行这条命令的客户端所在机器的本地文件 /tmp/SQL_LOAD_MB-1-0 的内容,加载到指标表 db2.t 中”。 ...
加载指定url的web页面(GET申请) C语言函数 int web_url( const char StepName, const char url, , [EXTRARES, ,] LAST ); java语言 int object.url( String stepName, String url, String[] argumentList ); Argument Description object WebApi类型的对象表达式。对于Java和VB来说,通常是Web StepName 图形脚本中的step标签。如果开启了Automatic Transactions(自动化事务),则它同时也是事物名称。 URL 须要加载的Web页面的URL(Uniform Resource Locator) ,格局为:"URL= "。List of Attributes 属性列表 EXTRARES 划界参数,标识下一个参数将是资源列表. List of Resource Attributes 资源属性列表 LAST 标识参数列表完结的标记。 web_url仅在VuGen处于URL-based script或者勾选A script containing explicit URLs only 的HTML-based scripte模式下被录制。(见VuGen的录制选项 Recording Options). 可应用web_url模仿从FTP服务器下载文件。 下载是基于二进制模式实现的,除非指定"FtpAscii=1" non-HTML-generated资源,如gif,jmagegs. List of Resource Attributes仅在录制选项中设置了Record within the current script step才会被插入。 ...
2.1.1. 应用协程合成简单逻辑协程解决异步工作:当遇到一些须要异步解决的程序需要时,能够应用协程来实现应用协程的长处:简略,易于实现实例:应用协程代替无限状态机 (基于原书的代码做了些许批改以及减少了正文)//一个示意村民的类public class Villager : MonoBehaviour{ public float maxSatiation = 10f; //最大饱食度public float maxFatigue = 10f; //最大困倦值const float minSatiation = 0.2f; //最小饱食度const float minFatigue = 0.2f; //最小困倦值private float satiation; //以后饱食度private float fatigue; //以后困倦值Coroutine currentCoroutine; //以后的状态(协程)//OnEnable在脚本被激活时立刻执行void OnEnable(){ satiation = maxSatiation; //初始化饱食度,设为最大值 fatigue = maxFatigue; //初始化困倦值,设为最大值 StartCoroutine(Tick()); //开始“游戏循环”的协程 }//模仿“[游戏]循环”,相似MonoBehaviour的Update办法IEnumerator Tick(){ //每帧进行一次循环 while(true) { DecrePerFrame(satiation); //缩小饱食度 DecrePerFrame(fatigue); //缩小困倦值 //如果饿死了且以后的状态为空,开始“吃”协程,并定“吃”为以后状态 if(satiation < minSatiation && currentCoroutine == null) { currentCoroutine = StartCoroutine(Eat()); } //如果困死了,不论当初在干啥,间接开始“睡”协程,并定“睡”为以后状态 if(fatigue < minFatigue) { currentCoroutine = StartCoroutine(Sleep()); } //进展一帧 yield return null; }}IEnumerator Eat(){ //每帧吃一点,吃到饱为止 while(satiation < maxSatiation) { IncrePerFrame(satiation); yield return null; } //吃饱了,以后状态改回空 currentCoroutine = null;}IEnumerator Sleep(){ //立刻进行以后正在干的事(例如"吃") StopCoroutine(currentCoroutine); //如果没睡够,持续睡 while(fatigue < maxFatigue) { IncrePerFrame(fatigue); yield return null; } //睡够了,以后状态改为空 currentCoroutine = null;2.1.2. 自定义的插值公式 ...
代码来自头条号"前端小智",侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ position: relative; width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background: #000; } .container{ display: flex; justify-content: center; align-items: center; } .container div{ padding: 15px 30px; position: relative; text-decoration: none; letter-spacing: 2px; text-transform: uppercase; border: 2px solid #0f0; -webkit-box-reflect: below 0px linear-gradient(transparent, #0002); color: #fff; transition: 0.5s; transition-delay: 0; } .container div span{ position: relative; z-index: 100; } .container div:hover{ color: #000; box-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 40px #0f0, 0 0 60px #0f0, 0 0 80px #0f0, 0 0 160px #0f0; transition-delay: 1s; } .container div:hover:before{ width: 60%; height: 100%; left: -2px; background: #0f0; transition-delay: 0 0.5s 1s 1s; box-shadow: 5px 0 0 #0f0, 5px 0 0 #0f0; } .container div:hover:after{ width: 60%; height: 100%; right: -2px; background: #0f0; transition-delay: 0 0.5s 1s 1s; box-shadow: -5px 0 0 #0f0, -5px 0 0 #0f0; } .container div::before{ content: ""; width: 20px; height: 2px; background: #0f0; position: absolute; top: 50%; left: -20px; transform: translateY(-50%); box-shadow: 5px -8px 0 #0f0, 5px 8px 0 #0f0; transition: width 0.5s, left 0.5s, height 0.5s, box-shadow 0.5s; transition-delay: 0 0.5s 1s 0.5s; } .container div::after{ content: ""; width: 20px; height: 2px; background: #0f0; position: absolute; top: 50%; right: -20px; transform: translateY(-50%); box-shadow: -5px -8px 0 #0f0, -5px 8px 0 #0f0; transition-delay: 0 0.5s 1s 0.5s; transition: width 0.5s, left 0.5s, height 0.5s, box-shadow 0.5s; } </style></head><body> <div class="container"> <div><span>read more</span></div> </div></body></html>
一、嵌套程序code标签和pre标签是能够嵌套应用的,须要指出的是,火狐之前某一版本在解析code标签和pre标签的嵌套时,程序不当会呈现浏览器将DOM构造解析谬误的问题呢。这仅仅是火狐本人的问题啦,而且最新版本曾经可能正确解析进去啦。正确解析指的是可能将DOM构造正确解析进去哟。总而言之,当初这两个标签的嵌套程序能够是任意的哦。不会呈现DOM构造解析谬误的景象啦。 当咱们写如下的代码时:<pre> <code> hello world </code></pre> 二、对于pre标签和code标签在HTML5下的省略规定最新的HTML5标准定义了能够省略完结标签的标签,如<p></p>标签能够写成<p>标签,将完结标签省略掉。pre标签和code标签也是和p标签一样呢,是能够省略完结标签呢,在HTML5规范下像上面这样也是正确的呢。解析进去的和下面的解析后果是一样的哦。 <pre> <code> hello world火狐和IE9以及Chrome都能正确解析呢。这里倡议大家读一读HTML5规范下标签的省略标准喽:也就是下面两个写法都是正确的。 然而须要留神一点的是,IE9下默认规范的标准是上面这个图。 而火狐和Chrome下默认的规范是上面这个图。 总而言之,都是正确的啦。DOM构造都是一样的喽。当然空格有可能会被当做节点呢。三、code标签和pre标签的定义code标签: 1、code标签的定义: <code>标签, 用于示意计算机源代码或者其余机器能够浏览的文本内容。软件代码的编写 者习惯了编写代码时的代码格局,那么这个<code>标签就是为软件代码编写者设计的, code标签内的文本将用等宽、相似电传打字机款式的字体(Courier)显示进去。 2、code标签的利用,应该是只用在示意计算机程序源代码或者其余机器能够浏览的文本内容上。<code> 标签的性能有:将文本变成等宽字体;还有一个性能就是暗示这段文本是源程序代码。那么依据第二个性能,未来浏览器可能会依据本人的理论状况增加成果。例如,程序员的浏览器可能会寻找 <code> 片段,并执行某 些额定的文本格式化解决,如循环和条件判断语句的非凡缩进等。 3、code标签的示例,咱们能够看看上面不加code标签的文本片段和加上code标签的文本片段之间的格局上的区别。须要留神的是,这里只是演示了code标签的第一个性能,至于暗示浏览器这段代码时源程序的性能,须要在具体的浏览器上能力显示。 如下代码在浏览器端的显示成果为:<code> document.getELementById("id1"); document.getELementById("id2"); document.getELementById("id3"); </code> <br> document.getELementById("id4"); pre标签: 1、pre标签的定义,<pre>标签用来定义预格式化的文本,被突围在pre标签中的文本通常会保留空格和换行符, 而文本也会呈现出等宽字体。同样,pre标签的一个常见的利用便是用来保留计算机中的源代码文本。 2、pre标签的性能,pre标签一个常见的利用便是用来保留计算机中的源代码的文本。然而,须要留神的是, 能够导致段落断开的标签(例如题目、<p> 和 <address> 标签)绝不能蕴含在 <pre> 所定义的块里。 pre标签容许的文本能够包含物理款式和基于内容的款式变动,还有链接、图像和程度分隔线。 当把其余标签(比方 <a> 标签)放到 <pre> 块中时,就像放在 HTML/XHTML 文档的其余局部中一样即可。 3、pre标签的示例:上面的代码(html中的源代码) <pre> <html> <head> <script type="text/javascript" src="loadxmldoc.js"> </script> </head> <body> <script type="text/javascript"> xmlDoc=<<font color="blue">a href="dom_loadxmldoc.asp">loadXMLDoc</a></font>("books.xml"); document.write("xmlDoc is loaded, ready for use"); </script> </body> </html> </pre>在浏览器中显示成果为: ...
1、数据库备份的时候启用备份校验和,则会耗费更多资源,备份过程也会更慢2、数据库备份的时候启用备份校验和,备份操作不会向数据库页中增加任何校验和也不会源页面和页面内容,只是把备份校验和存储在备份片上,也就是生成的备份文件上3、如果备份的时候带CHECKSUM参数,则还原这个备份文件时候的时候主动也带CHECKSUM 参数,如果备份的时候不带CHECKSUM参数,则还原的时候默认就是NO_CHECKSUM4、校验和其实就是写入数据的时候同时写入一条校验信息,读取数据的时候会计算一个校验信息,并把这个校验信息和写入的校验信息比拟,如果两个值不匹配,则读取会失败。就像数据库备份的时候如果启用了备份校验和则在备份的同时会往生成的备份文件生成一个备份校验信息,复原的时候也会生成一个备份校验信息,这个时候复原过程生成的备份校验信息匹配上了备份文件的备份校验信息,则复原能够顺利进行5、RESTORE VERIFYONLY仅仅查看文件是否合乎Microsoft Tape Format (MTF)标准,验证备份集是否残缺以及整个备份是否可读。 然而,RESTORE VERIFYONLY 不尝试验证备份卷中的数据结构,即验证数据文件是否损坏,然而不验证备份文件是否含有垃圾数据。什么是垃圾数据,比方你应用一个16进制的编辑器批改了备份文件中存储的数据,这个时候备份文件没有损坏然而有垃圾数据,而后再次运行RESTORE VERIFYONLY依然会返回“备份设施无效(The backup set is valid)”的信息。这种状况下咱们就能够在备份时应用CHECKSUM选项,它会读取数据文件的页校验和或页完好检测并写入备份文件生成备份校验和,前面RESTORE VERIFYONLY的时候就必须验证这个备份文件的备份校验和6、如果有DBCC CHECKDB了,其实Backup备份的时候能够不须要CHECKSUM参数,因为DBCC CHECKDB也会验证页信息,就算是DBCC CHECKDB的PHYSICAL_ONLY页会验证页面完好页、校验和谬误以及常见的硬件故障。PAGE_VERIFY { CHECKSUM校验 | TORN_PAGE_DETECTION完好页 | NONE }7、如果备份的时候没带CHECKSUM 参数,还原的时候加上了CHECKSUM,因为备份文件没有验和,所以还原会报错 Backup备份操作是否启用备份校验和。{ NO_CHECKSUM | CHECKSUM } 管制是否启用备份校验和。 NO_CHECKSUM 显式禁用备份校验和的生成(以及页校验和的验证)。 此选项为默认行为。 CHECKSUM 如果此选项已启用并且可用,则指定备份操作将验证每页的校验和及页完好,并生成整个备份的校验和。应用备份校验和可能会影响工作负荷以及备份吞吐量。 Restore还原操作是否启用备份校验和。{ CHECKSUM | NO_CHECKSUM }反对的语句:RESTORERESTORE FILELISTONLYRESTORE HEADERONLYRESTORE LABELONLY 和 RESTORE VERIFYONLY。默认行为是在存在校验和时验证校验和,在不存在校验和时不进行验证并继续执行操作。也就是说如果备份的时候带CHECKSUM参数,则还原这个游戏备份文件时候的时候主动也带CHECKSUM 参数,如果备份的时候不带CHECKSUM参数,则还原的时候默认就是NO_CHECKSUM CHECKSUM指定必须验证备份校验和,在备份短少备份校验和的状况下,该选项将导致还原操作失败,并会收回一条音讯表明校验和不存在。默认状况下,当遇到有效的校验和时,RESTORE 会报告校验和谬误并进行。 然而,如果指定了 CONTINUE_AFTER_ERROR,RESTORE 会在返回校验和谬误以及蕴含有效校验和的页面编号之后持续。备注1:仅当应用备份校验和时,页校验和才与备份操作相干。备注2:也就是说如果备份的时候没带CHECKSUM 参数,还原的时候加上了CHECKSUM,因为备份文件没有验和,所以还原会报错 NO_CHECKSUM显式禁用还原操作的校验和验证性能。 备份校验和 SQL Server 反对三种校验和:页校验和、日志块校验和以及备份校验和。 生成备份校验和时,BACKUP 将验证从数据库读取的数据是否与数据库中存在的任意校验和或页完好批示统一。BACKUP 语句选择性地计算备份流的备份校验和;如果给定页上存在页校验和或完好页信息,则当备份该页时,BACKUP 还将验证它的校验和、完好页状态以及 ID。 创立备份校验和时,备份操作不会向页中增加任何校验和。 将在这些页位于数据库中时对其进行备份,备份不会批改这些页。因为验证和生成备份校验和引起的开销,应用备份校验和会对性能造成潜在的影响。 工作负荷和备份吞吐量都可能受到影响。 因而,不是必须应用备份校验和。 如果决定在备份过程中生成校验和,请认真监督由此引起的 CPU 开销以及对系统中任何并发工作负荷造成的影响。BACKUP 永远不会批改磁盘上的源页面和页面内容。在启用备份校验和后,备份操作将执行以下步骤:1、向备份介质写入页之前,备份操作将验证页级信息(页校验和或页完好检测)是否存在。 如果两者都不存在,则备份无奈验证页。 将按原样蕴含未经验证的页,并且其内容将增加到总备份校验和中。如果备份操作在验证过程中遇到页谬误,备份将失败。2、无论是否存在页校验和,BACKUP 都会为备份流生成一个独自的备份校验和。 还原操作可应用(可选)备份校验和来验证该备份是否损坏。 备份校验和存储在备份介质上,而不是存储在数据库页上。 备份校验还可依据须要在还原时应用。3、备份集标记为蕴含备份校验和(在 msdb..backupset 的 has_backup_checksums 列中)。 无关详细信息,请参阅 backupset (Transact-SQL)。 ...
一、Yang的起源 早在2003年,IETF成立了一个NETCONF工作组,提出一种基于XML的网络配置管理协定,也就是NETCONF(Network Configuration Protocol),因为该协定的配置性能十分弱小,同时兼顾监控和故障治理,平安验证和访问控制,所以失去业界的统一认可,所以宽泛采纳netconfig来配置网络。 NETCONF协定分为传输层、RPC层、操作层和内容层。其中,内容层是惟一没有标准化的层,于是一种新的建模语言YANG产生了,它的指标是对NETCONF数据模型、操作进行建模,笼罩NETCONF协定的操作层和内容层 二、Yang的根本元素 module module是YANG的根本单元,是写yang文件的根本框架,包含以下几种类型语句: 1、head语句(yang-version/namespace/prefix) 2、连贯语句(import/include)、 3、元信息(organization/contract)、 4、revision语句、 5、定义语句(container/leaf/leaf-list/grouping等等)。 YANG模块有如下的布局: submodule submodule是局部模块定义,用于对模块提供反对。 submodule文件内容布局如下: submodule示例如下: 留神: submodule必须通过belongs-to语句应用, submodule只能由belong-to指定的module或这个指定module的其它submodule进行include,其它module(包含submodule)都不能include。同时子模块不能够import它的父模块 namespace module中必须定义所有节点都属于一个特定的XML命名空间,由一个URI指定命名空间。例如 Import revision import或include语句蕴含一个revision-date的子句,所有引入的YANG定义来自要导入或引入的指定revision模块。通过引入特定的模块订正,咱们能够独立公布演变中的模块。YANG提供了指定的规定,如何公布进化中的模块并且放弃向后的兼容性。比方: YANG的数据类型 根本数据类型 YANG根本数据类型如下。 更加具体的形容请参看rfc6020协定,例如 派生类型 YANG采纳typedef语句来定义派生类型。例如以下是定义一个派生类型percent,限度类型是内建类型uint8: 三、YANG数据节点 leaf leaf定义的节点只有一个值,是一个叶子节点,只能有一个实例。 leaf-list leaf-list定义一组雷同类型的叶节节点,相似数组。与leaf区别在于leaf只有一个游戏实例,而leaf-list能够有多个实例。例如: container container次要定义一个schema树的外部节点,它自身没有任何值和意义,只是作为一系列子节点的父亲存在,只有一个实例。例如 list list形容了一组节点的汇合,它像一张数据库表一样,表的每一行用key来标识其主键,有多个实例。例如 grouping 一个grouping定义一个能够重复使用的节点汇合,应用时通过use语句,并可通过refine语句进行改良。例如 应用grouping时,通过use语句,它会将grouping定义的节点复制到以后的schema树(如果有refine,并进行更新)。 choice 一个choice节点定义了一个可供选择项的汇合,每一个选择项都会在某种状况下存在。一个choice由许多分枝,通过case子语句定义。比方 anyxml anyxml示意任何未知的数据定义。 augment YANG提供augment语句,扩充一个模块档次,将节点增加到一个已存在的模块或子模块当中。指标结点能够是一个container, list, choice, case, rpc, input, output, notification等。 augment能够是条件的,应用when,www.sangpi.com语句,当特定条件满足时,新节点才会呈现。 notification notification语句用来定义Notification内容,内容数据的定义同YANG数据定义一样。上面例子应用上文例子定义的connection。 rpc rpc语句用来定义NETCONF协定的RPCs,input和output应用YANG数据定义语句。如下例子,建模一个激活软件图片的RPC:
后面咱们理解了 etcd 的集群搭建模式,也理解了如何在 Kubernetes 集群中来部署 etcd 集群,要开发一个对应的 Operator 其实也就是让咱们用代码去实现 etcd 的这一系列的运维工作而已,说白了就是把 StatefulSet 中的启动脚本翻译成咱们的 golang 代码。这里咱们分成不同的版本来渐进式开发,首先第一个版本咱们开发一个最简略的 Operator,间接用咱们的 Operator 去生成后面的 StatefulSet 模板即可。 我的项目初始化同样在开发 Operator 之前咱们须要先提前想好咱们的 CRD 资源对象,比方咱们想要通过上面的 CR 资源来创立对应的 etcd 集群: apiVersion: etcd.ydzs.io/v1alpha1kind: EtcdClustermetadata: name: demospec: size: 3 # 正本数量 image: cnych/etcd:v3.4.13 # 镜像因为其余信息都是通过脚本获取的,所以基本上咱们通过 size 和 image 两个字段就能够确定一个 Etcd 集群部署的样子了,所以咱们的第一个版本非常简单,只有可能写出正确的部署脚本即可,而后咱们在 Operator 当中依据下面咱们定义的 EtcdCluster 这个 CR 资源来组装一个 游戏StatefulSet 和 Headless SVC 对象就能够了。 首先初始化我的项目,这里咱们应用 kubebuilder 来构建咱们的脚手架: ➜ kubebuilder init --domain ydzs.io --owner cnych --repo github.com/cnych/etcd-operatorWriting scaffold for you to edit...Get controller runtime:$ go get sigs.k8s.io/controller-runtime@v0.5.0Update go.mod:$ go mod tidyRunning make:$ make/Users/ych/devs/projects/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."go fmt ./...go vet ./...go build -o bin/manager main.goNext: define a resource with:$ kubebuilder create api我的项目脚手架创立实现后,而后定义资源 API: ...
在Javaweb我的项目开发中为了便于前期的保护,咱们个别会进行分层开发,常见的就是分为model(域模型层)、dao(数据库拜访层)、service(业务逻辑层)、controller(控制器层)、web(体现层),这样分层之后,各个层之间的职责会比拟明确,前期保护起来也绝对比拟容易。 后面咱们开发都是在一个模块中,把不同的层以包来辨别,如下: 1、创立SpringBoot我的项目 构造为: 1 游戏代码别离是: public class User { private String username; private String password; private String realname; ...省略get\set 构造方法 } @Repository public class UserDAO { public List<User> selectAllUsers(){ return Arrays.asList(new User("zhangsan","111","张三"), new User("lisi","111","李四"), new User("wangwu","111","王五")); } } @Service public class UserService { @Resource private UserDAO userDAO; public List<User> findAllUsers(){ return userDAO.selectAllUsers(); ...
明天的知识点 (2021.05.23) —— 第768天 (我也要出题)[html] 写一个布局,你认为最要害的中央是什么?[css] 写一个隔行变色的款式[js] 给定一个数,计算出它们任意3个数组合有多少种[软技能] 对于色彩的常识你理解多少?《论语》,曾子曰:“吾日三省吾身”(我每天屡次检查本人)。前端面试每日3+1题,以面试题来驱动学习,每天提高一点!让致力成为一种习惯,让奋斗成为一种享受!置信 保持 的力量!!! 欢送在 Issues 和敌人们一起探讨学习! 我的项目地址:前端面试每日3+1【举荐】欢送跟 jsliang 一起折腾前端,零碎整顿前端常识,目前正在折腾 LeetCode,打算买通算法与数据结构的任督二脉。GitHub 地址 微信公众号欢送大家前来探讨,如果感觉对你的学习有肯定的帮忙,欢送点个Star, 同时欢送微信扫码关注 前端剑解 公众号,并退出 “前端学习每日3+1” 微信群互相交换(点击公众号的菜单:交换)。 学习不打烊,充电加油只为遇到更好的本人,365天无节假日,每天早上5点纯手工公布面试题(死磕本人,愉悦大家)。心愿大家在这虚夸的前端圈里,放弃沉着,保持每天花20分钟来学习与思考。在这变幻无穷,类库层出不穷的前端,倡议大家不要等到找工作时,才狂刷题,提倡每日学习!(不忘初心,html、css、javascript才是基石!)欢送大家到Issues交换,激励PR,感激Star,大家有啥好的倡议能够加我微信一起交换探讨! 心愿大家每日去学习与思考,这才达到来这里的目标!!!(不要为了谁而来,要为本人而来!)交换探讨欢送大家前来探讨,如果感觉对你的学习有肯定的帮忙,欢送点个[Star]
1.如何了解HTML语义化?答:HTML语义化,即应用如header,footer,aside,p,ul,ol等具备语义的标签来代替无语义的div,span标签,加强可读性,便于团队开发和保护,也利于SEO。2.块级元素和内联元素有哪些?答:https://www.cnblogs.com/gujun...
首先明确什么是底层开发,这个界线很难划分,有人说搞音视频底层编解码就是底层了,然而咱们看来不是这样,上面还有rom中音视频模块,再上面还有driver,最初到物理硬件。那么咱们权且这么划分,以是否有大量的的业务逻辑为界线。业务逻辑,个别就是和产品状态紧密连接。以音视频为例,下层播放利用,会接入数据、UI等产品需要。上层播放内核,次要以播放器为核心,对音视频数据注入,解码,渲染。 咱们从几个方面看下应用层和底层 1、游戏市场需求 应用层工作机会往往较多,如10个工作,9个是应用层相干。毕竟企业或是公司都是商业化,都是围绕产品开发。而底层是撑持应用层。很多公司也不须要底层开发。因为齐全能够用第三方的解决方案。能够在肯定水平上节俭公司人力物力。所以很多底层开发都是在略微具备肯定规模的公司才有。从这点上看,底层确实有点坑。 2、游戏开发难度 个别底层开发都是用c/c++实现,应用层开发很多都是java/php等这些高级语言实现,不排除一些工业级软件应用c++开发,从上手来说,纯熟c/c++相比于纯熟java开发,周期会更长。但并不是说java就不好,java能写那么多很棒的利用,这点上c/c++比不上的。然而个别有些特色一点的货色,如在Android平台上,都会放到Native中开发。一方面是效率晋升,另外就是平安。 3、游戏倒退方向 底层走的是窄、精路线,工作年限越长,对于集体专家能力越有进步。应用层走的是广、多路线。工作年限越长,对软件 架构设计越强,当然也是能够锤炼专家能力。应用层变动多,参加改革的机会会多很多,底层改变少,不是特容易有这样机会。齐全看个人兴趣。就好比这www.sangpi.com用了将近3年的工夫去摸索,而后依据本人的兴趣爱好去做。 4、薪资待遇 这里只探讨专家工程师,不探讨走治理路线的。底层待遇比应用层多,随年限减少,呈趋势。 最初,不要认为底层有前途,做应用层一样有前途。有人说,做底层,看起来很厉害的样子,这些都不是重点。重要是投入进去,精益求精。下层的货色更有意思,更有倒退空间。不仅是要面对灵便多变的需要,各种性能,把这些货色组织成一个产品就是十分考验能力的。光谈技术,怎么搭建架构?要做一件事件有多种抉择的时候,如何抉择?如何保障稳定性?如何放弃扩展性?如何不在不必要的中央节约精力?如何进步开发效率?而底层,眼前的一些细节就曾经让人很伤脑筋了,好不容易解决,也没有方法去思考能不能做得更好更牢靠。老做底层,很容易只见树木不见森林。至于支出方面,很可能底层开发因为技术更新慢,所以更容易积攒,单纯做技术的时候薪水就容易回升。而做下层,游戏技术更新快,新涌入的人也多,得继续努力学习,开辟视线。做完底层的人,更喜爱做下层,这样既然能领略森林之美,当然是森林更适宜你。
* 防抖函数:debounce.js let timeout = null;/** 肯定工夫内,只有最初一次操作,再过wait毫秒后才执行函数 * * @param {Function} func 要执行的回调函数 * @param {Number} wait 延时的工夫 * @param {Boolean} immediate 是否立刻执行 * @return null */function debounce(func, wait = 500, immediate = false) { // 革除定时器 if (timeout !== null) clearTimeout(timeout); // 立刻执行,此类情况个别用不到 if (immediate) { var callNow = !timeout; timeout = setTimeout(function() { timeout = null; }, wait); if (callNow) typeof func === 'function' && func(); } else { // 设置定时器,当最初一次操作后,timeout不会再被革除,所以在延时wait毫秒后执行func回调办法 timeout = setTimeout(function() { typeof func === 'function' && func(); }, wait); }}export default debounce-节流函数 ...
代码来自头条号"前端小智", 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>波浪</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ background-color: #000; position: relative; width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; overflow: hidden; } .wave{ width: 100%; height: 100%; background-color: #4973ff; position: absolute; top: 0; left: 0; } span{ position: absolute; width: 325vh; height: 325vh; top: 0; left: 50%; transform: translate(-50%, -75%); background-color: #000; } span:nth-child(1){ animation: animate 5s linear infinite; border-radius: 45%; background-color: rgba(0, 0, 0, 1); } span:nth-child(2){ animation: animate 5s linear infinite; border-radius: 40%; background-color: rgba(0, 0, 0, .5); } span:nth-child(3){ animation: animate 5s linear infinite; border-radius: 42.5%; background-color: rgba(0, 0, 0, .5); } @keyframes animate { 0%{ transform: translate(-50%, -75%) rotate(0deg); } 100%{ transform: translate(-50%, -75%) rotate(360deg); } } .content{ color: #fff; font-size: 4em; position: relative; z-index: 1; } </style></head><body> <div class="wave"> <span></span> <span></span> <span></span> </div> <div class="content"> <h2>wave content</h2> </div></body></html>
代码来自头条号"前端小智", 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>聚光加载特效</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ height: 100vh; background-color: #000; display: flex; justify-content: center; align-items: center; } .container{ width: 100%; position: relative; display: flex; justify-content: center; align-items: center; -webkit-box-reflect: below 1px linear-gradient(#0001, #0004); } .loader{ width: 200px; height: 200px; background-color: #0d2323; border-radius: 50%; position: relative; animation: animate 2s linear infinite; } @keyframes animate { 0%{ transform: rotate(0deg); } 100%{ transform: rotate(360deg) } } .loader::before{ content: ""; width: 50%; height: 100%; position: absolute; top: 0; left: 0; background: linear-gradient(to top, transparent, rgba(0, 255, 249, .4)); background-size: 100px 180px ; background-repeat: no-repeat; border-top-left-radius: 100px; border-bottom-left-radius: 100px; } .loader::after{ content: ""; width: 20px; height: 20px; border-radius: 50%; position:absolute; top: 0; left: 50%; transform: translateX(-50%); background: #00fff9; box-shadow: 0px 0px 10px #00fff9, 0px 0px 20px #00fff9, 0px 0px 30px #00fff9, 0px 0px 40px #00fff9, 0px 0px 50px #00fff9, 0px 0px 60px #00fff9, 0px 0px 70px #00fff9, 0px 0px 80px #00fff9, 0px 0px 90px #00fff9, 0px 0px 100px #00fff9; } span{ position: absolute; top: 20px; left: 20px; bottom: 20px; right: 20px; border-radius: 50%; background: #000; } </style></head><body> <div class="container"> <div class="loader"><span></span></div> </div></body></html>
代码来自头条号'前端小智', 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>文字加载</title> <style> /*思路是 上面一层文字, 下面一层文字, 应用动画扭转下面文字的宽度 */ *{ margin: 0; padding: 0; box-sizing: border-box; } body{ display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #000; } h2{ position: relative; font-size: 14vw; text-transform: uppercase; color: #252839; -webkit-text-stroke: 0.3vw #283d52; /*字体的描边*/ } h2::before{ content: attr(data-text); position: absolute; top: 0; left: 0; color: #01fe87; width: 100%; height: 100%; -webkit-text-stroke: 0vw #383d52; border-right:1px solid #01fe87 ; overflow: hidden; animation: animate 6s linear infinite; } @keyframes animate { 0%, 10%, 100%{ width: 0; } 70%{ width: 100%; } } </style></head><body> <h2 data-text='creative...'>creative...</h2></body></html>
代码来自头条号'前端小智', 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #1c1f2f; } .container{ position: relative; -webkit-box-reflect: below 1px linear-gradient(transparent, #0001); } .loader{ position: relative; width: 200px; height: 200px; border-radius: 50%; border: 20px solid transparent; border-bottom: 20px solid #06c8f0; border-right: 20px solid #06c8f0; transform: rotate(45deg); animation: boat 4s ease-in-out infinite; } @keyframes boat { 0%, 100%{ transform: rotate(0deg); } 50%{ transform: rotate(90deg); } } .ball{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; animation: ball 4s ease-in-out infinite; /* background-color: blue; */ } .ball::before{ content: ''; width: 40px; height: 40px; background-color: #fff; border-radius: 50%; position: absolute; right: 15px; bottom: 50%; transform: translateY(-50%); } @keyframes ball { 0%{ transform: rotate(0deg) } 50%{ transform: rotate(180deg); } 100%{ transform: rotate(0deg) } } </style></head><body> <div class="container"> <div class="loader"> <div class="ball"></div> </div> </div></body></html>
在接手门户的相干工作后,网站的注册登录模块在不长不短的工夫里,也经验过屡次改版和迭代,也延长反对了越来越多的相干性能。放在任何一个网站,注册登录的性能都是最一般,最常见的性能,从底层技术架构来说,实现路径也并无二致。 然而!从数据分析来看,仍然有大量可恶的用户曾经关上了注册页面想要成为咱们的用户,然而却没能通过咱们的注册步骤,最终成为咱们用户数量的+1. 这不迷信啊!注册个会员,多简略的事儿啊,填个用户名,写个手机号,在写个密码保护下本人的平安,点击注册,Bingo,有那么难么? 用户爸爸:“我不要你感觉简略,我要我感觉简略” 毕竟就算你的网站/产品/内容好玩的不得了,厉害到爆炸,用户连注册都感觉麻烦,其余的都是空谈不是~ 懊恼一:想个网名好难啊!最后的用户注册,第一步都是须要输出一个用户名的,简略来说,就是惟一标实本人的昵称,嗯,就叫“高老庄猪八戒”吧,点确认,“对不起,该用户已存在”,那简略点,轻易输一串“123456”,“对不起,该用户已存在” 。。。。行,你狠!鼠标一点,从此江湖再见这第一步填用户名,就劝退了。既要惟一标实,又要好记好想,把这样一件看起来简略实际上还挺有挑战的事件上来就交给用户本人,显然和嗯嗯多喝热水的渣男也没啥区别了。 要疏导用户填写适合的用户名,什么样的用户名不容易反复而且用户爸爸又不太会遗记呢,当然是手机号啊!手机号码的实名制、全球通业务的遍及,使得手机号码也具备了惟一标示性。而且在挪动互联网时代,用手机号码作为登录ID,并用短信验证码的模式来验证ID,这些操作流程都基于手机端。所以手机号码逐步取代邮箱成为APP注册登录的支流形式。 不要让用户本人想用户名,就疏导他们留手机号,格局标准,不会遗记,客服未来还不便分割,不香么! Tips: 不要把须要思考的内容留给用户,要让他们能轻松get到须要填什么,“这题我会”的高兴,你设想不到 懊恼二:明码简略钱没了,明码简单老爷我记不住在相当长一段时间内,我司的注册/登录都保留了两套逻辑:手机号验证码注册/登录,用户名明码注册/登录。有一次产品经理过去找咱们一起看数据,发现绝大多数用户,都抉择了手机验证码的登录,大量的用户除了不想记用户名,也不想记明码啊。 Tips:用手机验证码登录,动静明码,不须要记住,更容易被用户承受 懊恼三:我3个月才想起来看下你们网站,我TM也不记得注册过没有啊!这个问题也是咱们比拟常遇见的问题,那有没有什么模式能够不太须要去让用户感知到底是须要注册还是须要登录呢?通过前两次的大刀阔斧的砍性能,不必明码,不必用户名,其实当初用户只须要手机号和验证码就能够登录/注册了。等等,听起来,注册和登录,须要的信息没什么区别啊!是的,真的没啥区别了,所以其实在UI层面,咱们其实并不再依赖用户本人来判断是注册行为还是登录行为了。能匹配到手机号,就间接胜利登录,没能匹配到手机号,就执行注册的流程,岂不是两败俱伤。 懊恼四:我没有手机号!我没有名字!这种。。。听下来有点不可理喻了,可是真的能够什么注册信息都不要就能注册么?还真能够。用户能够间接抉择第三方账号就能实现登录。国内常见的第三方账号有微博、微信、QQ、豆瓣、人人等,国外常见的第三方账号有Facebook,Twitter,Google等。 当初国内除了超级APP之外的APP根本都反对第三方账号登录,这样能简化用户注册登录的流程,进步APP的用户转化率。 还有更多在做迭代的时候,也看了网上不少人的做法,有些在展示、谬误提醒、输出习惯上的细节优化也值得学习,一并列在上面了 用显示/暗藏icon代替输出两遍明码为了确保明码输出正确,很多APP须要用户输出两遍明码来确定明码输出无误,但这无疑减少了用户的工作量。代替计划是在明码输入框右侧减少一个“显示/暗藏icon”,让用户在输出完一遍明码后能够抉择点开“显示/暗藏icon”来确保明码输出无误,缩小用户的工作量。 对手机号码进行3 4 4的散布这个规定不仅实用于手机号码,包含银行账号、转账金额等等。这是因为人的短期记忆是无限的,即一次只能记住无限的货色,如果强制记住很长的货色,短期记忆就很容易出错。 所以将数字以4或者3为单位分组,有利于用户浏览、编辑、校对手机号码。 登录时减少一键清空icon在登录的时候偶然会呈现输出谬误,如果没有这个革除的icon,用户只能按键盘中的革除按钮,须要始终按住直到输入框为空。 一个是只须要点一次就能清空,一个须要长按一段时间或者间断按屡次能力清空,孰优孰劣可想而知。 如非必要,注册时默认勾选批准注册协定默认勾选批准隐衷协定与注册协定,防止用户进行不必要的操作。 登录注册切换时,主动将两种界面匹配的数据转填(不须要)反馈提醒,用 Toast以小见大:如何设计注册登录页? http://www.woshipm.com/pd/452...怎么进步注册登录流程的交互体验 https://zhuanlan.zhihu.com/p/...
代码来自头条号'前端小智', 侵权删次要应用的就是particles.js插件,倡议之间看视频https://m.toutiaoimg.cn/group...html文件: <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>粒子特效</title> <style> *{ margin: 0; padding: 0; } section{ width: 100%; height: 100vh; position: absolute; background: #111; } </style></head><body> <section id="particles-js"> </section> <script src="./particles.js"></script> <script src="./app.js"></script></body></html>particles.js文件: /* -----------------------------------------------/* Author : Vincent Garreau - vincentgarreau.com/* MIT license: http://opensource.org/licenses/MIT/* Demo / Generator : vincentgarreau.com/particles.js/* GitHub : github.com/VincentGarreau/particles.js/* How to use? : Check the GitHub README/* v2.0.0/* ----------------------------------------------- */var pJS = function(tag_id, params){ var canvas_el = document.querySelector('#'+tag_id+' > .particles-js-canvas-el'); /* particles.js variables with default values */ this.pJS = { canvas: { el: canvas_el, w: canvas_el.offsetWidth, h: canvas_el.offsetHeight }, particles: { number: { value: 400, density: { enable: true, value_area: 800 } }, color: { value: '#fff' }, shape: { type: 'circle', stroke: { width: 0, color: '#ff0000' }, polygon: { nb_sides: 5 }, image: { src: '', width: 100, height: 100 } }, opacity: { value: 1, random: false, anim: { enable: false, speed: 2, opacity_min: 0, sync: false } }, size: { value: 20, random: false, anim: { enable: false, speed: 20, size_min: 0, sync: false } }, line_linked: { enable: true, distance: 100, color: '#fff', opacity: 1, width: 1 }, move: { enable: true, speed: 2, direction: 'none', random: false, straight: false, out_mode: 'out', bounce: false, attract: { enable: false, rotateX: 3000, rotateY: 3000 } }, array: [] }, interactivity: { detect_on: 'canvas', events: { onhover: { enable: true, mode: 'grab' }, onclick: { enable: true, mode: 'push' }, resize: true }, modes: { grab:{ distance: 100, line_linked:{ opacity: 1 } }, bubble:{ distance: 200, size: 80, duration: 0.4 }, repulse:{ distance: 200, duration: 0.4 }, push:{ particles_nb: 4 }, remove:{ particles_nb: 2 } }, mouse:{} }, retina_detect: false, fn: { interact: {}, modes: {}, vendors:{} }, tmp: {} }; var pJS = this.pJS; /* params settings */ if(params){ Object.deepExtend(pJS, params); } pJS.tmp.obj = { size_value: pJS.particles.size.value, size_anim_speed: pJS.particles.size.anim.speed, move_speed: pJS.particles.move.speed, line_linked_distance: pJS.particles.line_linked.distance, line_linked_width: pJS.particles.line_linked.width, mode_grab_distance: pJS.interactivity.modes.grab.distance, mode_bubble_distance: pJS.interactivity.modes.bubble.distance, mode_bubble_size: pJS.interactivity.modes.bubble.size, mode_repulse_distance: pJS.interactivity.modes.repulse.distance }; pJS.fn.retinaInit = function(){ if(pJS.retina_detect && window.devicePixelRatio > 1){ pJS.canvas.pxratio = window.devicePixelRatio; pJS.tmp.retina = true; } else{ pJS.canvas.pxratio = 1; pJS.tmp.retina = false; } pJS.canvas.w = pJS.canvas.el.offsetWidth * pJS.canvas.pxratio; pJS.canvas.h = pJS.canvas.el.offsetHeight * pJS.canvas.pxratio; pJS.particles.size.value = pJS.tmp.obj.size_value * pJS.canvas.pxratio; pJS.particles.size.anim.speed = pJS.tmp.obj.size_anim_speed * pJS.canvas.pxratio; pJS.particles.move.speed = pJS.tmp.obj.move_speed * pJS.canvas.pxratio; pJS.particles.line_linked.distance = pJS.tmp.obj.line_linked_distance * pJS.canvas.pxratio; pJS.interactivity.modes.grab.distance = pJS.tmp.obj.mode_grab_distance * pJS.canvas.pxratio; pJS.interactivity.modes.bubble.distance = pJS.tmp.obj.mode_bubble_distance * pJS.canvas.pxratio; pJS.particles.line_linked.width = pJS.tmp.obj.line_linked_width * pJS.canvas.pxratio; pJS.interactivity.modes.bubble.size = pJS.tmp.obj.mode_bubble_size * pJS.canvas.pxratio; pJS.interactivity.modes.repulse.distance = pJS.tmp.obj.mode_repulse_distance * pJS.canvas.pxratio; }; /* ---------- pJS functions - canvas ------------ */ pJS.fn.canvasInit = function(){ pJS.canvas.ctx = pJS.canvas.el.getContext('2d'); }; pJS.fn.canvasSize = function(){ pJS.canvas.el.width = pJS.canvas.w; pJS.canvas.el.height = pJS.canvas.h; if(pJS && pJS.interactivity.events.resize){ window.addEventListener('resize', function(){ pJS.canvas.w = pJS.canvas.el.offsetWidth; pJS.canvas.h = pJS.canvas.el.offsetHeight; /* resize canvas */ if(pJS.tmp.retina){ pJS.canvas.w *= pJS.canvas.pxratio; pJS.canvas.h *= pJS.canvas.pxratio; } pJS.canvas.el.width = pJS.canvas.w; pJS.canvas.el.height = pJS.canvas.h; /* repaint canvas on anim disabled */ if(!pJS.particles.move.enable){ pJS.fn.particlesEmpty(); pJS.fn.particlesCreate(); pJS.fn.particlesDraw(); pJS.fn.vendors.densityAutoParticles(); } /* density particles enabled */ pJS.fn.vendors.densityAutoParticles(); }); } }; pJS.fn.canvasPaint = function(){ pJS.canvas.ctx.fillRect(0, 0, pJS.canvas.w, pJS.canvas.h); }; pJS.fn.canvasClear = function(){ pJS.canvas.ctx.clearRect(0, 0, pJS.canvas.w, pJS.canvas.h); }; /* --------- pJS functions - particles ----------- */ pJS.fn.particle = function(color, opacity, position){ /* size */ this.radius = (pJS.particles.size.random ? Math.random() : 1) * pJS.particles.size.value; if(pJS.particles.size.anim.enable){ this.size_status = false; this.vs = pJS.particles.size.anim.speed / 100; if(!pJS.particles.size.anim.sync){ this.vs = this.vs * Math.random(); } } /* position */ this.x = position ? position.x : Math.random() * pJS.canvas.w; this.y = position ? position.y : Math.random() * pJS.canvas.h; /* check position - into the canvas */ if(this.x > pJS.canvas.w - this.radius*2) this.x = this.x - this.radius; else if(this.x < this.radius*2) this.x = this.x + this.radius; if(this.y > pJS.canvas.h - this.radius*2) this.y = this.y - this.radius; else if(this.y < this.radius*2) this.y = this.y + this.radius; /* check position - avoid overlap */ if(pJS.particles.move.bounce){ pJS.fn.vendors.checkOverlap(this, position); } /* color */ this.color = {}; if(typeof(color.value) == 'object'){ if(color.value instanceof Array){ var color_selected = color.value[Math.floor(Math.random() * pJS.particles.color.value.length)]; this.color.rgb = hexToRgb(color_selected); }else{ if(color.value.r != undefined && color.value.g != undefined && color.value.b != undefined){ this.color.rgb = { r: color.value.r, g: color.value.g, b: color.value.b } } if(color.value.h != undefined && color.value.s != undefined && color.value.l != undefined){ this.color.hsl = { h: color.value.h, s: color.value.s, l: color.value.l } } } } else if(color.value == 'random'){ this.color.rgb = { r: (Math.floor(Math.random() * (255 - 0 + 1)) + 0), g: (Math.floor(Math.random() * (255 - 0 + 1)) + 0), b: (Math.floor(Math.random() * (255 - 0 + 1)) + 0) } } else if(typeof(color.value) == 'string'){ this.color = color; this.color.rgb = hexToRgb(this.color.value); } /* opacity */ this.opacity = (pJS.particles.opacity.random ? Math.random() : 1) * pJS.particles.opacity.value; if(pJS.particles.opacity.anim.enable){ this.opacity_status = false; this.vo = pJS.particles.opacity.anim.speed / 100; if(!pJS.particles.opacity.anim.sync){ this.vo = this.vo * Math.random(); } } /* animation - velocity for speed */ var velbase = {} switch(pJS.particles.move.direction){ case 'top': velbase = { x:0, y:-1 }; break; case 'top-right': velbase = { x:0.5, y:-0.5 }; break; case 'right': velbase = { x:1, y:-0 }; break; case 'bottom-right': velbase = { x:0.5, y:0.5 }; break; case 'bottom': velbase = { x:0, y:1 }; break; case 'bottom-left': velbase = { x:-0.5, y:1 }; break; case 'left': velbase = { x:-1, y:0 }; break; case 'top-left': velbase = { x:-0.5, y:-0.5 }; break; default: velbase = { x:0, y:0 }; break; } if(pJS.particles.move.straight){ this.vx = velbase.x; this.vy = velbase.y; if(pJS.particles.move.random){ this.vx = this.vx * (Math.random()); this.vy = this.vy * (Math.random()); } }else{ this.vx = velbase.x + Math.random()-0.5; this.vy = velbase.y + Math.random()-0.5; } // var theta = 2.0 * Math.PI * Math.random(); // this.vx = Math.cos(theta); // this.vy = Math.sin(theta); this.vx_i = this.vx; this.vy_i = this.vy; /* if shape is image */ var shape_type = pJS.particles.shape.type; if(typeof(shape_type) == 'object'){ if(shape_type instanceof Array){ var shape_selected = shape_type[Math.floor(Math.random() * shape_type.length)]; this.shape = shape_selected; } }else{ this.shape = shape_type; } if(this.shape == 'image'){ var sh = pJS.particles.shape; this.img = { src: sh.image.src, ratio: sh.image.width / sh.image.height } if(!this.img.ratio) this.img.ratio = 1; if(pJS.tmp.img_type == 'svg' && pJS.tmp.source_svg != undefined){ pJS.fn.vendors.createSvgImg(this); if(pJS.tmp.pushing){ this.img.loaded = false; } } } }; pJS.fn.particle.prototype.draw = function() { var p = this; if(p.radius_bubble != undefined){ var radius = p.radius_bubble; }else{ var radius = p.radius; } if(p.opacity_bubble != undefined){ var opacity = p.opacity_bubble; }else{ var opacity = p.opacity; } if(p.color.rgb){ var color_value = 'rgba('+p.color.rgb.r+','+p.color.rgb.g+','+p.color.rgb.b+','+opacity+')'; }else{ var color_value = 'hsla('+p.color.hsl.h+','+p.color.hsl.s+'%,'+p.color.hsl.l+'%,'+opacity+')'; } pJS.canvas.ctx.fillStyle = color_value; pJS.canvas.ctx.beginPath(); switch(p.shape){ case 'circle': pJS.canvas.ctx.arc(p.x, p.y, radius, 0, Math.PI * 2, false); break; case 'edge': pJS.canvas.ctx.rect(p.x-radius, p.y-radius, radius*2, radius*2); break; case 'triangle': pJS.fn.vendors.drawShape(pJS.canvas.ctx, p.x-radius, p.y+radius / 1.66, radius*2, 3, 2); break; case 'polygon': pJS.fn.vendors.drawShape( pJS.canvas.ctx, p.x - radius / (pJS.particles.shape.polygon.nb_sides/3.5), // startX p.y - radius / (2.66/3.5), // startY radius*2.66 / (pJS.particles.shape.polygon.nb_sides/3), // sideLength pJS.particles.shape.polygon.nb_sides, // sideCountNumerator 1 // sideCountDenominator ); break; case 'star': pJS.fn.vendors.drawShape( pJS.canvas.ctx, p.x - radius*2 / (pJS.particles.shape.polygon.nb_sides/4), // startX p.y - radius / (2*2.66/3.5), // startY radius*2*2.66 / (pJS.particles.shape.polygon.nb_sides/3), // sideLength pJS.particles.shape.polygon.nb_sides, // sideCountNumerator 2 // sideCountDenominator ); break; case 'image': function draw(){ pJS.canvas.ctx.drawImage( img_obj, p.x-radius, p.y-radius, radius*2, radius*2 / p.img.ratio ); } if(pJS.tmp.img_type == 'svg'){ var img_obj = p.img.obj; }else{ var img_obj = pJS.tmp.img_obj; } if(img_obj){ draw(); } break; } pJS.canvas.ctx.closePath(); if(pJS.particles.shape.stroke.width > 0){ pJS.canvas.ctx.strokeStyle = pJS.particles.shape.stroke.color; pJS.canvas.ctx.lineWidth = pJS.particles.shape.stroke.width; pJS.canvas.ctx.stroke(); } pJS.canvas.ctx.fill(); }; pJS.fn.particlesCreate = function(){ for(var i = 0; i < pJS.particles.number.value; i++) { pJS.particles.array.push(new pJS.fn.particle(pJS.particles.color, pJS.particles.opacity.value)); } }; pJS.fn.particlesUpdate = function(){ for(var i = 0; i < pJS.particles.array.length; i++){ /* the particle */ var p = pJS.particles.array[i]; // var d = ( dx = pJS.interactivity.mouse.click_pos_x - p.x ) * dx + ( dy = pJS.interactivity.mouse.click_pos_y - p.y ) * dy; // var f = -BANG_SIZE / d; // if ( d < BANG_SIZE ) { // var t = Math.atan2( dy, dx ); // p.vx = f * Math.cos(t); // p.vy = f * Math.sin(t); // } /* move the particle */ if(pJS.particles.move.enable){ var ms = pJS.particles.move.speed/2; p.x += p.vx * ms; p.y += p.vy * ms; } /* change opacity status */ if(pJS.particles.opacity.anim.enable) { if(p.opacity_status == true) { if(p.opacity >= pJS.particles.opacity.value) p.opacity_status = false; p.opacity += p.vo; }else { if(p.opacity <= pJS.particles.opacity.anim.opacity_min) p.opacity_status = true; p.opacity -= p.vo; } if(p.opacity < 0) p.opacity = 0; } /* change size */ if(pJS.particles.size.anim.enable){ if(p.size_status == true){ if(p.radius >= pJS.particles.size.value) p.size_status = false; p.radius += p.vs; }else{ if(p.radius <= pJS.particles.size.anim.size_min) p.size_status = true; p.radius -= p.vs; } if(p.radius < 0) p.radius = 0; } /* change particle position if it is out of canvas */ if(pJS.particles.move.out_mode == 'bounce'){ var new_pos = { x_left: p.radius, x_right: pJS.canvas.w, y_top: p.radius, y_bottom: pJS.canvas.h } }else{ var new_pos = { x_left: -p.radius, x_right: pJS.canvas.w + p.radius, y_top: -p.radius, y_bottom: pJS.canvas.h + p.radius } } if(p.x - p.radius > pJS.canvas.w){ p.x = new_pos.x_left; p.y = Math.random() * pJS.canvas.h; } else if(p.x + p.radius < 0){ p.x = new_pos.x_right; p.y = Math.random() * pJS.canvas.h; } if(p.y - p.radius > pJS.canvas.h){ p.y = new_pos.y_top; p.x = Math.random() * pJS.canvas.w; } else if(p.y + p.radius < 0){ p.y = new_pos.y_bottom; p.x = Math.random() * pJS.canvas.w; } /* out of canvas modes */ switch(pJS.particles.move.out_mode){ case 'bounce': if (p.x + p.radius > pJS.canvas.w) p.vx = -p.vx; else if (p.x - p.radius < 0) p.vx = -p.vx; if (p.y + p.radius > pJS.canvas.h) p.vy = -p.vy; else if (p.y - p.radius < 0) p.vy = -p.vy; break; } /* events */ if(isInArray('grab', pJS.interactivity.events.onhover.mode)){ pJS.fn.modes.grabParticle(p); } if(isInArray('bubble', pJS.interactivity.events.onhover.mode) || isInArray('bubble', pJS.interactivity.events.onclick.mode)){ pJS.fn.modes.bubbleParticle(p); } if(isInArray('repulse', pJS.interactivity.events.onhover.mode) || isInArray('repulse', pJS.interactivity.events.onclick.mode)){ pJS.fn.modes.repulseParticle(p); } /* interaction auto between particles */ if(pJS.particles.line_linked.enable || pJS.particles.move.attract.enable){ for(var j = i + 1; j < pJS.particles.array.length; j++){ var p2 = pJS.particles.array[j]; /* link particles */ if(pJS.particles.line_linked.enable){ pJS.fn.interact.linkParticles(p,p2); } /* attract particles */ if(pJS.particles.move.attract.enable){ pJS.fn.interact.attractParticles(p,p2); } /* bounce particles */ if(pJS.particles.move.bounce){ pJS.fn.interact.bounceParticles(p,p2); } } } } }; pJS.fn.particlesDraw = function(){ /* clear canvas */ pJS.canvas.ctx.clearRect(0, 0, pJS.canvas.w, pJS.canvas.h); /* update each particles param */ pJS.fn.particlesUpdate(); /* draw each particle */ for(var i = 0; i < pJS.particles.array.length; i++){ var p = pJS.particles.array[i]; p.draw(); } }; pJS.fn.particlesEmpty = function(){ pJS.particles.array = []; }; pJS.fn.particlesRefresh = function(){ /* init all */ cancelRequestAnimFrame(pJS.fn.checkAnimFrame); cancelRequestAnimFrame(pJS.fn.drawAnimFrame); pJS.tmp.source_svg = undefined; pJS.tmp.img_obj = undefined; pJS.tmp.count_svg = 0; pJS.fn.particlesEmpty(); pJS.fn.canvasClear(); /* restart */ pJS.fn.vendors.start(); }; /* ---------- pJS functions - particles interaction ------------ */ pJS.fn.interact.linkParticles = function(p1, p2){ var dx = p1.x - p2.x, dy = p1.y - p2.y, dist = Math.sqrt(dx*dx + dy*dy); /* draw a line between p1 and p2 if the distance between them is under the config distance */ if(dist <= pJS.particles.line_linked.distance){ var opacity_line = pJS.particles.line_linked.opacity - (dist / (1/pJS.particles.line_linked.opacity)) / pJS.particles.line_linked.distance; if(opacity_line > 0){ /* style */ var color_line = pJS.particles.line_linked.color_rgb_line; pJS.canvas.ctx.strokeStyle = 'rgba('+color_line.r+','+color_line.g+','+color_line.b+','+opacity_line+')'; pJS.canvas.ctx.lineWidth = pJS.particles.line_linked.width; //pJS.canvas.ctx.lineCap = 'round'; /* performance issue */ /* path */ pJS.canvas.ctx.beginPath(); pJS.canvas.ctx.moveTo(p1.x, p1.y); pJS.canvas.ctx.lineTo(p2.x, p2.y); pJS.canvas.ctx.stroke(); pJS.canvas.ctx.closePath(); } } }; pJS.fn.interact.attractParticles = function(p1, p2){ /* condensed particles */ var dx = p1.x - p2.x, dy = p1.y - p2.y, dist = Math.sqrt(dx*dx + dy*dy); if(dist <= pJS.particles.line_linked.distance){ var ax = dx/(pJS.particles.move.attract.rotateX*1000), ay = dy/(pJS.particles.move.attract.rotateY*1000); p1.vx -= ax; p1.vy -= ay; p2.vx += ax; p2.vy += ay; } } pJS.fn.interact.bounceParticles = function(p1, p2){ var dx = p1.x - p2.x, dy = p1.y - p2.y, dist = Math.sqrt(dx*dx + dy*dy), dist_p = p1.radius+p2.radius; if(dist <= dist_p){ p1.vx = -p1.vx; p1.vy = -p1.vy; p2.vx = -p2.vx; p2.vy = -p2.vy; } } /* ---------- pJS functions - modes events ------------ */ pJS.fn.modes.pushParticles = function(nb, pos){ pJS.tmp.pushing = true; for(var i = 0; i < nb; i++){ pJS.particles.array.push( new pJS.fn.particle( pJS.particles.color, pJS.particles.opacity.value, { 'x': pos ? pos.pos_x : Math.random() * pJS.canvas.w, 'y': pos ? pos.pos_y : Math.random() * pJS.canvas.h } ) ) if(i == nb-1){ if(!pJS.particles.move.enable){ pJS.fn.particlesDraw(); } pJS.tmp.pushing = false; } } }; pJS.fn.modes.removeParticles = function(nb){ pJS.particles.array.splice(0, nb); if(!pJS.particles.move.enable){ pJS.fn.particlesDraw(); } }; pJS.fn.modes.bubbleParticle = function(p){ /* on hover event */ if(pJS.interactivity.events.onhover.enable && isInArray('bubble', pJS.interactivity.events.onhover.mode)){ var dx_mouse = p.x - pJS.interactivity.mouse.pos_x, dy_mouse = p.y - pJS.interactivity.mouse.pos_y, dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse), ratio = 1 - dist_mouse / pJS.interactivity.modes.bubble.distance; function init(){ p.opacity_bubble = p.opacity; p.radius_bubble = p.radius; } /* mousemove - check ratio */ if(dist_mouse <= pJS.interactivity.modes.bubble.distance){ if(ratio >= 0 && pJS.interactivity.status == 'mousemove'){ /* size */ if(pJS.interactivity.modes.bubble.size != pJS.particles.size.value){ if(pJS.interactivity.modes.bubble.size > pJS.particles.size.value){ var size = p.radius + (pJS.interactivity.modes.bubble.size*ratio); if(size >= 0){ p.radius_bubble = size; } }else{ var dif = p.radius - pJS.interactivity.modes.bubble.size, size = p.radius - (dif*ratio); if(size > 0){ p.radius_bubble = size; }else{ p.radius_bubble = 0; } } } /* opacity */ if(pJS.interactivity.modes.bubble.opacity != pJS.particles.opacity.value){ if(pJS.interactivity.modes.bubble.opacity > pJS.particles.opacity.value){ var opacity = pJS.interactivity.modes.bubble.opacity*ratio; if(opacity > p.opacity && opacity <= pJS.interactivity.modes.bubble.opacity){ p.opacity_bubble = opacity; } }else{ var opacity = p.opacity - (pJS.particles.opacity.value-pJS.interactivity.modes.bubble.opacity)*ratio; if(opacity < p.opacity && opacity >= pJS.interactivity.modes.bubble.opacity){ p.opacity_bubble = opacity; } } } } }else{ init(); } /* mouseleave */ if(pJS.interactivity.status == 'mouseleave'){ init(); } } /* on click event */ else if(pJS.interactivity.events.onclick.enable && isInArray('bubble', pJS.interactivity.events.onclick.mode)){ if(pJS.tmp.bubble_clicking){ var dx_mouse = p.x - pJS.interactivity.mouse.click_pos_x, dy_mouse = p.y - pJS.interactivity.mouse.click_pos_y, dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse), time_spent = (new Date().getTime() - pJS.interactivity.mouse.click_time)/1000; if(time_spent > pJS.interactivity.modes.bubble.duration){ pJS.tmp.bubble_duration_end = true; } if(time_spent > pJS.interactivity.modes.bubble.duration*2){ pJS.tmp.bubble_clicking = false; pJS.tmp.bubble_duration_end = false; } } function process(bubble_param, particles_param, p_obj_bubble, p_obj, id){ if(bubble_param != particles_param){ if(!pJS.tmp.bubble_duration_end){ if(dist_mouse <= pJS.interactivity.modes.bubble.distance){ if(p_obj_bubble != undefined) var obj = p_obj_bubble; else var obj = p_obj; if(obj != bubble_param){ var value = p_obj - (time_spent * (p_obj - bubble_param) / pJS.interactivity.modes.bubble.duration); if(id == 'size') p.radius_bubble = value; if(id == 'opacity') p.opacity_bubble = value; } }else{ if(id == 'size') p.radius_bubble = undefined; if(id == 'opacity') p.opacity_bubble = undefined; } }else{ if(p_obj_bubble != undefined){ var value_tmp = p_obj - (time_spent * (p_obj - bubble_param) / pJS.interactivity.modes.bubble.duration), dif = bubble_param - value_tmp; value = bubble_param + dif; if(id == 'size') p.radius_bubble = value; if(id == 'opacity') p.opacity_bubble = value; } } } } if(pJS.tmp.bubble_clicking){ /* size */ process(pJS.interactivity.modes.bubble.size, pJS.particles.size.value, p.radius_bubble, p.radius, 'size'); /* opacity */ process(pJS.interactivity.modes.bubble.opacity, pJS.particles.opacity.value, p.opacity_bubble, p.opacity, 'opacity'); } } }; pJS.fn.modes.repulseParticle = function(p){ if(pJS.interactivity.events.onhover.enable && isInArray('repulse', pJS.interactivity.events.onhover.mode) && pJS.interactivity.status == 'mousemove') { var dx_mouse = p.x - pJS.interactivity.mouse.pos_x, dy_mouse = p.y - pJS.interactivity.mouse.pos_y, dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse); var normVec = {x: dx_mouse/dist_mouse, y: dy_mouse/dist_mouse}, repulseRadius = pJS.interactivity.modes.repulse.distance, velocity = 100, repulseFactor = clamp((1/repulseRadius)*(-1*Math.pow(dist_mouse/repulseRadius,2)+1)*repulseRadius*velocity, 0, 50); var pos = { x: p.x + normVec.x * repulseFactor, y: p.y + normVec.y * repulseFactor } if(pJS.particles.move.out_mode == 'bounce'){ if(pos.x - p.radius > 0 && pos.x + p.radius < pJS.canvas.w) p.x = pos.x; if(pos.y - p.radius > 0 && pos.y + p.radius < pJS.canvas.h) p.y = pos.y; }else{ p.x = pos.x; p.y = pos.y; } } else if(pJS.interactivity.events.onclick.enable && isInArray('repulse', pJS.interactivity.events.onclick.mode)) { if(!pJS.tmp.repulse_finish){ pJS.tmp.repulse_count++; if(pJS.tmp.repulse_count == pJS.particles.array.length){ pJS.tmp.repulse_finish = true; } } if(pJS.tmp.repulse_clicking){ var repulseRadius = Math.pow(pJS.interactivity.modes.repulse.distance/6, 3); var dx = pJS.interactivity.mouse.click_pos_x - p.x, dy = pJS.interactivity.mouse.click_pos_y - p.y, d = dx*dx + dy*dy; var force = -repulseRadius / d * 1; function process(){ var f = Math.atan2(dy,dx); p.vx = force * Math.cos(f); p.vy = force * Math.sin(f); if(pJS.particles.move.out_mode == 'bounce'){ var pos = { x: p.x + p.vx, y: p.y + p.vy } if (pos.x + p.radius > pJS.canvas.w) p.vx = -p.vx; else if (pos.x - p.radius < 0) p.vx = -p.vx; if (pos.y + p.radius > pJS.canvas.h) p.vy = -p.vy; else if (pos.y - p.radius < 0) p.vy = -p.vy; } } // default if(d <= repulseRadius){ process(); } // bang - slow motion mode // if(!pJS.tmp.repulse_finish){ // if(d <= repulseRadius){ // process(); // } // }else{ // process(); // } }else{ if(pJS.tmp.repulse_clicking == false){ p.vx = p.vx_i; p.vy = p.vy_i; } } } } pJS.fn.modes.grabParticle = function(p){ if(pJS.interactivity.events.onhover.enable && pJS.interactivity.status == 'mousemove'){ var dx_mouse = p.x - pJS.interactivity.mouse.pos_x, dy_mouse = p.y - pJS.interactivity.mouse.pos_y, dist_mouse = Math.sqrt(dx_mouse*dx_mouse + dy_mouse*dy_mouse); /* draw a line between the cursor and the particle if the distance between them is under the config distance */ if(dist_mouse <= pJS.interactivity.modes.grab.distance){ var opacity_line = pJS.interactivity.modes.grab.line_linked.opacity - (dist_mouse / (1/pJS.interactivity.modes.grab.line_linked.opacity)) / pJS.interactivity.modes.grab.distance; if(opacity_line > 0){ /* style */ var color_line = pJS.particles.line_linked.color_rgb_line; pJS.canvas.ctx.strokeStyle = 'rgba('+color_line.r+','+color_line.g+','+color_line.b+','+opacity_line+')'; pJS.canvas.ctx.lineWidth = pJS.particles.line_linked.width; //pJS.canvas.ctx.lineCap = 'round'; /* performance issue */ /* path */ pJS.canvas.ctx.beginPath(); pJS.canvas.ctx.moveTo(p.x, p.y); pJS.canvas.ctx.lineTo(pJS.interactivity.mouse.pos_x, pJS.interactivity.mouse.pos_y); pJS.canvas.ctx.stroke(); pJS.canvas.ctx.closePath(); } } } }; /* ---------- pJS functions - vendors ------------ */ pJS.fn.vendors.eventsListeners = function(){ /* events target element */ if(pJS.interactivity.detect_on == 'window'){ pJS.interactivity.el = window; }else{ pJS.interactivity.el = pJS.canvas.el; } /* detect mouse pos - on hover / click event */ if(pJS.interactivity.events.onhover.enable || pJS.interactivity.events.onclick.enable){ /* el on mousemove */ pJS.interactivity.el.addEventListener('mousemove', function(e){ if(pJS.interactivity.el == window){ var pos_x = e.clientX, pos_y = e.clientY; } else{ var pos_x = e.offsetX || e.clientX, pos_y = e.offsetY || e.clientY; } pJS.interactivity.mouse.pos_x = pos_x; pJS.interactivity.mouse.pos_y = pos_y; if(pJS.tmp.retina){ pJS.interactivity.mouse.pos_x *= pJS.canvas.pxratio; pJS.interactivity.mouse.pos_y *= pJS.canvas.pxratio; } pJS.interactivity.status = 'mousemove'; }); /* el on onmouseleave */ pJS.interactivity.el.addEventListener('mouseleave', function(e){ pJS.interactivity.mouse.pos_x = null; pJS.interactivity.mouse.pos_y = null; pJS.interactivity.status = 'mouseleave'; }); } /* on click event */ if(pJS.interactivity.events.onclick.enable){ pJS.interactivity.el.addEventListener('click', function(){ pJS.interactivity.mouse.click_pos_x = pJS.interactivity.mouse.pos_x; pJS.interactivity.mouse.click_pos_y = pJS.interactivity.mouse.pos_y; pJS.interactivity.mouse.click_time = new Date().getTime(); if(pJS.interactivity.events.onclick.enable){ switch(pJS.interactivity.events.onclick.mode){ case 'push': if(pJS.particles.move.enable){ pJS.fn.modes.pushParticles(pJS.interactivity.modes.push.particles_nb, pJS.interactivity.mouse); }else{ if(pJS.interactivity.modes.push.particles_nb == 1){ pJS.fn.modes.pushParticles(pJS.interactivity.modes.push.particles_nb, pJS.interactivity.mouse); } else if(pJS.interactivity.modes.push.particles_nb > 1){ pJS.fn.modes.pushParticles(pJS.interactivity.modes.push.particles_nb); } } break; case 'remove': pJS.fn.modes.removeParticles(pJS.interactivity.modes.remove.particles_nb); break; case 'bubble': pJS.tmp.bubble_clicking = true; break; case 'repulse': pJS.tmp.repulse_clicking = true; pJS.tmp.repulse_count = 0; pJS.tmp.repulse_finish = false; setTimeout(function(){ pJS.tmp.repulse_clicking = false; }, pJS.interactivity.modes.repulse.duration*1000) break; } } }); } }; pJS.fn.vendors.densityAutoParticles = function(){ if(pJS.particles.number.density.enable){ /* calc area */ var area = pJS.canvas.el.width * pJS.canvas.el.height / 1000; if(pJS.tmp.retina){ area = area/(pJS.canvas.pxratio*2); } /* calc number of particles based on density area */ var nb_particles = area * pJS.particles.number.value / pJS.particles.number.density.value_area; /* add or remove X particles */ var missing_particles = pJS.particles.array.length - nb_particles; if(missing_particles < 0) pJS.fn.modes.pushParticles(Math.abs(missing_particles)); else pJS.fn.modes.removeParticles(missing_particles); } }; pJS.fn.vendors.checkOverlap = function(p1, position){ for(var i = 0; i < pJS.particles.array.length; i++){ var p2 = pJS.particles.array[i]; var dx = p1.x - p2.x, dy = p1.y - p2.y, dist = Math.sqrt(dx*dx + dy*dy); if(dist <= p1.radius + p2.radius){ p1.x = position ? position.x : Math.random() * pJS.canvas.w; p1.y = position ? position.y : Math.random() * pJS.canvas.h; pJS.fn.vendors.checkOverlap(p1); } } }; pJS.fn.vendors.createSvgImg = function(p){ /* set color to svg element */ var svgXml = pJS.tmp.source_svg, rgbHex = /#([0-9A-F]{3,6})/gi, coloredSvgXml = svgXml.replace(rgbHex, function (m, r, g, b) { if(p.color.rgb){ var color_value = 'rgba('+p.color.rgb.r+','+p.color.rgb.g+','+p.color.rgb.b+','+p.opacity+')'; }else{ var color_value = 'hsla('+p.color.hsl.h+','+p.color.hsl.s+'%,'+p.color.hsl.l+'%,'+p.opacity+')'; } return color_value; }); /* prepare to create img with colored svg */ var svg = new Blob([coloredSvgXml], {type: 'image/svg+xml;charset=utf-8'}), DOMURL = window.URL || window.webkitURL || window, url = DOMURL.createObjectURL(svg); /* create particle img obj */ var img = new Image(); img.addEventListener('load', function(){ p.img.obj = img; p.img.loaded = true; DOMURL.revokeObjectURL(url); pJS.tmp.count_svg++; }); img.src = url; }; pJS.fn.vendors.destroypJS = function(){ cancelAnimationFrame(pJS.fn.drawAnimFrame); canvas_el.remove(); pJSDom = null; }; pJS.fn.vendors.drawShape = function(c, startX, startY, sideLength, sideCountNumerator, sideCountDenominator){ // By Programming Thomas - https://programmingthomas.wordpress.com/2013/04/03/n-sided-shapes/ var sideCount = sideCountNumerator * sideCountDenominator; var decimalSides = sideCountNumerator / sideCountDenominator; var interiorAngleDegrees = (180 * (decimalSides - 2)) / decimalSides; var interiorAngle = Math.PI - Math.PI * interiorAngleDegrees / 180; // convert to radians c.save(); c.beginPath(); c.translate(startX, startY); c.moveTo(0,0); for (var i = 0; i < sideCount; i++) { c.lineTo(sideLength,0); c.translate(sideLength,0); c.rotate(interiorAngle); } //c.stroke(); c.fill(); c.restore(); }; pJS.fn.vendors.exportImg = function(){ window.open(pJS.canvas.el.toDataURL('image/png'), '_blank'); }; pJS.fn.vendors.loadImg = function(type){ pJS.tmp.img_error = undefined; if(pJS.particles.shape.image.src != ''){ if(type == 'svg'){ var xhr = new XMLHttpRequest(); xhr.open('GET', pJS.particles.shape.image.src); xhr.onreadystatechange = function (data) { if(xhr.readyState == 4){ if(xhr.status == 200){ pJS.tmp.source_svg = data.currentTarget.response; pJS.fn.vendors.checkBeforeDraw(); }else{ console.log('Error pJS - Image not found'); pJS.tmp.img_error = true; } } } xhr.send(); }else{ var img = new Image(); img.addEventListener('load', function(){ pJS.tmp.img_obj = img; pJS.fn.vendors.checkBeforeDraw(); }); img.src = pJS.particles.shape.image.src; } }else{ console.log('Error pJS - No image.src'); pJS.tmp.img_error = true; } }; pJS.fn.vendors.draw = function(){ if(pJS.particles.shape.type == 'image'){ if(pJS.tmp.img_type == 'svg'){ if(pJS.tmp.count_svg >= pJS.particles.number.value){ pJS.fn.particlesDraw(); if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame); else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw); }else{ //console.log('still loading...'); if(!pJS.tmp.img_error) pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw); } }else{ if(pJS.tmp.img_obj != undefined){ pJS.fn.particlesDraw(); if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame); else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw); }else{ if(!pJS.tmp.img_error) pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw); } } }else{ pJS.fn.particlesDraw(); if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame); else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw); } }; pJS.fn.vendors.checkBeforeDraw = function(){ // if shape is image if(pJS.particles.shape.type == 'image'){ if(pJS.tmp.img_type == 'svg' && pJS.tmp.source_svg == undefined){ pJS.tmp.checkAnimFrame = requestAnimFrame(check); }else{ //console.log('images loaded! cancel check'); cancelRequestAnimFrame(pJS.tmp.checkAnimFrame); if(!pJS.tmp.img_error){ pJS.fn.vendors.init(); pJS.fn.vendors.draw(); } } }else{ pJS.fn.vendors.init(); pJS.fn.vendors.draw(); } }; pJS.fn.vendors.init = function(){ /* init canvas + particles */ pJS.fn.retinaInit(); pJS.fn.canvasInit(); pJS.fn.canvasSize(); pJS.fn.canvasPaint(); pJS.fn.particlesCreate(); pJS.fn.vendors.densityAutoParticles(); /* particles.line_linked - convert hex colors to rgb */ pJS.particles.line_linked.color_rgb_line = hexToRgb(pJS.particles.line_linked.color); }; pJS.fn.vendors.start = function(){ if(isInArray('image', pJS.particles.shape.type)){ pJS.tmp.img_type = pJS.particles.shape.image.src.substr(pJS.particles.shape.image.src.length - 3); pJS.fn.vendors.loadImg(pJS.tmp.img_type); }else{ pJS.fn.vendors.checkBeforeDraw(); } }; /* ---------- pJS - start ------------ */ pJS.fn.vendors.eventsListeners(); pJS.fn.vendors.start(); };/* ---------- global functions - vendors ------------ */Object.deepExtend = function(destination, source) { for (var property in source) { if (source[property] && source[property].constructor && source[property].constructor === Object) { destination[property] = destination[property] || {}; arguments.callee(destination[property], source[property]); } else { destination[property] = source[property]; } } return destination;};window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback){ window.setTimeout(callback, 1000 / 60); };})();window.cancelRequestAnimFrame = ( function() { return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || clearTimeout} )();function hexToRgb(hex){ // By Tim Down - http://stackoverflow.com/a/5624139/3493650 // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; hex = hex.replace(shorthandRegex, function(m, r, g, b) { return r + r + g + g + b + b; }); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null;};function clamp(number, min, max) { return Math.min(Math.max(number, min), max);};function isInArray(value, array) { return array.indexOf(value) > -1;}/* ---------- particles.js functions - start ------------ */window.pJSDom = [];window.particlesJS = function(tag_id, params){ //console.log(params); /* no string id? so it's object params, and set the id with default id */ if(typeof(tag_id) != 'string'){ params = tag_id; tag_id = 'particles-js'; } /* no id? set the id to default id */ if(!tag_id){ tag_id = 'particles-js'; } /* pJS elements */ var pJS_tag = document.getElementById(tag_id), pJS_canvas_class = 'particles-js-canvas-el', exist_canvas = pJS_tag.getElementsByClassName(pJS_canvas_class); /* remove canvas if exists into the pJS target tag */ if(exist_canvas.length){ while(exist_canvas.length > 0){ pJS_tag.removeChild(exist_canvas[0]); } } /* create canvas element */ var canvas_el = document.createElement('canvas'); canvas_el.className = pJS_canvas_class; /* set size canvas */ canvas_el.style.width = "100%"; canvas_el.style.height = "100%"; /* append canvas */ var canvas = document.getElementById(tag_id).appendChild(canvas_el); /* launch particle.js */ if(canvas != null){ pJSDom.push(new pJS(tag_id, params)); }};window.particlesJS.load = function(tag_id, path_config_json, callback){ /* load json config */ var xhr = new XMLHttpRequest(); xhr.open('GET', path_config_json); xhr.onreadystatechange = function (data) { if(xhr.readyState == 4){ if(xhr.status == 200){ var params = JSON.parse(data.currentTarget.response); window.particlesJS(tag_id, params); if(callback) callback(); }else{ console.log('Error pJS - XMLHttpRequest status: '+xhr.status); console.log('Error pJS - File config not found'); } } }; xhr.send();};app.js文件: ...
代码来自头条号'前端小智', 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>毛玻璃</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } section{ position: relative; width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background:url('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fyouimg1.c-ctrip.com%2Ftarget%2Ftg%2F004%2F531%2F381%2F4339f96900344574a0c8ca272a7b8f27.jpg&refer=http%3A%2F%2Fyouimg1.c-ctrip.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1622900995&t=a974c9874eb669d9c053d93f8bb139e2'); background-position: center; background-attachment: fixed; /*规定背景图像是否固定或者随着页面的其余部分滚动。*/ background-size: cover; overflow: hidden; } h2{ font-size: 5em; color: #fff; pointer-events: none; /*设置元素是否对指针事件做出反馈*/ text-shadow: 1 10px 20px rgba(0, 0,0 ,0 ,.5); } .glass{ position: absolute; width: 300px; height: 200px; transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 25px 50px rgba(0, 0,0 ,0 ,.2); background: transparent; backdrop-filter: blur(10px);/*能够让你为一个元素前面区域增加图形成果(如含糊或色彩偏移)。 因为它实用于元素背地的所有元素,为了看到成果,必须使元素或其背景至多局部通明*/ transition: 0.2s; } </style></head><body> <section> <h2>glass</h2> <div class="glass"></div> </section> <script> document.addEventListener('mousemove',function (e) { const glass = document.querySelector('.glass') glass.style.left = e.offsetX+'px' glass.style.top = e.offsetY+'px' }) </script></body></html>
HTML标签导图将本人学过的HTML标签整顿了一下,做成一个导图,供大家参考应用。图中有什么中央须要改良、或者想减少其它新内容,能够下方评论留言或者私信我,本帖会不断更新的。 HTML标签:版本1.0 H5新增:版本1.0
什么是HTML ?HTML是 W3C组织定义的语言规范:HTML是用于形容页面构造的语言。 构造:有什么货色,该货色示意什么含意 HTML:Hyper Text Markup Language ( 超文本标记语言 ) 文件后缀为 .html 或者 .htm HTML 由浏览器解析 由上至下,从左至右。 常见的浏览器有,以及他们的内核 Chrome —— Webkit -> BlinkFirefox —— GeckoSafari —— WebkitIE —— Trident Opera —— Presto -> Blink 正文更不便浏览,浏览器不会解析。 元素W3C叫法 元素 ( element ) = 起始标记 ( begin tag ) + 完结标记 ( end tag ) + 元素内容 + 元素属性 属性 = 属性名 + 属性值 (我违心叫它 " 名值对儿 " ) ...
什么是浏览器渲染??就是把从服务哪里失去的html,css,js等资源,通过一些列解决,渲染到web页面 步骤获取html,解析成DOM树解决css,解析为cssdom将dom树和cssdom合并成渲染树布局layout,计算每个元素的大小地位绘制pass,将渲染树的各个节点绘制到屏幕上留神五个步骤不肯定程序实现dom树的构建可能被css和js的加载阻塞
html 即 超文本标记语言,其中,超文本是指连贯单个网站内或多个网站间的网页的链接 切记:html 不是编程语言,它只是一种标记语言1、根本的构造标签html 中的根本构造标签是指 页面中的最根本的标签,也称为骨架标签,包含 <html>、<head>、<title>、<body> 其关系为: <html> <head> <title> 骨架构造 </title> </head> <body> <div>Hello world!</div> </body></html><html> 元素:蕴含整个页面中的内容,也称为根元素、根标签<head> 元素:文档头部,该内容对用户是不可见的,其中包含:搜索引擎的搜寻关键字、页面形容、字符编码申明、页面题目以及CSS样式表<title> 元素:文档头部,显示页面标签上,也作为珍藏的形容文字,放在 <head> 中<body> 元素:页面主体内容,包含文本、图像、多媒体等等,是用户能够看见的内容 2、页面开发的根本骨架<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> 页面的根本骨架 </title></head><body> 未曾与你分享的工夫,我在提高!</body></html>这就是页面开发的根本骨架,包含了根本根本标签和一些申明 <!DOCTYPE html>:文档类型申明,通知浏览器我想要采纳HTML5版本来显示页面 1、<!DOCTYPE> 申明标签必须卸载文档的最后面 2、留神:<!DOCTYPE> 不是一个HTML标签,而是一个文档申明标签 <html lang="">:定义以后文档显示的语言,en 为英语,zh-CN 为中文<meta>:形容HTML文档的元数据 charset属性来定义HTML文档要应用哪种文字编码,默认定义为 UTF-8能够指定页面的形容、搜索引擎关键词、文档最初批改工夫等等3、罕用标签题目标签h1 ~ h6 6级标签,h1 最大,h6 最小 div 和 span 标签块级标签:div 行内标签:span 这两个是用得最多的标签,然而当初提倡用 html5 的语义化标签了 段落换行分隔标签段落标签:<p> 换行标签:<br /> 分隔标签:<hr> <p>未曾与你分享的工夫,我在提高!</p><br /><hr>文本格式化标签语义标签阐明加粗<strong></strong> 或者 <b></b>举荐应用<strong>加粗标签,语义更加强烈歪斜<em></em> 或者 <i></i>举荐应用<em>歪斜标签,语义更加强烈删除线<del></del> 或者 <s></s>举荐应用<sel>删除标签,语义更加强烈下划线<ins></ins> 或者 <u></u>举荐应用<ins>下划线标签,语义更加强烈须要留神一下:文本格式化标签是行内标签图像标签<img>: 图像标签,在HTML中,该标签用于定义HTML页面中的图片 ...
代码来自头条号"前端小智", 侵权删 <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>气泡loading</title> <style> *{ margin: 0; padding: 0; box-sizing: border-box; } body{ display: flex; justify-content: center; align-items: center; min-height: 100vh; background-color: #111; } .container{ display: flex; justify-content: center; align-items: center; flex-direction: column; } .box{ /* 气泡的父级元素 */ position: relative; width: 200px; height: 200px; animation: rotateBox 10s linear infinite; /*这块的旋转动画,有跟没有没看进去区别*/ } @keyframes rotateBox { 0%{ transform: rotate(0deg); } 100%{ transform: rotate((360deg)) } } .circle{ width: 100%; height: 100%; position: absolute; top: 0; left: 0; background-color: #38c1ff; border-radius: 50%; animation: animation_1 5s linear infinite; } .circle:nth-child(2){ background-color: #ff3378; animation-delay: -2.5s; /*提早第二个圆的动画 以便将两个圆离开*/ } @keyframes animation_1{ /*气泡的动画 设置变形-scale属性(变大 变小) 和变动的原点 */ 0% { transform: scale(1); transform-origin: left; } 50% { transform: scale(0); transform-origin: left; } 50.01% { transform: scale(0); transform-origin: right; } 100% { transform: scale(1); transform-origin: right; } } h2{ margin-top: 20px; font-size: 20px; font-weight: 400; letter-spacing: 4px; color: #fff; } </style></head><body> <div class="container"> <div class="box"> <div class="circle"></div> <div class="circle"></div> </div> <h2>loading</h2> </div></body></html>
Introduction to computer systems, networks and securityAssignment 2 - Trimester 1, 2021Submission guidelinesThis is an individual assignment, group work is not permitted (except for parts of task 1.1 as stated below).Deadline: 10 May 2021, 11:55pmSubmission format: Word (doc, docx) (one file containing both parts 1 and 2), uploaded electronically viaMoodle.Late submission:• By submitting a Special Consideration Form or visit this link:https://lms.monashcollege.edu...• Or, without special consideration, you lose 5 marks of your mark per day that you submitlate (including weekends). Submissions will not be accepted more than 5 days late. Thismeans that if you got Y marks, only Y-n*5 will be counted where n is the number of daysyou submit late.• Assessment items will not be accepted after more than 14 calendar days unless a SpecialConsideration application has been approved. This 14-day time frame does not apply toassessments due in Week 12.Marks: This assignment will be marked out of 100 points, and count for 15% of your total unit marks.Plagiarism: It is an academic requirement that the work you submit be original. If there is anyevidence of copying (including from online sources without proper attribution), collaboration, pastingfrom websites or textbooks, Zero marks may be awarded for the whole assignment, the unit or youmay be suspended or excluded from your course. Monash Colleges policies on plag代做MCD4700设计iarism, collusion,and cheating are available here or see this link:https://www.monashcollege.edu...Further Note: When you are asked to use Internet resources to answer a question, this does notmean copy-pasting text from websites. Write answers in your own words such that yourunderstanding of the answer is evident. Acknowledge any sources by citing them.Monash College MCD4700 Assignment 21 ...
EECS 281 – Winter 2021Programming Project 4Drone DeliveryDue Monday, April 19 before midnightOverviewYou’ve decided to start a company to handle on-campus deliveries of items via drone. Not just at UM, you’redeveloping software to sell so that people at other campuses can set up their own drone delivery service!There are two types of drones under development, used for three different purposes:Drone Type I is a drone that moves ten times as fast as other drones. However, these drones require dronedirector beacon installations along each path so that their rapid flight can be properly controlled. The cost ofinstalling these beacons are directly proportional to the distance of the desired path, and clients will want tominimize the cost of beacons.Drone Type II is a regular drone similar to competing products. The drone’s energy usage is directlyproportional to the distance it travels.There are currently three types of clients (A, B, and C) that are interested in your drones, and your task willvary based on the client type. This is described further in detail below.To be clear: these scenarios are separate; the program will create a plan for one or the other, but notboth in the same run (though you may find that algorithms from one mode help with another mode).In this project, your output does not need to be exactly the same as ours to be correct. As long as itprovides a valid answer, and follows the rules for formatting output, it can be in a different order or usedifferent edges, and still be correct.Project Goals● Understand and implement MST algorithms. Be able to determine whether Prim’s or Kruskal’s is moreefficient for a particular scenario.● Understand代做EECS 281编程语言 and implement a Branch and Bound algorithm. Develop a fast and effective boundingalgorithm.● Explore various heuristic approaches to achieving a nearly-optimal solution as fast as possible.○ Do some web searching for “TSP heuristics”, don’t choose one worse than O(n2).● Use a visualization tool to help with debugging.Version 03-28-21Written by many 281 staff© 2021 Regents of the University of Michigan2Map InputOn startup, your program, drone, reads input from standard input (cin) describing the locations where pickupsand/or deliveries might occur (there is no actual difference between pickup and delivery locations, these arejust part of the description). The campus is mapped on a grid with a restricted area (medical campus) in thebottom left quadrant (see ‘Path Rules’). You will be given a list of M locations on campus with associatedinteger coordinates (x, y). Locations are identified by integer indices which correspond to the order in whichthey are read in (the first location coordinate you read corresponds to location 0, the second coordinate tolocation 1, etc.). For parts B and C you always start at location 0.Formally, the input will be formatted in this manner: The first line will contain a single number denoting thenumber of locations on campus. That will be followed by a list of integer x/y, coordinates in the form: x y. Youmay assume that the input will always be well-formed (it will always conform to this format and you do not needto error check). There may be additional blank lines at the end of the file (but nowhere else).Sample:56 12 3-5 -4-1 60 -1The above sample can be visualized as in the figure below, where the numbers shown are the location indicesthat starts at the 0-th location, and the blue line indicates the border (for more details, see the 'Path Rules'section) which separates the medical campus from everything else: location 2 is in the medical campus, 4 is onthe border, the rest are the “normal” part of campus.There is more than one way to represent this configuration internally in your program, and this willaffect your runtime. Choose your data structures wisely!3For Part A, there will always be at least two points. For Parts B and C, there will always be at least 3.Path RulesWe represent the paths you take as a set of pairs of locations or as a sequence of locations. Your calculations1should use Euclidean distance, and you should represent your distances as doubles.In Part A, the faster drones must respect air-traffic safety (due to medical helicopters), and can only enter orleave the medical campus at certain locations. In order to reach locations inside (or outside, if leaving) themedical campus, you must first reach a location on the border.In Parts B and C, the standard-speed drones can fly directly from location to location. You move along the linesegments that connect locations. Please be very careful with rounding errors in your distance calculations; theautograder will allow you a 0.01 margin of error to account for rounding, but you should avoid rounding atintermediate steps.Medical CampusThere is a medical campus that is located in the bottom left quadrant of the map. When first embarking onyour delivery (in Part A), the medical campus is bounded by its border, which consists of the negative portionsof the x and y axes, including the origin (0, 0). In Part A, you may only enter and exit the medical campus bypassing through a location on the border. For example, you are not allowed to travel directly from (-5, -4) to (6,1). You must first travel from (-5, -4) to (0, -1), and then from (0, -1) to (6, 1).For the sake of simplicity, assume two locations that "cross" the medical campus can be connected by a directpath. The example below shows two validly connected “normal” campus locations, at A and B.In this example, there is a direct path from A to B.1“Path,” in this project, can be understood as a route between two locations.4When you are using standard speed drones (in Parts B and C), you can fly directly from “normal” campuslocations to medical campus locations, and vice versa (the special rules only exist in Part A).OtherImportant: For parts B and C, you always start at the 0-th campus location.You are also not allowed to ‘wrap around the edges of the world’ (you cannot go above the top of the map toarrive at the bottom).Command Line InputYour program, drone, should take the following case-sensitive command line options:● -m, --mode <MODE>This command line option must be specified, if it is not, print a useful error message to standard error(cerr) and exit(1). MODE is a required argument. Set the program mode to MODE. MODE must be one ofMST, FASTTSP, or OPTTSP. The MODE corresponds to the algorithm drone runs (and therefore what itoutputs).● -h, --helpPrint a short description of this program and its arguments and exit(0).Valid examples of how to execute the program:./drone --mode MST (OK, but you must type the input by hand)./drone -h < inputFile.txt (OK, -h happens before we realize there’s no -m)./drone -m OPTTSP < inputFile.txt (OK, reads from a file on disk)./drone -m BLAH (BAD mode following -m)Remember that when we redirect input, it does not affect the command line. Redirecting input just sends thefile contents to cin. You should not have to modify your code to allow this to work; the operating system willhandle it.We will not be specifically error-checking your command-line handling, however we expect that yourprogram conforms with the default behavior of getopt_long(). Incorrect command-line handling maylead to a variety of difficult-to-diagnose problems.5AlgorithmsYour program should run one and only one of the following modes at runtime depending on the mode optionfor that particular program call. We divide it into ‘parts’ for your convenience, though you may find thatelements and algorithms of some parts can help with others.Part A – MST modeDescriptionThis mode will devise a path that determines where to place high-speed drone beacons, while minimizing thetotal distance of that path (and thus the total cost of the beacons).When the program is run in the MST mode, it should calculate and print out an MST connecting all of thecampus locations. You may use any MST algorithm to connect all the locations. Hint: Unless you want toimplement both and compare, think about the nature of the graph (how many vertices and edges does ithave?). You are free to adapt code from the lecture slides to fit this project, but you will want to carefully thinkabout the data structures necessary to do each part (storing unnecessary data can go over memory limits).Your program must always generate one valid MST for each input.Remember that in this part, you must respect the boundary between the medical campus and other locations.Your MST cannot connect a medical campus location directly to one in the rest of campus, without passingthrough a location on the border.Output Format (for Part A only)For the MST mode, you should print the total weight of the MST you generate by itself on a line; this weight isthe sum of the weights of all edges in your MST (in terms of Euclidean distance). You should then print alledges in the MST. All output should be printed to standard output (cout).The output should be of the format:weightnode nodenode node......The nodes are the campus location numbers corresponding to the vertices of the MST and a pair of nodes ona given line of the output describes an edge in the MST from the first node to the second. To be clear, theweight should be formatted as a double (2 decimal point precision is enough - see Appendix A), and the nodenumbers should all be integer values when printed. For example, given the example input file above, your MSTmode output might be:19.020 12 41 31 46You should also always print the pairs of vertices that describe an edge such that the index on the left has asmaller integer value than the index on the right. In other words:1 2is a possible valid edge of output, but2 1is not.If it is not possible to construct an MST for all locations (i.e. if there are locations on both the normal andmedical campuses, with none on the border), your program should print the message "Cannot constructMST" to cerr and exit(1).Parts B & C (FASTTSP & OPTTSP mode)Description (for both Parts B and C)In this mode, you will figure out how to travel to every campus location and then return to your starting location.The route will always start at location index 0, visit every other location exactly once, and return to the startinglocations. Your job will thus be to solve the TSP (Traveling Salesperson Problem) and choose paths tolocations so as to minimize the total distance travelled. Euclidean (straight-line) distance is used here again tocompute distances between locations. Because you are now using normal-speed drones, there is no longerany restriction on medical campus interaction; you can fly from any location to any other.For FASTTSP mode, you do not need to produce an optimal TSP tour, but your solution should be close tooptimal. Because your FASTTSP algorithm does not need to be perfectly optimal, we expect it to run muchfaster than finding a perfect optimal solution. Do some online searching for “TSP heuristics”. There areseveral types, some easier to implement, some with better path lengths, some both.For OPTTSP mode, you must find an optimal solution to the TSP (the actual minimum Euclidean distancenecessary). More on the differences between OPTTSP and FASTTSP modes will be discussed later.For both methods:● You must start the tour from the 0-th campus location.● You must visit every location exactly once, and at the end of the tour, you must return back to the 0-thlocation (you do not print that you’ve returned, but must count the length of that edge as part ofthe total path length).● The length of a tour is defined as the sum of all pairwise distances travelled - that is, the sum of thelengths of all of the paths taken (using Euclidean distance).● Your program must print the indices of the locations in an order such that the length of this tour is assmall as possible. More details about how to accomplish this are listed below.Output Format (for both Parts B and C)You should begin your output by printing the overall length of your tour on a line. On the next line, output thenodes in the order in which you visit them. The initial node should be the starting location index and the last7node should be the location number directly before returning back to the 0-th location. The nodes in your tourshould be printed such that they are separated by a single space. There can be a space after the last locationlisted. All output should be printed to standard output (cout).For example, if given the input file above, your program could produce:31.640 4 2 3 1or31.640 1 3 2 4Part B Only DescriptionIn the case that we have a large number of possible locations to visit, finding an optimal method for visiting allof them may be too slow, and you may grow old and die before completing your task. You can use heuristicsinstead to find nearly-optimal tours. A heuristic is a problem-solving method (an algorithm) that can produce agood answer that is not necessarily the best answer. For example, you can skip a branch speculatively ratherthan waiting to know for a fact that it can be skipped. There are many other simple heuristic techniques, suchas starting with a random tour and trying to improve it by small changes.You should be able to produce a solution to the Traveling Salesperson Problem (TSP) that is as close aspossible to the optimal tour length (though it does not need to be optimal). In the best case, your producedtour length will equal the optimal tour length. Sometimes, especially with a low number of locations, yourheuristic might get lucky and produce the optimal tour.You are allowed to use any combination of algorithms for this section that we have covered in class, includingthe MST algorithm you wrote for Part A. You should however not exceed O(n2) complexity.You will need to be creative when designing your algorithms for this section. You are free to implement anyother algorithm you choose, so long as it meets the time and memory constraints. However, you should notuse any advanced algorithms or formulas (such as Simulated Annealing, Genetic Algorithms and Tabu search -they are too slow) that are significantly different from what has been covered in class. Instead, creativelycombine the algorithms that you already know and come up with concise optimizations. Your heuristic will verylikely be greedy in some way, but there are different ways to be greedy!Part C Only DescriptionTo find an optimal tour, you could start with the brute force method of exhaustive enumeration that evaluatesevery tour and picks a smallest tour. By structuring this enumeration in a clever way, you could determine thatsome branches of the search cannot lead to optimal solutions. For example, you could compute lower boundson the length of any full tour that can be found in a given branch. If such a lower bound exceeds the cost of afull solution you have found previously, you can skip this branch as hopeless. If implemented correctly, such abranch-and-bound method should always produce an optimal solution. It will not scale as well as sorting orsearching algorithms do for other problems, but it should be usable with a reasonable number of locations.Clever optimizations (identifying hopeless branches of search early) can make your algorithm a hundred timesfaster. Drawing TSP tours on paper and solving small location configurations to optimality by hand should be8very useful. Remember that there is a tradeoff between the time it takes to run your bounding functionand the number of branches that bound lets you prune.MAKE SURE that you use the version of genPerms() presented in either the “Project 4 Tutorial” or the“Backtracking BB TSP” lecture slides. The one presented earlier in the semester, in the “Stacks andQueues” lecture slides is much slower.Given an input set of N locations defined by integer coordinates, your job is to produce an optimal tour usingbranch-and-bound algorithms. Your program should always produce the shortest possible tour as a solution,even if computing that solution is time-consuming. You will be given a 35-second cpu time limit to generateyour solution. If your program does not produce a valid solution, it will fail the test case. Your solution will alsobe judged by time and space budgets as per previous projects.Libraries and RestrictionsWe highly encourage the use of the STL for this project, with the exception of several prohibited features. Donot use:● The C++11 regular expressions library● The STL thread/atomics libraries (which spoil runtime measurements)● Shared or unique pointers.● Other libraries (e.g., boost, pthreads, etc).Testing and DebuggingPart of this project is to prepare several test files that will expose defects in buggy solutions - your own orsomeone else’s. As this should be useful for testing and debugging your programs, we recommend that youfirst try to catch a few of our intentionally-buggy solutions with your test files, before completing your solution.The autograder will also tell you if one of your own test files exposes bugs in your solution.Each test that you submit should consist of an input file. When we run your test files on one of ourintentionally-buggy project solutions, we compare the output to that of a correct project solution. If the outputsdiffer, the test file is said to expose that bug.Test files should be named test-n-MODE.txt where 1 <= n <= 10. The autograder’s buggy solutions will runyour test files in the specified MODE. The mode must be MST, FASTTSP, or OPTTSP.Your test files may have no more than 10 locations in any one file. You may submit up to 10 test files (though itis possible to get full credit with fewer test files). The tests the autograder runs on your solution are NOT limitedto 10 coordinates in a file; your solution should not impose any size limits (as long as sufficient system memoryis available). Test files for part A must have at least two locations; parts B and C must have at least three.9Submitting to the AutograderDo all of your work (with all needed source code files, as well as test files) in some directory other than yourhome directory. This will be your "submit directory". Before you turn in your code, be sure that:● Every source code and header file contains the following project identifier in a comment at the top ofthe file:● // Project Identifier: 1761414855B69983BD8035097EFBD312EB0527F0● The Makefile must also have this identifier (in the first TODO block)● You have deleted all .o files and your executable(s). Typing ‘make clean’ shall accomplish this.● Your makefile is called Makefile. Typing ‘make -R -r’ builds your code without errors and generatesan executable file called drone. The command-line options -R and -r disable automatic build rules,which will not work on the autograder.● Your Makefile specifies that you are compiling with the gcc optimization option -O3. This is extremelyimportant for getting all of the performance points, as -O3 can speed up code by an order ofmagnitude.● Your test files are named test-n-MODE.txt and no other project file names begin with test. Up to 10test files may be submitted. The “mode” portion of the filename must be MST, OPTTSP or FASTTSP.● The total size of your program and test files does not exceed 2MB.● You don't have any unnecessary files (including temporary files created by your text editor andcompiler, etc) or subdirectories in your submit directory (i.e. the .git folder used by git source codemanagement).● Your code compiles and runs correctly using the g++ compiler. This is available on the CAEN Linuxsystems (that you can access via login.engin.umich.edu). Even if everything seems to work on anotheroperating system or with different versions of GCC, the course staff will not support anything other thanGCC running on CAEN Linux. At the moment, the default version installed on CAEN is 4.8.5, howeverwe want you to use version 6.2.0 (available on CAEN with a command and/or Makefile); this version isalso installed on the autograder machines.Turn in all of the following files:● All your .h and/or .cpp files for the project● Your Makefile● Your test filesYou must prepare a compressed tar archive (.tar.gz file) of all of your files to submit to the autograder. Oneway to do this is to have all of your files for submission (and nothing else) in one directory. Our Makefileprovides the command make fullsubmit. Alternately you can go into this directory and run this command:dos2unix ; tar czf ./submit.tar.gz .cpp .h .hpp Makefile test*.txtThis will prepare a suitable file in your working directory.Submit your project files directly to either of the two autograders at: https://g281-1.eecs.umich.edu orhttps://g281-2.eecs.umich.edu. Note that when the autograders are turned on and acceptingsubmissions, there will be an announcement on Piazza. The auto graders are identical and your dailysubmission limit will be shared (and kept track of) between them. You may submit up to three times percalendar day with autograder feedback (double that during Spring semester). For this purpose, days beginand end at midnight (Ann Arbor local time). We will count only your best submission for your grade. If10you would instead like us to use your LAST submission, see the autograder FAQ page, or use this form. Westrongly recommend that you use some form of revision control (ie: SVN, GIT, etc) and that you 'commit' yourfiles every time you upload to the autograder so that you can always retrieve an older version of the code asneeded. If you use an online revision control system, make sure that your projects and files arePRIVATE; many sites make them public by default! If someone searches and finds your code and usesit, this could trigger Honor Code proceedings for you..Please make sure that you read all messages shown at the top section of your autograder results!These messages often help explain some of the issues you are having (such as losing points forhaving a bad Makefile or why you are segfaulting). Also be sure to note if the autograder shows thatone of your own test cases exposes a bug in your solution (at the bottom). Search for the words "hint"or "exceeded" (without quotes).GradingPoint Scale80 points -- Your grade will be derived from correctness and performance (runtime). This will be determined bythe autograder. On this project we expect a much broader spread of runtimes than on previous projects. Aswith all projects, the test cases used for the final grading are likely to be different.10 points -- Your program does not leak memory. Make sure to run your code under valgrind before eachsubmit. This is also a good idea because it will let you know if you have undefined behavior (such as readingan uninitialized variable), which may cause your code to crash on the autograder.10 points -- Student test file coverage (effectiveness at exposing buggy solutions).In your autograder output, the section named "Scoring student test files" will tell you how many bugs exist, howmany are needed to start earning points, earn full points, and earn an extra submit per day.Runtime Quality TradeoffsIn this project there is no single correct answer (unlike previous projects). Accordingly, the grading of yourproblem will not be as simple as a ‘diff’, but will instead be a result of evaluating your output. For example, ifwe gave you a square for Part A, you might choose any 3 of the 4 edges, and print them in any order, meaningthere are 24 possible correct output files!Particularly for Part B, we expect to see greater variation in student output. Part B asks you to solve a hardproblem, and with the given time constraints, we don’t actually expect your output to be optimal for all cases.The quality of your solutions may even vary from case to case. We want you to quickly produce solutions thatare close to optimal. This inevitably creates tradeoffs between solution optimality and runtime.You may find it useful to implement more than one algorithm or heuristic that you use in Part B, and do sometesting plus use the autograder to determine which works the best..Your grade for Part B will be determined based on how close you are to the best solution, computed asa percentage. If your tour is over length, you can lose points (similar to time and memory). If this11happens, the autograder will not color the test case "blue"; that only works for time or memory; search yourfeedback for the words "Your tour cost is too large" (without quotes).Hints and AdviceIt will be difficult to get this project correct without visualizing your MSTs and TSP tours. We have provided avisualization tool on the Autograder that you can use; follow this link: https://g281-2.eecs.umich.edu...Running your code (on CAEN or locally) using valgrind can help you find and remove undefined (buggy)behavior and memory leaks from your code. This can save you from losing points in the final run when youmistakenly believe your code to be correct.It is extremely helpful to compile your code with the following gcc options: -Wall -Wextra -Wvla-Wconversion -pedantic. This way the compiler can warn you about poor style and parts of your codethat may result in unintended/undefined behavior.Make sure that you are using getopt_long() for handling command-line options.There's a video for the project; be sure to watch it. Read the description, and one of the student commentsthat provides the times for some interesting places in the video.For Part C, think about when computing the estimate would save time, and when it would be a waste of time.If is the number of unvisited vertices, then (!) is the time to complete the TSP, while ( is the time2 ...
ELEC0033 - 2020/2021Page 95 Data Analytics Task - Climate Data Analysis using Python5.1 General OverviewThe assignment comprises individual code writing, data analysis and inferring. You areallowed to discuss ideas with peers, but your code, and experiments and report must bedone solely based on your on work.The assignment leverages elements covered in class (data analytics lecture). You will beworking with a couple of meteorological datasets, you will be required to crunch data, toclean the datasets and infer hidden patterns. Specifically, there will be three tasks you willbe asked to solve.The goals of the assignment are the following:• To further develop your programming skills• To further develop your skills and understanding principle of data analytics andmachine learning• To acquire experience in dealing with real-world data5.2 Assignment description ...
作者:Vivek Bisht 译者:前端小智 起源:blog有幻想,有干货,微信搜寻 【大迁世界】 关注这个在凌晨还在刷碗的刷碗智。 本文 GitHub https://github.com/qq449245884/xiaozhi 已收录,有一线大厂面试残缺考点、材料以及我的系列文章。 在编程中,如果你想持续深刻,数据结构是咱们必须要懂的一块, 学习/了解数据结构的动机可能会有所不同,一方面可能是为了面试,一方面可能单单是为了进步本人的技能或者是我的项目须要。无论动机是什么,如果不晓得什么是数组构造及何时应用利用字们,那学数据结构是一项繁琐且无趣的过程 这篇文章探讨了什么时候应用它们。在本文中,咱们将学习数组和对象。咱们将尝试通过应用Big O notation来了解何时抉择一种数据结构。 Big O notation 大零符号个别用于形容算法的复杂程度,比方执行的工夫或占用内存(磁盘)的空间等,特指最坏时的情景。数组数组是应用最宽泛的数据结构之一。 数组中的数据以有序的形式进行结构化,即数组中的第一个元素存储在索引0中,第二个元素存储在索引1中,依此类推。 JavaScript为咱们提供了一些内置的数据结构,数组就是其中之一 在JavaScript中,定义数组最简略的办法是: let arr = []下面的代码行创立了一个动静数组(长度未知),为了理解如何将数组的元素存储在内存中,咱们来看一个示例: let arr = ['John', 'Lily', 'William', 'Cindy']在下面的示例中,咱们创立一个蕴含一些人名的数组。 内存中的名称按以下形式存储: 为了了解数组是如何工作的,咱们须要执行一些操作: 增加元素:在JavaScript数组中,咱们有不同形式在数组结尾,开关以及特定索引处增加元素。 在数组的开端增加一个元素: JavaScript 中的数组有一个默认属性 length,它示意数组的长度。除了length属性外,JS还提供了 push() 办法。 应用这个办法,咱们能够间接在最初增加一个元素。 arr.push('Jake') 那么这个命令的复杂度是多少呢?咱们晓得,在默认状况下,JS提供了length属性,push()相当于应用以下命令: arr[arr.length - 1] = 'Jake'因为咱们总是能够拜访数组的长度属性,所以无论数组有多大,在开端增加一个元素的复杂度总是O(1) 。 在数组的结尾增加一个元素: 对于此操作,JavaScript提供了一个称为unshift()的默认办法,此办法将元素增加到数组的结尾。 let arr = ['John', 'Lily', 'William', 'Cindy']arr.unshift('Robert')console.log(arr) // [ 'Robert', 'John', 'Lily', 'William', 'Cindy' ]unshift办法复杂度如同和push办法的复杂度一样:O(1),因为咱们只是在后面增加一个元素。 事实并非如此,让咱们看一下应用unshift办法时会产生什么: ...
概述 EdgeXFoundry最开始是由Dell公司运行IOT网关上构建的零碎,起初开源进去。EdgeXFoundry就像是硬件与软件之间的一个中间件,南向连贯各种设施和传感器,北向连贯应用程序。EdgeXFoundry框架有四个服务层和两个根底零碎服务,别离是设施服务层(Device Service),外围服务层(Core Service),反对服务层(Supporting Service)还有应用服务层(Application Services);以及平安服务(Security)和系统管理服务(Management)。 EdgeXFoundry零碎架构图 Device Service(设施服务层) Device Service在零碎架构图中位于最底层的地位,是与硬件(设施和传感器)交互的一层。南向的设施如机房服务器、精细空调、路由器等等,传感器如温湿度计、烟感器等等。 Device Service设施服务能够通过与每个设施之间的协定进行通信,设施服务将友IoT对象生成和通信的数据转换为通用的EdgeXFoundry数据结构,并将转换后的数据发送到外围服务层(Core Service)以及其余层的微服务。简略来说,Device Service负责采集设施数据,完事将数据发送给其余层或其余服务;设施服务充当EdgeX与理论设施和传感器的接口 Device Service(设施服务)在首次启动的时候会做这些事件: 建设无关设施服务和设施的参考消息让EdgeX其余局部晓得DeivceService设置设施服务(Device Service)将通过Edgex治理设施 这时候我问各位bro一个问题,Device Service能够独自运行吗,如果能要怎么独自运行?独自运行之后如何跟Core Service进行数据传输?答案是必定的。EdgeX的微服务的单个实例能够散布在多个主机平台上。一个或多个EdgeX微服务的主机平台称为节点。 #### Core Service(外围服务层) 外围服务是EdgeX的外围局部,是南北桥的中介。Core Service蕴含 外围数据(coreData),命令(Command),元数据(Metadata),注册表和配置(Registry & Config) 等这些微服务。 元数据(metadata) 元数据会存储连贯到EdgeX对象的元数据存储库和相干的治理服务。 元数据提供新设施与设施服务配对的能力。简略来说设施配置文件Device Profile就是上传到元数据中存储。能够通过GET向metadata获取所有的Device Profile,PUT和ID更新配置文件,通过POST创立一个全新的DeviceProfile文件。(DeviceProfile设施配置文件记录了设施的名称形容版本生产商,有哪些属性和办法等等) 元数据微服务晓得该如何与传感器、其余服务(外围数据coredata ,外围命令core command)进行通信。元数据能治理连贯到EdgeX的设施、晓得设施报告的数据以及晓得如何向设施发送命令;但元数据就如同幕后大BOSS,老板嘱咐员工去做事;元数据不会通过Device Service和core Data进行数据采集;同样元数据不会向设施间接发送命令,命令由外围命令(core Command)和设施服务(Device Service)执行。 外围数据(coreData) 外围数据微服务为采集回来的数据提供长久化的服务。Device Service采集来的数据流到coreData,coreData会将数据存储到零碎边缘(如网关)并提供肯定的安全性性和爱护,直到数据向北挪动。说到外围数据,绕不开的还有Event/Readings。Event代表一个或多个传感器读数的汇合,传感器采集到数据后发送的EdgeX是一个事件。Reading代表设施或传感器的响应。 命令(Command) 命令是通用的,标准化的。个别发送两类指令给设施——GET&PUT。GET命令从设施申请数据,这罕用于申请设施获取最新的传感器数据。PUT指令则会发送指令给设施,使其开关机或作出一些调整。 Suppoting Service (反对服务层) 反对服务包含宽泛的微服务,包含边缘剖析、日志记录、调度和数据清理等;反对服务包含规定引擎、打算、日志记录、警报和告诉。目前在EdgeX v1.2版本中曾经弃用了Logging服务,日志记录会在EdgeX当前的版本中被删除。 Alerts & Notifications (警报和告诉) 在EdgeX框架中告诉是十分重要的,当紧急事件产生时接管方可选适当的形式收取告诉,包含SMS,邮件,REST回调,MQTT等等。告诉微服务接管告诉时,告诉都在外部传递到告诉处理程序。告诉处理程序首先会保留告诉,而后给定告诉为紧急时将其立刻传递到散发帮助器,若是失常状况则将消息传递到音讯调度程序。 Rules Engine & Kuiper Rules Engine 规定引擎在EdgeX v1.2中曾经被启用。在Geneva中EdgeX与 EMQ X Kuiper单干。而Kuiper是一个轻量级的开源软件,实现物联网边缘剖析和流解决,用户能够实现疾速的数据处理并编写SQL语句。Kuiper规定引擎基于三个局部组成,Source、 SQL、Sink ...
作者:Ahmad shaded译者:前端小智起源:sitepoint有幻想,有干货,微信搜寻 【大迁世界】 关注这个在凌晨还在刷碗的刷碗智。 本文 GitHub https://github.com/qq449245884/xiaozhi 已收录,有一线大厂面试残缺考点、材料以及我的系列文章。 '晋升'是 JS 开发都常常接触的一个术语,如果你刚接触 JS,可能会遇到一些奇怪的行为,其中一些变量是随机undefined,会抛出ReferenceErrors 异样等等。晋升通常被解释为将变量和函数放到作用域顶部,但实际上并不是这样,只管行为看起来是这样的。 当 JS 引擎获取咱们的代码时,它要做的第一件事就是为代码中的数据设置内存。 目前还没有执行任何代码,只是筹备要执行的所有内容。 函数申明和变量的存储形式不同。 函数是以按保留函数的援用的形式来存储。 1.函数是以按保留函数的援用的形式来存储(Functions are stored with a reference to the entire function) 应用变量,则有所不同。 ES6 引入了两个新的关键字来申明变量:let和const。 用let或const关键字申明的变量保留的状态是 uninitialized。 2.用let或const关键字申明的变量保留的状态是 uninitialized 应用var关键字申明的变量存储的默认值为undefined。 当初创立阶段曾经实现,咱们能够执行代码。让咱们看看在申明函数或任何变量之前,如果顶部执行3个console.log语句会产生什么。 因为函数存储在对整个函数代码的援用中,所以咱们能够在创立它们的行之前调用它们。 4.在执行阶段,咱们能够在申明函数之前调用它们,因为咱们在内存中援用了整个函数(During the execution phase, we can invoke a function before we declared them, since we a reference to the entire function in memory) 当咱们在变量申明之前援用var关键字申明的变量时,它只会返回其存储时的默认值:undefined。然而,这有时会导致“意料之外”的行为。在大多数状况下,咱们有可能会无心中从新援用了它(你可能不心愿它的值为undefined) 5. 当咱们在变量申明之前援用var关键字申明的变量时,它只会返回其存储时的默认值:undefined ...
明天的知识点 (2021.04.14) —— 第729天 (我也要出题)[html] H5如何禁止屏幕抖动?[css] 应用css实现圆形的头像的成果(注:要思考正方形、长方形状况)[js] js哪些办法能够获取原型?[软技能] 物联网将会对日常生活起到什么作用?《论语》,曾子曰:“吾日三省吾身”(我每天屡次检查本人)。前端面试每日3+1题,以面试题来驱动学习,每天提高一点!让致力成为一种习惯,让奋斗成为一种享受!置信 保持 的力量!!! 欢送在 Issues 和敌人们一起探讨学习! 我的项目地址:前端面试每日3+1【举荐】欢送跟 jsliang 一起折腾前端,零碎整顿前端常识,目前正在折腾 LeetCode,打算买通算法与数据结构的任督二脉。GitHub 地址 微信公众号欢送大家前来探讨,如果感觉对你的学习有肯定的帮忙,欢送点个Star, 同时欢送微信扫码关注 前端剑解 公众号,并退出 “前端学习每日3+1” 微信群互相交换(点击公众号的菜单:交换)。 学习不打烊,充电加油只为遇到更好的本人,365天无节假日,每天早上5点纯手工公布面试题(死磕本人,愉悦大家)。心愿大家在这虚夸的前端圈里,放弃沉着,保持每天花20分钟来学习与思考。在这变幻无穷,类库层出不穷的前端,倡议大家不要等到找工作时,才狂刷题,提倡每日学习!(不忘初心,html、css、javascript才是基石!)欢送大家到Issues交换,激励PR,感激Star,大家有啥好的倡议能够加我微信一起交换探讨! 心愿大家每日去学习与思考,这才达到来这里的目标!!!(不要为了谁而来,要为本人而来!)交换探讨欢送大家前来探讨,如果感觉对你的学习有肯定的帮忙,欢送点个[Star]
后面的文章介绍了 Web Components 的根本用法,明天来看看基于这个原生技术,Google 二次封存的框架 lit-html。 其实早在 Google 提出 Web Components 的时候,就在此基础上公布了 Polymer 框架。只是这个框架始终雷声大雨点小,外部仿佛也对这个我的项目不太称心,而后他们团队又开发了两个更加现代化的框架(或者说是库?): lit-html、lit-element,明天的文章会重点介绍 lit-html 的用法以及劣势。 倒退历程在讲到 lit-html 之前,咱们先看看前端通过 JavaScript 操作页面,经验过的几个阶段: 原生 DOM API最早通过 DOM API 操作页面元素,操作步骤较为繁琐,而且 JS 引擎与浏览器 DOM 对象的通信绝对耗时,频繁的 DOM 操作对浏览器性能影响较大。 var $box = document.getElementById('box')var $head = document.createElement('h1')var $content = document.createElement('div')$head.innerText = '关注我的公众号'$content.innerText = '关上微信搜寻:『天然醒的笔记本』'$box.append($head)$box.append($content) jQuery 操作 DOMjQuery 的呈现,让 DOM 操作更加便捷,外部还做了很多跨浏览器的兼容性解决,极大的晋升了开发体验,并且还领有丰盛的插件体系和具体的文档。 var $box = $('#box')var $head = $('<h1/>', { text: '关注我的公众号' })var $content = $('<div/>', { text: '关上微信搜寻:『天然醒的笔记本』' })$box.append($head, $content) ...
欢送退出前端交换群来获取视频材料以及前端学习材料:749539640第二章css根底一、css简介cascading style sheets 汉译层叠样式表,WEB规范中的体现规范语言,体现规范语言在网页中次要对网页信息的显示进行管制,简略说就是如何润饰网页信息的显示款式。目前举荐遵循的是W3C公布的CSS3.0.用来体现XHTML或者XML等款式文件的计算机语言。1998年5月21日由w3C正式推出的css2.0 二、款式的建设:外部款式 内部款式 和 内联款式1.外部款式 :语法: <style type="text/css"> /*css语句*/ </style> 注:应用style标记创立款式时,最好将该标记写在; 2.内部款式语法: <link rel="stylesheet" type="text/css" href="css/index.css"/> 3.内联款式(行间款式,行内款式,嵌入式款式)语法: <p style="color:red;">这是一段文本</p> 4.@import形式引入款式文件语法: <style type="text/css"> @import url(指标文件的门路及文件名全称); </style> 注:@和import之间没有空格 url和小括号之间也没有空格;必须结尾以分号完结;link和import导入内部款式的区别:差异1:老祖宗的差异:link属于XHTML标签,而@import齐全是CSS提供的一种形式。 link标签除了能够加载CSS外,还能够做很多其它的事件,比方定义RSS,定义rel连贯属性等,@import就只能加载CSS。差异2:加载程序的差异:当一个页面被加载的时候(就是被浏览者浏览的时候),link援用的CSS会同时被加载,而@import援用的CSS 会等到页面全副被下载完再被加载。所以有时候浏览@import加载CSS的页面时开始会没有款式。差异3:兼容性的差异。:@import是CSS2.1提出的,所以老的浏览器不反对,@import只t在IE5以上的能力辨认,而link标签无此问题。差异4:应用dom管制款式时的差异:当应用javascript管制dom去扭转款式的时候,只能应用link标签,因为@import不是dom能够管制的.三、CSS语法选择符{属性:属性值;属性:属性值;}div{height: 4px;} 阐明:1)每个CSS款式由两局部组成,即选择符和申明,申明又分为属性和属性值;2)属性必须放在花括号中,属性与属性值用冒号连贯。3)每条申明用分号完结。4)当一个属性有多个属性值的时候,属性值与属性值不分先后顺序。5)在书写款式过程中,空格、换行等操作不影响属性显示 四、样式表的优先级内联样式表的优先级别最高外部样式表与内部样式表的优先级和书写的程序无关,后书写的优先级别高。 五、CSS选择符(选择器)选择符示意要定义款式的对象,能够是元素自身,也能够是一类元素或者制订名称的元素.罕用的选择符有十种左右类型选择符,id选择符,class选择符,通配符,群组选择符,蕴含选择符,伪类选择符 1. 元素选择符/类型选择符(element选择器 )语法: 元素名称{属性:属性值;} div{padding: 0;} 阐明:a)元素选择符就是以文档语言对象类型作为选择符,即应用构造中元素名称作为选择符。例如body、div、p,img,em,strong,span......等。b)所有的页面元素都能够作为选择符;用法:1)如果想扭转某个元素的默认款式时,能够应用类型选择符;2) 当对立文档某个元素的显示成果时,能够应用类型选择符; 2.id选择器语法: #id名{属性:属性值;}#top{padding: 0;} 阐明:1)当咱们应用id选择符时,应该为每个元素定义一个id属性,如: 2)id选择符的语法格局是“#”加上自定义的id名如:#box{width:300px; height:300px;}3) 起名时要取英文名,不能用关键字:(所有的标记和属性都是关键字)如:head标记4)一个id名称只能对应文档中一个具体的元素对象,因为id只能定义页面中某一个惟一的元素对象。5) 最大的用途:创立网页的外围构造。 3.class选择器语法: .class名{属性:属性值;}.top{padding: 0;} 阐明:1)当咱们应用类选择符时,应先为每个元素定义一个类名称,2)类选择符的语法格局是:"如: "用法:class选择符更适宜定义一类款式; 4.*通配符语法: *{属性:属性值;}*{padding: 0;margin: 0;} 阐明:通配选择符的写法是“*”,其含意就是所有元素。用法:罕用来重置款式。 5.群组选择器语法: 选择符1,选择符2,选择符3{属性:属性值;} <div class="box"></div> <div class="name"></div>.box,.name{padding: 0;} 阐明:当有多个选择符利用雷同的款式时,能够将选择符用“,”分隔的形式,合并为一组。 6.蕴含选择器(后辈选择器)语法: 选择符1 选择符2{属性:属性值;} <div class="box"> <div class="name"></div></div>.box .name{padding: 0;} 阐明:选择符1和选择符2用空格隔开,含意就是选择符1中蕴含的所有选择符2; 7.伪类选择器(伪类选择符)语法 :a:link{属性:属性值;}超链接的初始状态;a:visited{属性:属性值;}超链接被拜访后的状态;a:hover{属性:属性值;}鼠标悬停,即鼠标划过超链接时的状态;a:active{属性:属性值;}超链接被激活时的状态,即鼠标按下时超链接的状态;阐明:1)当这4个超链接伪类选择符联结应用时,应留神他们的程序,失常程序为:a:link,a:visited,a:hover,a:active,谬误的程序有时会使超链接的款式生效;(爱恨准则【L O V E】 【H A T E】)2)为了简化代码,能够把伪类选择符中雷同的申明提出来放在a选择符中;例如:a{color:red;} a:hover{color:green;}示意超链接的三种状态都雷同,只有鼠标划过变色彩。 ...
HTMLHTML的表单一、FORM元素form元素用来定义。 <form acton="" method="" enctype=""></form>作用:用于数据的交互 属性: action 拜访接口的地址指定表单被提交到某一服务器页面上,省略时默认为以后页面method 表单提交的形式规定提交时HTTP的办法:POST和GETTIPS:post和get形式的区别? get办法 1. 会将申请的数据拼接再浏览器的地址栏上,不平安 2. 申请数据的大小有限度post办法 1. 会将数据放在申请体中,比拟平安,不会被他人看到 申请行+申请头+申请体 2. 对于申请数据的大小个别没有限度enctype 编码类型规定表单数据编码类型:application/action-www-form-urlencoded :在发送前编码所有字符(默认)multipart/form-data:不对字符编码TIPS:增加文件附件时需注意! 增加文件附件时,enctype不能为application/action-www-form-urlencoded必须为enctype=" multipart/form-data"且 method="post"二、表单组件input<input> 元素依据type属性来扭转状态 <input type="" name="">type属性有以下几种: text供文本输出的单行输出字段password明码字段,会被做掩码解决radio定义单选按钮,name雷同则互斥,checked默认抉择 <label> 能够将单选按钮radio的圆圈和文字合并为一个整体,便于用户应用checkbox定义复选框, name:组名;value:惟一id ; checked:默认抉择reset 定义重置表单按钮submit 定义提交表单的按钮,value属性能够定义按钮文本button定义按钮file文件附件按钮select下拉列表 <selected name="food"> <option value="sk">烧烤</option> <option value="hg">火锅</option> <option value="nc">奶茶</option></selected>textarea定义多行输出字段 ,cols=""(列) rows=""(行)三、HTML新增1.input中type类型time 容许用户抉择工夫date 蕴含日期的输出字段week 容许用户抉择周和年month 抉择月份和年份datetime 容许用户抉择日期和工夫(有时区)datetime-local 容许用户抉择日期和工夫(无时区)email 蕴含电子邮件地址的输出字段number 蕴含数字值的输出字段range 蕴含肯定范畴内的值的输出字段search 用于搜寻字段color 蕴含色彩的输出字段tel 蕴含电话号码的输出字段url 蕴含 URL 地址的输出字段2.input中属性autocomplete 属性规定表单或输出字段是否应该主动实现novalidate 属性规定在提交表单时不对表单数据进行验证autofocus 属性在页面加载时主动取得焦点placeholder属性向用户显示描性阐明或者提示信息min / max 属性将 range 输入框的数值输出范畴限定在最低值和最高值之间step 个性可能制订输出值递增或递加的梯度required 属性规定此项必镇pattern 属性规定用于查看 <input> 元素值的正则表达式multiple 属性规定容许用户在 <input> 元素中输出一个以上的值,用于email 和 file<iframe>能够引入别的网页,比方天气,工夫,股票 <iframe src="http://i.tianqi.com/index.php?c=code&id=17" style="border:solid 1px rgb(255, 255, 255)" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> ...
HTML一、HTML的元素组成元素的大小 = 外边距margin + 边框border + 内边距padding + 内容 二、HTML的块级元素1.作用:用于搭建网页构造2.特点:独占一行空间默认宽度为100%高度由子元素或内容决定能够通过css指定其宽度3.举例:<div>、<html>:没有margin、padding、border<body>:有margin<p>:有高低margin<h1~h5>:有高低margin、有font-size、font-weight<ul><li> 无序列表,<ol><li>有序列表:有高低maigin、padding-left、彩色圆点TIPS: 高低搁置两个块级元素时,两个元素之间的外边距为max{a元素的外边距,b元素的外边距} 三、HTML的行内元素1.作用:用于内容的填充2.特点:与其余行内元素共享一行空间不能通过css为其指定宽高宽高由本身决定,内容的容器3.举例:<span>:组合行内元素<a >:超链接<a herf ="绝对地址/相对地址" target=" _self/_blank(建设新的选项卡)"><a herf="id"> 锚点,回到顶部,达到底部..返回上一级<a herf="javaScript:void(0)"><img> :图片<img src ="地址./images/photo.jpg" alt="找不见时的文本替换"><video>:视频> controls 进度条> autoplay 自动播放<audio>:音频> controls 进度条> autoplay 自动播放TIPS: 如何给行内元素设置宽高?先将行内元素设置为块级元素或者是行内块元素,再设置宽高 四、HTML中的表格table【用于展现数据】 属性:border、bgcolor、cellspacing、cellpadding、width<table>【用于展现数据】 <caption> 【题目】</caption > <thead> 【表头】 <tr> 【表行(头)】 <th>【表列(头)加粗显示】姓名</th> <th>【表列(头)加粗显示】学号</th> <tr> </thead> <tbody> 【表体】 <tr>【表行(体)】 <td>【表列(体)】江寒</td> <td>【表列(体)】2056</td> </tr> <tr> <td>凌风</td> <td>24895</td> </tr> </tbody> </table> TIPS:合并单元格 跨行合并<td rowspan="2">江寒 凌风</td>跨列合并<td colspan="2">江寒 24856</td>
垂直居中CSS让人头疼的问题就是垂直居中。实现垂直居中好几种形式,但每一种形式都有肯定的局限性,所以垂直居中能够依据理论的业务场景来应用。 在容器里让内容居中最好的形式是依据特定场景思考不同因素。做出判断前,先一一询问本人以下几个问题,直到找到适合的解决办法。 容器外面的内容只有一行文字?容器天然高度?容器须要指定高度或者防止应用内边距?应用Flexbox布局?容器和内容的高度都晓得?不晓得外部元素的高度?容器外面的内容只有一行文字设置一个大的行高,让它等于现实的容器高度。这样会让容器高度扩大到可能包容行高。如果内容不是行内元素,能够设置为inline-block。 <!DOCTYPE html><html lang="en"> <style> * { padding: 0; margin: 0; } div { height: 60px; background-color: #1888fa; color: white; } span { line-height: 60px; } </style> <body> <div> <span>测试居中</span> </div> </body></html>容器天然高度CSS中最简略的垂直居中办法是给容器相等的高低内边距,让容器和内容自行决定本人的高度。 看上面的例子, 通过设置padding-top 和padding-bottom相等的值,让内容在父容器垂直剧中。 <!DOCTYPE html><html lang="en"> <style> * { padding: 0; margin: 0; } div { padding-top: 20px; padding-bottom: 20px; background-color: #1888FA; color: white; } </style> <body> <div> <span>测试居中</span> </div> </body></html>容器须要指定高度或者防止应用内边距能够给父容器设置display: table, 子元素设置display: table-cell;vertical-align: middle;, 让子元素来垂直居中。 <!DOCTYPE html><html lang="en"> <style> * { padding: 0; margin: 0; } div { width: 100%; height: 60px; background-color: #1888fa; color: white; display: table; } span { display: table-cell; vertical-align: middle; } </style> <body> <div> <span>测试居中</span> </div> </body></html>应用 FlexBox应用flex布局在做居中的时候非常容易。 ...
事件的流传:*对于事件的流传网景公司和微软公司有不同的了解。 -微软公司认为事件应该是由外向外流传,也就是当事件触发时,应该先触发以后元素上的事件,而后再向以后元素的先人元素上流传,也就说事件应该在冒泡阶段执行。 -网景公司认为事件应该是由内向内流传的,也就是以后事件触发时,应该先触发以后元素的最外层的先人元素的事件.而后在向内流传给后辈元素。 -W3C 综合了两个公司的计划,将事件流传分成了三个阶段(当初浏览器执行的默认规范): 1.捕捉阶段:在捕捉阶段时,从最外层的先人元素,向指标元素进行事件的捕捉.然而默认此时不会触发事件 。2.指标阶段:事件捕捉到指标元素,捕捉完结,开始在指标元素上触发事件 。3.冒泡阶段:事件从指标元素向他的先人元素传递,顺次触发先人元素上的事件。
作者:Shadeed译者:前端小智起源:dmitripavlutin点赞再看,微信搜寻【大迁世界】,B站关注【前端小智】这个没有大厂背景,但有着一股向上踊跃心态人。本文 GitHub https://github.com/qq44924588... 上曾经收录,文章的已分类,也整顿了很多我的文档,和教程材料。最近开源了一个 Vue 组件,还不够欠缺,欢送大家来一起欠缺它,也心愿大家能给个 star 反对一下,谢谢各位了。 github 地址:https://github.com/qq44924588... React 提供了两种办法来拜访input字段的值:应用受控或非受控组件。我更喜爱受控组件,因为咱们能够通过组件的状态读取和设置input的值。 在这篇文章中,咱们来看看如何应用React Hook 实现受控组件。 1.受控组件假如咱们有一个简略的文本字段,并且想拜访其值: import { useState } from 'react';function MyControlledInput({ }) { const [ value, setValue ] = useState(''); const onChange = (event) => { setValue(event.target.value); } return ( <> <div>Input value: {value}</div> <input value={value} onChange={onChange} /> </> )} 关上示例(https://codesandbox.io/s/cont...。能够看到 value 变量蕴含input字段中的值,并且在每次输出新值时,它也会更新。 input字段受到管制,因为 React 从状态<input value = {value} ... />设置其值。 当用户在input 中输出内容时,onChange处理程序会应用从事件对象event.target.value拜访的输出值来更新状态。 value变量示意用户实在输出的值。每次须要拜访用户在input字段中输出的值时,只需读取value状态变量。 受控组件办法能够帮忙咱们拜访任何输出类型的值:惯例文本输出、textarea、select 等。 2. 受控组件中的3个步骤中设置受控组件须要3个步骤: ...
一、罕用语法:li{学校$}*16会生成: <li>学校1</li> <li>学校2</li> <li>学校3</li> <li>学校4</li> <li>学校5</li> <li>学校6</li> <li>学校7</li> <li>学校8</li> <li>学校9</li> <li>学校10</li> <li>学校11</li> <li>学校12</li> <li>学校13</li> <li>学校14</li> <li>学校15</li>$符号为数字自增,{示意元素嵌套内容},emmet文档随用随查。
一、开发环境1.开发环境下vue.config.js配置: proxy: { "/api_hu66": { // 容许拜访数据的计算机名称及端口 target: 'http://localhost:3000', ws: true, //启用webSocket changeOrigin: true, //开启代理跨域 pathRewrite: { // 重写api地址 '^/api_hu66': "" } },本地我的项目运行端口为:8080,下面就会把拜访我本地端口运行的我的项目申请的接口进行转发重写,即http://localhost:8080/api_hu66映射为http://localhost:3000/api_hu66上面是申请头后果:能够看到它申请的是8080,但实际上是申请了3000端口。 下面配置完能够拜访胜利,当初把它改为端口2000,看看它的反馈: proxy: { "/api_hu66": { // 容许拜访数据的计算机名称 target: 'http://localhost:2000', ws: true, //启用webSocket changeOrigin: true, //开启代理跨域 pathRewrite: { // 重写api地址 '^/api_hu66': "" } },能够看到输入后果为 500 Error 并且能够看到报错信息: -二、生产环境1.开发环境下NGINX配置:server { listen 80;#监听本地服务器80端口 server_name humianyuan.cn;#服务器ip地址或域名 index index.html index.htm index.php; root /www/wwwroot/humianyuan.cn/dist;#动态页面的index.html寄存目录 #location寄存的是网页地址 location / { try_files $uri $uri/ @router;#须要指向上面的@router否则会呈现vue的路由在nginx中刷新呈现404 index index.html index.htm; } #对应下面的@router,次要起因是路由的门路资源并不是一个实在的门路,所以无奈找到具体的文件 #因而须要rewrite到index.html中,而后交给路由在解决申请资源 location @router { rewrite ^.*$ /index.html last; } #/api_hu66 是你本人定义的接口名称,你后盾本人定义的 location /api_hu66 { rewrite ^.+api/?(.*)$ /$1 break; proxy_pass http://127.0.0.1:3000; #node api server 即须要代理的IP地址 proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #error_page 404 /404.html; include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /\. { deny all; } access_log /www/wwwlogs/access.log; }include /www/server/panel/vhost/nginx/*.conf;}配置文件的try\_files下的配置也能够这样写:#location寄存的是网页地址信息,须要首地址页面作为入口 location / { try_files $uri $uri/ /index.html;#次要是找到index.html目录就好 root /www/wwwroot/humianyuan.cn/dist; index index.html index.htm; }残缺内容为: ...
模板成果点击查看成果 模板代码<section style="overflow: hidden;width: 100%;height: 100%;visibility: visible;" data-share="公众号:懂点君"> <!-- 第二张图片 --> <svg width="100%" height="100%" style="visibility: visible;background: url(https://mmbiz.qpic.cn/mmbiz_png/JpraGu7eGqSiak2l2UzsVHxhomBS2bjpEPTxOt0xNE1dSzhJOrqnpI7WziaxSSxAKHiccAY7GHGIkSAYad1xlaibdw/0?wx_fmt=gif;) no-repeat top center;background-size: 100%;background-position: 0 0;" viewBox="0 0 1024 2225"> <g data-share="公众号:懂点君"> <!-- 第一张图片 --> <foreignObject width="100%" height="100%" x="0" y="0"> <svg style="visibility: visible;background: url(https://mmbiz.qpic.cn/mmbiz_jpg/JpraGu7eGqSiak2l2UzsVHxhomBS2bjpEgkFeFiajNpSaqyAJd2gaUD6ibCgtPjv2TAfcyeibNR5VzibbyCDdhiagjnw/0?wx_fmt=jpeg) no-repeat top center;background-size: 100%;pointer-events: none;" viewBox="0 0 1024 2225" xmlns="http://www.w3.org/2000/svg"> </svg> </foreignObject> <!-- 音乐区域 --> <foreignObject width="100%" height="100%" x="0" y="0"> <section style="overflow: hidden;pointer-events: painted;opacity: 0;transform: scale(90) translate(-462px, 19px);"> <!-- 须要替换如下音乐代码(具体步骤请看视频教程) --> <section><qqmusic class="js_editor_qqmusic js_uneditable" musicid="213874992" mid="001Mi6C00aNunH" albumurl="https://y.gtimg.cn/music/photo_new/T002R68x68M000003x0x0W02puoP.jpg" audiourl="http://isure6.stream.qqmusic.qq.com/C200004VUx6R2b7AMH.m4a?guid=2000001731&vkey=F5565B900A3BC11A2DE3C4CF1499B08A96E19BA02F27BDA9B18FAA349BE61146EB2B66D5545097C71376BE16E58F8721D427D1351DD9CFBA&uin=&fromtag=50" music_name="奔跑" singer="羽泉 - 嗨,唱起来 第2期" play_length="164" src="/mp/readtemplate?t=app_editor/music&singer=%E7%BE%BD%E6%B3%89%20-%20%E5%97%A8%EF%BC%8C%E5%94%B1%E8%B5%B7%E6%9D%A5%20%E7%AC%AC2%E6%9C%9F&music_name=%E5%A5%94%E8%B7%91&albumurl=https%3A%2F%2Fy.gtimg.cn%2Fmusic%2Fphoto_new%2FT002R68x68M000003x0x0W02puoP.jpg&musictype=1" musictype="1" otherid="001Mi6C00aNunH" albumid="003x0x0W02puoP" jumpurlkey="" data-pluginname="insertaudio"></qqmusic><span id="qqmusic_main_213874992_2" class="js_wap_qqmusic db pages_reset music_area "> <span class="tc tips_global unsupport_tips" style="display:none;"> 以后浏览器不反对播放音乐或语音,请在微信或其余浏览器中播放 </span> <span class="db music_card appmsg_card_context appmsg_card_active"> <a id="qqmusic_home_213874992_2" class="music_card_bd"> <span class="music_card_title">奔跑</span> <span class="music_card_desc">羽泉 - 嗨,唱起来 第2期</span> <span class="music_card_source "> </span> </a> <span id="qqmusic_play_213874992_2" class="music_card_ft"> <i class="weui-play-btn"></i> <!--  -->  </span> </span> </span></section> </section> </foreignObject> <!-- 暗藏第一张图片的动画 --> <animate attributeName="opacity" begin="touchstart+0.3s" dur="380s" keyTimes="0;0.0009;1" values="1;0;0" fill="freeze" restart="never"></animate> </g> </svg></section><!-- 管制点击区域大小 --><section style="height: 0px;margin-top: -2px;line-height: 0;font-size:0;pointer-events: none;transform: rotate(180deg);" data-share="公众号:懂点君"> <svg style="transform: rotate(180deg);" viewBox="85 0 830 1905" xmlns="http://www.w3.org/2000/svg"> <path fill="#000" opacity="0" style="pointer-events: visible;" d="M-0,0v1890h1100V0.5H-0.5z M600,1600H374v-409h252V1591z"></path> </svg></section>