首页
学习
活动
专区
工具
TVP
发布

java大数据

专栏作者
627
文章
443353
阅读量
29
订阅数
java中给出一个主线程如何捕获子线程异常的例子
import java.lang.Thread.UncaughtExceptionHandler;
马克java社区
2021-04-20
9850
javascript当中parseFloat用法
3)parseFloat 例 4.3.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- /* 马克-to-win parseFloat() (Function/global) Parse a string to extract a floating-point value. Property/method value type: Number primitive JavaScript syntax: - parseFloat(aNumericString) Argument list: aNumericString A meaningful numeric value. The parseFloat() function returns a numeric value is returned, unless the string cannot be resolved to a meaningful value in which case NaN is returned instead. It produces a number value dictated by interpreting the contents of the string as if it were a decimal literal value. During conversion parseFloat() ignores leading whitespace characters so you don't have to remove them from the string before conversion takes place. Note that parseFloat() will only process the leading portion of the string. As soon as it encounters an invalid floating-point numeric character it will assume the scanning is complete. It will then silently ignore any remaining characters in the input argument. */ var x = parseFloat("727.079") var y = parseFloat("77.079xyz") var z= parseFloat("xyz77.079") document.write("x="+x+",y="+y+",z="+z) //--> </SCRIPT> </BODY> </HTML>
马克java社区
2019-11-26
5980
javascript当中parseInt用法
4)parseInt 例 4.4.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- /* 马克-to-win: parseInt() (Function/global) Parse a string to extract an integer value. Property/method value type: Number primitive JavaScript syntax: - parseInt(aNumericString, aRadixValue) Argument list: aNumericString A string that comprises a meaningful numeric value. aRadixValue A numeric value indicating the radix for conversion The parseInt() function produces an integer value dictated by interpreting the string argument according to the specified radix. It can happily cope with hexadecimal values specified with the leading 0x or 0X notation. During conversion parseInt() will remove any leading whitespace characters. You don't need to do that to the string before parsing it. Note also that parseInt() may only interpret the leading portion of a string. As soon as it encounters an invalid integer numeric character it will assume the scanning is complete. It will then silently ignore any remaining characters in the input argument. Typical radix values are: 2 - Binary 8 - Octal 10 - Decimal 16 - Hexadecimal */ var x = parseInt("77") var y = parseInt("77xyz") document.write("x="+x+",y="+y) var x1 = window.parseInt("77",2) var y1 = parseInt("77",8) document.write("x1="+x1+",y1="+y1) //--> </SCRIPT> </BODY> </HTML>
马克java社区
2019-11-25
1.4K0
javascript当中eval用法
1)eval 例 4.1.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- /*马克-to-win:var scriptCode = "c = a * b"; var a = 5; var b = 10; var c = 2; eval(scriptCode); 以上的话就相当于: eval("c = a * b");===c = a * b eval是global的方法, */ var result = window.eval("1+2/4") ;//根据上面所说,result=1+2/4; document.write(result) var s="today=new Date();document.write(today.toLocaleString())" eval(s) //--> </SCRIPT> </BODY> </HTML> 例 4.1.2 <HTML> <HEAD> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <TITLE>在eclipse中直接open with火狐即可</TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- //例1 var s = "2+31-18"; /*When the eval() function is called, it expects a string to be passed to it as its single argument value. The contents of that string should be syntactically correct executable script source text.*/ document.write(eval(s)); var s1 = "2+31a-18"; /* note that we must comment out the following statement, otherwise, it reports error.*/ //document.write(eval(s1)); //例2 eval("d =new Date();document.write(d.toLocaleString())") //eval()函数的参数为字符串,功能是将该字符串执行出来。体会“执行”的意思! //--> </SCRIPT> </BODY> </HTML>
马克java社区
2019-11-25
1.2K0
javascript当中反义字符用法
反义字符 \W 匹配任意非字母,数字,下划线,汉字的字符 \S 匹配任意不是空白符的字符 \D 匹配任意非数字的字符 \B 匹配不是单词开头或结束的位置 ^ 取反(^写在[]里面的话,就代表排除的意思,一般来讲,^ 匹配字符串的开始) 用法示例: 1、[^abc]匹配除了abc这几个字母以外的任意字符 2、\S+匹配不包含空白符的字符串。 字符转义 如果查找预定义字符集本身的话我们没法指定它们,因为它们会被解释成特殊的意思。这时你就必须使用\来取消这些字符的特殊意义。
马克java社区
2019-10-30
5070
event兼容,clientX,pageX,offsetX和screenX的区别,图片移动
3.event兼容,clientX,pageX,offsetX和screenX的区别,图片移动。 例 3.1:event兼容,clientX,offsetX和screenX的区别,图片移动。 clientX 设置或获取鼠标指针位置相对于窗口客户区域的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条。 pageX:参照点也是浏览器内容区域的左上角,但它包括滚动条,即不会随着滚动条而变动 offsetX 设置或获取鼠标指针位置相对于触发事件的对象的 x 坐标。包括滚动条。 screenX 设置或获取获取鼠标指针位置相对于用户屏幕的 x 坐标。 马克-to-win:做实验时,可以选择四个地点,一个是窗口最左边,一个就是有字的最左边,最后一个选择窗口的最右边。这时出现滚动条,按右箭头到头,点击,你会发现区别。 <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <div style=" position:absolute; left:200px;top:200px"> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> acdsacdaddscsavfdvdfavvavdav<br> </div> <div id="img" style=" z-index:1; position:absolute; left:0px;top:0px"><img src="1.jpg" /></div> <script> var car = document.getElementById("img"); function move(event) { var event = event || window.event; /*clientX 设置或获取鼠标指针位置相对于窗口客户区域的 x 坐标,其中客户区域不包括窗口自身的控件和滚动条。 offsetX 设置或获取鼠标指针位置相对于触发事件的对象的 x 坐标。 screenX 设置或获取获取鼠标指针位置相对于用户屏幕的 x 坐标。 马克-to-win:做实验时,可以选择三个地点,一个是窗口最左边,一个就是有字的最左边,最后一个选择窗口的最右边。 */ alert("event.clientX is "+event.clientX+"event.pageX is "+event.pageX+"event.offsetX is "+event.offsetX+"event.screenX is "+event.screenX); car.style.left = event.clientX ; car.style.top = event.clientY; } document.onmousedown=move; </script>
马克java社区
2019-10-17
1K0
javascript当中 document onkeydown的用法
例 2.2(documentKeypressIEFF.html) 马克-to-win:当系统看见这句话:document.onkeydown = handleKeypress; 以后,当你按keydown时,系统自然就调用: handleKeypress(event)。而且传进来event参数。 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </HEAD> <script> function handleKeypress(event) { /*火狐用event所以window.event为undefined,ie正相反,所以event || window.event可以兼容*/ alert("event is "+event +"window.event is "+window.event); alert(111||undefined);//任何数和undefined做||,为原值。 var event = event || window.event; if (window.navigator.userAgent.indexOf("MSIE") >= 1) { var key = event.keyCode; alert("Key: " + String.fromCharCode(key) + "\nCharacter code: " + key + "."); } else if ( window.navigator.userAgent.indexOf("Firefox") >= 1) { var key = event.which;//event.which获取按下的键盘按键Unicode值: /*fromCharCode() 可接受一个或n个指定的 Unicode 值,然后返回一个或多个字符*/ alert("Key: " + String.fromCharCode(key) + "\nCharacter code: " + key + "."); } } document.onkeydown = handleKeypress; </script> </HTML>
马克java社区
2019-10-16
1.5K0
javascript当中string对象用法
3.string对象 例 3.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </HEAD> <BODY> <Script> var hello = "HELLO mark!" with(document) { write(hello,"<BR>") write("马克-to-win第1个字符为:"+hello.charAt(0)+"<BR>") write("L在第"+hello.indexOf("L")+"个字符"+"<BR>") write("L在第"+hello.lastIndexOf("L")+ "个字符"+"<BR>") write("k在第"+hello.indexOf("k")+"个字符"+"<BR>") /*String.fontsize() (Method) Encapsulates the string within an <FONT SIZE="..."> tag context.*/ write(hello.fontsize("5")+"<BR>") /*和Array的slice 一样, fomer包括,latter不包括*/ write("截取第2至第4个字符:"+hello.substring(1,4)+"<BR>") /* myString.substr(aStartPosition, aLength) Argument list: aStartPosition The index of the first character in the substring aLength The length of the substring */ write("截取从第2个字符开始的3个字符:"+hello.substr(1,4)+"<BR>") write("转换为大写:"+hello.toUpperCase()+"<BR>") write("转换为小写:"+hello.toLowerCase()+"<BR>") } </Script> </BODY> </HTML> 更多请见:https://blog.csdn.net/qq_43650923/article/details/100140665
马克java社区
2019-10-14
3140
javascript当中concat,join,slice用法
例 1.3(concat,join,slice) <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <Script> /* 马克-to-win:qixy: Array is a dynamic array. - myArray = new Array(aLength) - myArray = new Array(anItem1, anItem2, anItem3, ...) */ var arr = new Array(1);//arr.length is 1,但是里面的东西是undefined, 所以这样写[undefined] /*虽然arr是个object, 但是里面的东西是undefined*/ document.write("typeof arr is "+typeof(arr)); var a = new Array(2, 6, 5, "a"); document.write("arr.length is "+arr.length+"a.length is "+a.length); var b = new Array(12, 14); arr[0] = "java"; arr[1] = "intel"; arr[2] = "microsoft"; /* Property/method value type: Array object JavaScript syntax: - myArray.concat(someValues, ...) The result of this method is a new array consisting of the original array, plus the concatenation. The values that are passed to the method are added to the end of the array. If arrays are passed, they are flattened and their individual elements added. The method returns an array consisting of the original Array plus the concatenated values. If Array1 contains "AAA", "BBB", "CCC" and Array2 contains "000", "111", "222", then the method call Array1.concat(Array2) will return an array with all the elements in a single collection. The original arrays will be untouched. */ document.write("arr.toString() is " + arr.toString() + "<br>"); //与无参join()方法等同 var arrconcat=arr.concat(a, b); document.write("arr.concat(a,b) is " + arrconcat + "<br>"); /*Array.join() (Method) Concatenate array elements to make a string. Property/method value type: String primitive JavaScript syntax: - myArray.join(aSeparator) Argument list: aSeparator A string to place between array elements as the array is concatenated to form a string. //无参join()方法默认是用逗号连接 */ document.write("arr.join() is " + arr.join
马克java社区
2019-10-13
5020
javascript当中排序比较器用法
例 1.5(排序比较器) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> for teach. <script type="text/javascript"> function sortNumberqixy(a, b) { /* 马克-to-win returned value type: Array object JavaScript syntax: - myArray.sort() - myArray.sort(aComparator) Argument list: aComparator A function object that will compare two items and returns a flag indicating their order in the sort collating sequence. Sort the elements in an array. You must make sure the comparator returns one of the following three values: Negative integer(qixy: not a boolean.) - signifies that the first argument is less than the second.(qixy the whole final result is that small number is in front.) Zero - Signifies that both arguments are the same. Positive integer - Signifies that the first argument is larger than the second. qixy: int=parseInt(String) */ if (parseInt(a) < parseInt(b)) return -5; if (parseInt(a) > parseInt(b)) return 4; else return 0; /* the following is a simple method */ //return a - b } var arr = new Array(3) arr[0] = "9" arr[1] = "6" arr[2] = "6" arr[3] = "26" arr[4] = "10001" arr[5] = "2" document.write(arr + "<br />"); /* note that if we don't give the comparator, sort will use the default way to sort. then it will sort according to String,then its order is 10001,2,26,6,6,9 */ document.write("排序之后:" + arr.sort()); document.write("排序之后:" + arr.sort(sortNumberqixy)); </script> </head> <body> </body> </html>
马克java社区
2019-10-13
4160
javascript当中null和undefined的==和===的比较
例 3.1.3(null和undefined的==和===的比较) <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <script> //马克-to-win:声明变量x /* if a value is not set, its typeof is undefined, its value is undefined, if a value= null, its typeof is object, its value is null,but when you use == to test, they are the same, but when to use === to test, they are not the same,== means as long as value is the same, ok, but === means type also must be equal. */ var x; var z1 = "d"; var y = null; // document.writeln("z1 is"+z1); /*if you cancel commenting out the following statement, it will give the blank page, which means it has error.*/ // document.writeln(zyx); document.writeln(x + " is x"); document.writeln(typeof(x) + " is typeof(x)"); document.writeln(y + " is y"); document.writeln(typeof(y) + " is typeof(y)"); var z = undefined; document.writeln(z + " is z"); document.writeln(typeof(z) + " is typeof(z)"); if (y == undefined) { document.writeln('null and undefined is interchangable'); } if (z1 != null) { document.writeln('z1 != null'); } if (y === undefined) { document.writeln('null and undefined is exactly the same'); } if (x == undefined) { document.writeln('声明变量后默认值为undefined'); } if (x === undefined) { document.writeln('声明变量后默认值为exactly the same as undefined'); } if (x == null) { document.writeln('声明变量后默认值为null'); }
马克java社区
2019-10-05
5720
javascript当中类型转换,typeof的用法
1)类型转换,typeof的用法 例 3.1.1 <HTML> <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <BODY> <SCRIPT LANGUAGE="JavaScript">     <!--     /*     Cast operator (Definition)  refer to 过去的网站www.favo.com     A way of converting data types.     Primitive values can be converted from one to another or rendered as objects by using object constructors to convert the values.     Boolean                                            Number                                             String                                             Number() (Function)  马克-to-win: actually Number() is the method of Global object.     A Number type convertor.     Property/method value type: Number primitive     JavaScript syntax: - Number()     - Number(aValue)     Argument list: aValue A value to be converted to a number.     When the Number() constructor is called as a function, it will perform a type conversion.     The following values are yielded as a result of calling Number() as a function:     Value                            Result     Number                            No conversion, the input value is returned unchanged.     Non numeric string                NaN     window.Number("23");在favo中查不出来, 但Idea中可以打点打出来。     */     var a = 9; /*下句话如果放在ie8中执行, 必须打开debug工具*/ //    console.log(typeof(a));     document.writeln(typeof(a));     var as = String(a);     //String是Global的方法     document.writeln("typeof(as) is " + typeof(as));     var x = window.Number("23");     document.writeln("typeof(x) is " + typeof(x));     var age2 = Number("56");     document.writeln(typeof(age2) + "is typeof(age2)");     var age3 = new Number(56);
马克java社区
2019-10-04
7390
SpringMVC当中请给出一个下载的例子,文件名必需是中文
4.文件下载 例4.1: <%@ page contentType="text/html; charset=GBK" %> <html> <body > <A href="http://localho
马克java社区
2019-09-29
5620
请给出一个SpringMVC的表单提交的例子和session运用的例子
2.表单提交和session 像学servlet那时一样,继hello world的例子以后,紧接着我们就要学习表单提交和session。 例2.1 <%@ page contentType="text/html; charset=GBK" %> <html> <head> <title>form test</title> </head> <body> <%=session.getAttribute("firstN") %> <FORM ACTION="formHan.do" METHOD="POST"> 姓名: <INPUT TYPE="TEXT" NAME="firstName"><BR> <INPUT TYPE="SUBMIT" VALUE="Submit"> </CENTER> </FORM> </body> </html> package com; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class HelloWorldController { @RequestMapping("/formHan") public void formHandle(HttpServletRequest req, HttpServletResponse res, HttpSession ses) throws IOException, ServletException { //没用 req.setCharacterEncoding("gbk"); String fn=req.getParameter("firstName"); System.out.println(fn+"1"); String fngbk = new String(fn.getBytes("iso8859-1"), "GBK"); System.out.println("filenameutf is " + fngbk); ses.setAttribute("firstN", fngbk); // PrintWriter pw=res.getWriter(); // pw.println(fn);//此句可以工作 req.getRequestDispatcher("formT.jsp").forward(req, res); // res.sendRedirect("formT.jsp");//此句可以工作 // return "/formT";//此句可以工作 } }
马克java社区
2019-09-29
4360
mybatis当中如何自动生成Model和映射程序与配置文件和所需要的类
利用mybatis编写的MyBatisGenerator,我们可以生成我们所需要的类和配置文件。
马克java社区
2019-09-25
7980
Mybatis中helloworld例子
return "id:"+id+"\nname:"+name+"\nage:"+age;
马克java社区
2019-09-24
3020
卷积和神经网络有什么关系?
如上一段所述,卷积可以提取特征,但对于真实世界当中的大规模图片库,我们并不知道哪个局部特征有效,我们还是希望通过训练神经网络,自动学习出来,怎么做呢?还得用到前面学到的BP算法,但现在的问题是卷积和神经网络有什么关系呢?看下面两个图可以知道,其实卷积的运算就是相乘之后求和,和神经网络效果是一样的。卷积核和卷积结果分别对应着神经网络中的参数和隐藏层结果。这样就回到前面所学的BP算法了,做法是一样的,先初始化参数,再通过训练使得误差越来越小。
马克java社区
2019-09-10
6100
springCloud当中Eureca服务提供者Provider的部署
服务提供者的部署: 做个普通的maven project,quickstart archetype。改成jdk.8。运行程序后会出现:EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.这个提示跟保护模式相关,和我们的Helloworld例子无关,这里就略过了。当然,可以在前面的server配置文件处,把它关了,enable-self-preservation:false。另外,Eureka本身是一个基于REST的服务,所以你会发现大家通常的服务或消费微服务,都做成是基于REST的服务。 pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com</groupId> <artifactId>EurecaMaven2</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>EurecaMaven2</name> <url>http://maven.apache.org</url> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.2.RELEASE</version> <relativePath /> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Camden.SR2</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency> </dependencies> </project>
马克java社区
2019-08-02
4110
SpringBoot当中如何整合动态html模板:Thymeleaf
4.整合动态html模板:Thymeleaf: 光是静态html还不足够,必须html还能显示动态成分,这时我们考虑使用thymeleaf,就能完全达到springmvc的水平了,官方推荐thymeleaf。继续在上一部分的项目中,在src/main目录下,添加resources/templates/result.html:(参考目录下:bootThymeleaf) 例4.1: 1)首先在pom.xml中添加: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> 注意:即使导了上面的包,也没有办法访问到resources根目录下的html。至于templates目录下的html,直接或sendRedirect都不能访问。唯有用下面的方法访问。 package com.SpringbootMaven; import java.io.IOException; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @SpringBootApplication public class App { @RequestMapping("/hello") public String myhome(HttpServletResponse res,HttpSession session) throws IOException { System.out.println("spring boot springMvc 马克-to-win!"); session.setAttribute("user","马克-to-win 马克java社区创始人"); return "result"; /*下列不能再用了,在Thymeleaf框架中,sendRedirect不能跳到templates目录里的html*/ // res.sendRedirect("result.html"); } public static void main(String[] args) throws Exception { SpringApplication.run(App.class, args); } } index.html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> index1 <a href="/hello.do">test SpringMvc</a> </body> </html>
马克java社区
2019-07-27
1.8K0
Spark和Scala当中的collect方法的用法和例子
collect: 收集一个弹性分布式数据集的所有元素到一个数组中,这样便于我们观察,毕竟分布式数据集比较抽象。Spark的collect方法,是Action类型的一个算子,会从远程集群拉取数据到driver端。最后,将大量数据 汇集到一个driver节点上,将数据用数组存放,占用了jvm堆内存,非常用意造成内存溢出,只用作小型数据的观察。*/ val arr = res.collect(); println("arr(0) is " + arr(0) + " arr(2) is " + arr(2) + " arr(4) is " + arr(4)); } }
马克java社区
2019-07-19
1.9K0
点击加载更多
社区活动
腾讯技术创作狂欢月
“码”上创作 21 天,分 10000 元奖品池!
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档