BigDecimal总结

1、BigDecimal为不可变对象,每次“操作”都会返回新对象。


2、[精度]precision、[非标度值]unscale、[标度]scale

//正数的[精度]precision、[非标度值]unscale、[标度]scale
//0 precision=1,unscale=0,scale=0
BigDecimal tmp = new BigDecimal("0");
System.out.println( "0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale() );tmp = new BigDecimal("0.0");
//0.0 precision=1,unscale=0,scale=1
System.out.println( "0.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("1");
//1 precision=1,unscale=1,scale=0
System.out.println( "1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("1.0");
//1.0 precision=2,unscale=10,scale=1
System.out.println( "1.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("0.1");
//0.1 precision=1,unscale=1,scale=1
System.out.println( "0.1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("122.000");
//122.000 precision=6,unscale=122000,scale=3
System.out.println( "122.000 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());//----------负数的[精度]precision、[非标度值]unscale、[标度]scale
//-0 precision=1,unscale=0,scale=0
tmp = new BigDecimal("-0");
System.out.println( "-0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale() );tmp = new BigDecimal("-0.0");
//-0.0 precision=1,unscale=0,scale=1
System.out.println( "-0.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-1");
//-1 precision=1,unscale=-1,scale=0
System.out.println( "-1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-1.0");
//-1.0 precision=2,unscale=-10,scale=1
System.out.println( "-1.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-0.1");
//-0.1 precision=1,unscale=-1,scale=1
System.out.println( "-0.1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-122.000");
//-122.000 precision=6,unscale=-122000,scale=3
System.out.println( "-122.000 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());

3、强制设置[标度]scale

//强制设置[标度]scale
//----scale默认的0设置为3
BigDecimal de1 = new BigDecimal("125");
System.out.println( "默认scale为0:" + de1 );
System.out.println( "强制设置scale为3:" + de1.setScale(3) );//----scale由初始的2设置为5
de1 = new BigDecimal("28.02");
System.out.println( "初始scale为2:" + de1 );
System.out.println( "强制设置scale为5:" + de1.setScale(5) );//----scale由初始的7设置为2
de1 = new BigDecimal("177.1234567");
System.out.println( "初始scale为7:" + de1 );
try{//精度由大变小(7->2)必须设置舍入规则System.out.println( "强制设置scale为2:" + de1.setScale(2) );
}catch(Exception e){System.out.println( e.getMessage() );
}
System.out.println( "强制设置scale为2:" + de1.setScale(2, RoundingMode.HALF_UP) );

4、舍入详细示例

BigDecimal b1 = new BigDecimal("1");
BigDecimal b2 = new BigDecimal("2");
BigDecimal b3 = new BigDecimal("3");
//按指定精度,向上0.333∞ -> 1
System.out.println("ROUND_CEILING:1/3 = " + b1.divide(b3, RoundingMode.CEILING) );
//按指定精度,向上0.333∞ -> 1
System.out.println("ROUND_UP:1/3 = " + b1.divide(b3, RoundingMode.UP) );//按指定精度,向下0.333∞ -> 0
System.out.println("ROUND_DOWN:1/3 = " + b1.divide(b3, RoundingMode.DOWN) );
//按指定精度,向下0.333∞ -> 0
System.out.println("ROUND_FLOOR:1/3 = " + b1.divide(b3, RoundingMode.FLOOR) );//按指定精度,趋近最近的数,0.333∞ -> 0
System.out.println("ROUND_HALF_DOWN:1/3 = " + b1.divide(b3, RoundingMode.HALF_DOWN) );
//按指定精度,趋近最近的数,0.333∞ -> 0
System.out.println("ROUND_HALF_UP:1/3 = " + b1.divide(b3, RoundingMode.HALF_UP) );//按指定精度,趋近最近的数,0.5向下 0.5-> 0
System.out.println("ROUND_HALF_DOWN:1/2 = " + b1.divide(b2, RoundingMode.HALF_DOWN) );
//按指定精度,趋近最近的数,0.5向上 0.5-> 1
System.out.println("ROUND_HALF_UP:1/2 = " + b1.divide(b2, RoundingMode.HALF_UP) );//按指定精度,趋近最近的数,0.333∞ -> 1
System.out.println("ROUND_HALF_DOWN:2/3 = " + b2.divide(b3, RoundingMode.HALF_DOWN) );
//按指定精度,趋近最近的数,0.333∞ -> 1
System.out.println("ROUND_HALF_UP:2/3 = " + b2.divide(b3, RoundingMode.HALF_UP) );//按指定精度,趋近最近的数,0.5 -> 偶数
//ROUND_HALF_EVEN:1/3 = 0
System.out.println("ROUND_HALF_EVEN:1/3 = " + b1.divide(b3, RoundingMode.HALF_EVEN) );
//ROUND_HALF_EVEN:1/2 = 0
System.out.println("ROUND_HALF_EVEN:1/2 = " + b1.divide(b2, RoundingMode.HALF_EVEN) );
//ROUND_HALF_EVEN:2/3 = 1
System.out.println("ROUND_HALF_EVEN:2/3 = " + b2.divide(b3, RoundingMode.HALF_EVEN) );//明确知道结果,否则抛异常
System.out.println("ROUND_UNNECESSARY:2 = " + b2.setScale(2, RoundingMode.UNNECESSARY));
try{//计算中的结果无法使用:ROUND_UNNECESSARYSystem.out.println("ROUND_UNNECESSARY:1/2 = " + b1.divide(b2, RoundingMode.UNNECESSARY) );
}catch( Exception e ){//Rounding necessarySystem.out.println( e.getMessage() );
}

5、MathContext示例

//计算数的位数较小,最后结果都一样
BigDecimal b1 = new BigDecimal( "23.323" );
BigDecimal b2 = new BigDecimal( "323.57" );
//346.893 precision=6,unscale=346893,scale=3
info( b1.add(b2, MathContext.DECIMAL32) );
//346.893 precision=6,unscale=346893,scale=3
info( b1.add(b2, MathContext.DECIMAL64) );
//346.893 precision=6,unscale=346893,scale=3
info( b1.add(b2, MathContext.DECIMAL128) );//DECIMAL32-->precision最大为7
//DECIMAL64-->precision最大为16
//DECIMAL128-->precision最大为34
b1 = new BigDecimal( "1231243434341223.25532323" );
b2 = new BigDecimal( "4532323.55457" );
//1.231243E+15 precision=7,unscale=1231243,scale=-9
info( b1.add(b2, MathContext.DECIMAL32) );
//1231243438873547 precision=16,unscale=1231243438873547,scale=0
info( b1.add(b2, MathContext.DECIMAL64) );
//1231243438873546.80989323 precision=24,unscale=123124343887354680989323,scale=8
info( b1.add(b2, MathContext.DECIMAL128) );

6、equals和sort

注:如果 BigDecimal 对象用作 SortedMap 中的键或 SortedSet 中的元素,则应特别小心,因为 BigDecimal 的自然排序与 equals 方法不一致。

Map接口是按照 equals 操作定义的,但有序映射SortedMap使用它的 compareTo(或 compare)方法对所有键进行比较

BigDecimal b1 = new BigDecimal("28.000");
BigDecimal b2 = new BigDecimal(28);
//28.000 precision=5,unscale=28000,scale=3
info( b1 );
//28 precision=2,unscale=28,scale=0
info( b2 );
//false
System.out.println( b1.equals(b2) );
System.out.println( "b1.hashCode=" + b1.hashCode() );
System.out.println( "b2.hashCode=" + b2.hashCode() );
//0
System.out.println( b1.compareTo(b2) );//注:如果 BigDecimal 对象用作 SortedMap 中的键或 SortedSet 中的元素,则应特别小心,因为 BigDecimal 的自然排序与 equals 方法不一致。
Map<BigDecimal, String> treeMap = new TreeMap<BigDecimal,String>();
treeMap.put(b1, "28.000");
treeMap.put(b2, "28");
treeMap.put(new BigDecimal("12"), "12");
//{12=12, 28.000=28}
System.out.println( treeMap );Map<BigDecimal, String> hashMap = new HashMap<BigDecimal, String>();
hashMap.put(b1, "28.000");
hashMap.put(b2, "28");
hashMap.put(new BigDecimal("12"), "12");
//{28.000=28.000, 12=12, 28=28}
System.out.println( hashMap );// Map接口是按照 equals 操作定义的,但有序映射SortedMap使用它的 compareTo(或 compare)方法对所有键进行比较

7、综合示例

static void actionByDouble(){String[] arr = new String[]{"3649926.00","213582.00","253270.00","172841.00","204571.00","177974.00","189629.00","155114.00","135878.00","119562.00","132559.00","159562.00","161837.00","103169.00","136250.00","132953.00","121470.00000000001"};BigDecimal total = BigDecimal.ZERO;for( String s : arr ){double d = Double.valueOf(s);BigDecimal num = new BigDecimal(d);total = total.add( num );}//actionByDouble: total=6220147.00System.out.println( "actionByDouble: total=" + total.setScale(2, BigDecimal.ROUND_HALF_UP) );
}


public class BigDecimalTest {/*** @param args*/public static void main(final String[] args) {actionByString();actionByDouble();test();matchContext();equalsAndSort();}static void test(){//正数的[精度]precision、[非标度值]unscale、[标度]scale//0 precision=1,unscale=0,scale=0BigDecimal tmp = new BigDecimal("0");System.out.println( "0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale() );tmp = new BigDecimal("0.0");//0.0 precision=1,unscale=0,scale=1System.out.println( "0.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("1");//1 precision=1,unscale=1,scale=0System.out.println( "1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("1.0");//1.0 precision=2,unscale=10,scale=1System.out.println( "1.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("0.1");//0.1 precision=1,unscale=1,scale=1System.out.println( "0.1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("122.000");//122.000 precision=6,unscale=122000,scale=3System.out.println( "122.000 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());//----------负数的[精度]precision、[非标度值]unscale、[标度]scale//-0 precision=1,unscale=0,scale=0tmp = new BigDecimal("-0");System.out.println( "-0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale() );tmp = new BigDecimal("-0.0");//-0.0 precision=1,unscale=0,scale=1System.out.println( "-0.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-1");//-1 precision=1,unscale=-1,scale=0System.out.println( "-1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-1.0");//-1.0 precision=2,unscale=-10,scale=1System.out.println( "-1.0 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-0.1");//-0.1 precision=1,unscale=-1,scale=1System.out.println( "-0.1 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());tmp = new BigDecimal("-122.000");//-122.000 precision=6,unscale=-122000,scale=3System.out.println( "-122.000 precision=" + tmp.precision() +",unscale=" + tmp.unscaledValue()+ ",scale=" + tmp.scale());//强制设置[标度]scale//----scale默认的0设置为3BigDecimal de1 = new BigDecimal("125");System.out.println( "默认scale为0:" + de1 );System.out.println( "强制设置scale为3:" + de1.setScale(3) );//----scale由初始的2设置为5de1 = new BigDecimal("28.02");System.out.println( "初始scale为2:" + de1 );System.out.println( "强制设置scale为5:" + de1.setScale(5) );//----scale由初始的7设置为2de1 = new BigDecimal("177.1234567");System.out.println( "初始scale为7:" + de1 );try{//精度由大变小(7->2)必须设置舍入规则System.out.println( "强制设置scale为2:" + de1.setScale(2) );}catch(Exception e){System.out.println( e.getMessage() );}System.out.println( "强制设置scale为2:" + de1.setScale(2, RoundingMode.HALF_UP) );BigDecimal b1 = new BigDecimal("1");BigDecimal b2 = new BigDecimal("2");BigDecimal b3 = new BigDecimal("3");//按指定精度,向上0.333∞ -> 1System.out.println("ROUND_CEILING:1/3 = " + b1.divide(b3, RoundingMode.CEILING) );//按指定精度,向上0.333∞ -> 1System.out.println("ROUND_UP:1/3 = " + b1.divide(b3, RoundingMode.UP) );//按指定精度,向下0.333∞ -> 0System.out.println("ROUND_DOWN:1/3 = " + b1.divide(b3, RoundingMode.DOWN) );//按指定精度,向下0.333∞ -> 0System.out.println("ROUND_FLOOR:1/3 = " + b1.divide(b3, RoundingMode.FLOOR) );//按指定精度,趋近最近的数,0.333∞ -> 0System.out.println("ROUND_HALF_DOWN:1/3 = " + b1.divide(b3, RoundingMode.HALF_DOWN) );//按指定精度,趋近最近的数,0.333∞ -> 0System.out.println("ROUND_HALF_UP:1/3 = " + b1.divide(b3, RoundingMode.HALF_UP) );//按指定精度,趋近最近的数,0.5向下 0.5-> 0System.out.println("ROUND_HALF_DOWN:1/2 = " + b1.divide(b2, RoundingMode.HALF_DOWN) );//按指定精度,趋近最近的数,0.5向上 0.5-> 1System.out.println("ROUND_HALF_UP:1/2 = " + b1.divide(b2, RoundingMode.HALF_UP) );//按指定精度,趋近最近的数,0.333∞ -> 1System.out.println("ROUND_HALF_DOWN:2/3 = " + b2.divide(b3, RoundingMode.HALF_DOWN) );//按指定精度,趋近最近的数,0.333∞ -> 1System.out.println("ROUND_HALF_UP:2/3 = " + b2.divide(b3, RoundingMode.HALF_UP) );//按指定精度,趋近最近的数,0.5 -> 偶数//ROUND_HALF_EVEN:1/3 = 0System.out.println("ROUND_HALF_EVEN:1/3 = " + b1.divide(b3, RoundingMode.HALF_EVEN) );//ROUND_HALF_EVEN:1/2 = 0System.out.println("ROUND_HALF_EVEN:1/2 = " + b1.divide(b2, RoundingMode.HALF_EVEN) );//ROUND_HALF_EVEN:2/3 = 1System.out.println("ROUND_HALF_EVEN:2/3 = " + b2.divide(b3, RoundingMode.HALF_EVEN) );//明确知道结果,否则抛异常System.out.println("ROUND_UNNECESSARY:2 = " + b2.setScale(2, RoundingMode.UNNECESSARY));try{//计算中的结果无法使用:ROUND_UNNECESSARYSystem.out.println("ROUND_UNNECESSARY:1/2 = " + b1.divide(b2, RoundingMode.UNNECESSARY) );}catch( Exception e ){//Rounding necessarySystem.out.println( e.getMessage() );}}static void matchContext(){//计算数的位数较小,最后结果都一样BigDecimal b1 = new BigDecimal( "23.323" );BigDecimal b2 = new BigDecimal( "323.57" );//346.893 precision=6,unscale=346893,scale=3info( b1.add(b2, MathContext.DECIMAL32) );//346.893 precision=6,unscale=346893,scale=3info( b1.add(b2, MathContext.DECIMAL64) );//346.893 precision=6,unscale=346893,scale=3info( b1.add(b2, MathContext.DECIMAL128) );//DECIMAL32-->precision最大为7//DECIMAL64-->precision最大为16//DECIMAL128-->precision最大为34b1 = new BigDecimal( "1231243434341223.25532323" );b2 = new BigDecimal( "4532323.55457" );//1.231243E+15 precision=7,unscale=1231243,scale=-9info( b1.add(b2, MathContext.DECIMAL32) );//1231243438873547 precision=16,unscale=1231243438873547,scale=0info( b1.add(b2, MathContext.DECIMAL64) );//1231243438873546.80989323 precision=24,unscale=123124343887354680989323,scale=8info( b1.add(b2, MathContext.DECIMAL128) );}static void equalsAndSort(){BigDecimal b1 = new BigDecimal("28.000");BigDecimal b2 = new BigDecimal(28);//28.000 precision=5,unscale=28000,scale=3info( b1 );//28 precision=2,unscale=28,scale=0info( b2 );//falseSystem.out.println( b1.equals(b2) );System.out.println( "b1.hashCode=" + b1.hashCode() );System.out.println( "b2.hashCode=" + b2.hashCode() );//0System.out.println( b1.compareTo(b2) );//注:如果 BigDecimal 对象用作 SortedMap 中的键或 SortedSet 中的元素,则应特别小心,因为 BigDecimal 的自然排序与 equals 方法不一致。Map<BigDecimal, String> treeMap = new TreeMap<BigDecimal,String>();treeMap.put(b1, "28.000");treeMap.put(b2, "28");treeMap.put(new BigDecimal("12"), "12");//{12=12, 28.000=28}System.out.println( treeMap );Map<BigDecimal, String> hashMap = new HashMap<BigDecimal, String>();hashMap.put(b1, "28.000");hashMap.put(b2, "28");hashMap.put(new BigDecimal("12"), "12");//{28.000=28.000, 12=12, 28=28}System.out.println( hashMap );// Map接口是按照 equals 操作定义的,但有序映射SortedMap使用它的 compareTo(或 compare)方法对所有键进行比较}static void actionByString(){String[] arr = new String[]{"3649926.00","213582.00","253270.00","172841","204571","177974","189629","155114","135878","119562","132559","159562","161837","103169","136250","132953","121470.00000434"};BigDecimal total = BigDecimal.ZERO;for( String s : arr ){BigDecimal num = new BigDecimal(s);total = total.add( num );}//actionByString: total=6220147.00System.out.println( "actionByString: total=" + total.setScale(2, RoundingMode.HALF_UP) );}static void actionByDouble(){String[] arr = new String[]{"3649926.00","213582.00","253270.00","172841.00","204571.00","177974.00","189629.00","155114.00","135878.00","119562.00","132559.00","159562.00","161837.00","103169.00","136250.00","132953.00","121470.00000000001"};BigDecimal total = BigDecimal.ZERO;for( String s : arr ){double d = Double.valueOf(s);BigDecimal num = new BigDecimal(d);total = total.add( num );}//actionByDouble: total=6220147.00System.out.println( "actionByDouble: total=" + total.setScale(2, BigDecimal.ROUND_HALF_UP) );}/*** 指定BigDecimal的内部信息* @param decimal*/static void info( final BigDecimal decimal ){System.out.println( decimal + " precision=" + decimal.precision() +",unscale=" + decimal.unscaledValue()+ ",scale=" + decimal.scale());}}



本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/497632.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ubuntu 12.10 安装mysql_Ubuntu12.10安装Mysql数据库

安装步骤要安装mysql&#xff0c;可以在终端提示符下输入以下命令&#xff1a;sudo apt-get install mysql-server mysql-client #中途会让你输入一次root用户密码 一旦安装完成&#xff0c;MySQL 服务器应该自动启动。sudo start mysql #手动的话这样启动sudo stop mysql #手动…

36小时,造一个亚马逊无人商店 | 实战教程+代码

夏乙 问耕 编译整理量子位 出品 | 公众号 QbitAIclass"video_iframe" data-vidtype"2" allowfullscreen"" frameborder"0" data-ratio"1.7666666666666666" data-w"848" scrolling"no" data-src"h…

穷查理宝典--人类误判心理学思维导图

穷查理宝典--人类误判心理学思维导图 分享地址&#xff1a;https://www.processon.com/view/link/5d6e0976e4b09176f3092aa6

mysql中怎么在列中使用时间函数_mysql中关于时间的函数使用教程

UNIX_TIMESTAMP() UNIX_TIMESTAMP(date) 如果没有参数调用&#xff0c;返回一个Unix时间戳记(从1970-01-01 00:00:00GMT开始的秒数)。如果UNIX_TIMESTAMP()用一 个date参数被调用&#xff0c;它返回从1970-01-01 00:00:00 GMT开始的秒数值。date可以是一个DATE字符串、一个DATE…

深度学习将眼睛变成健康“指示器”

来源&#xff1a;科学网概要&#xff1a;科学家正利用该方法寻找基因组中的突变&#xff0c;并且预测单个细胞布局的变化。眼膜图象可使计算机预测一个人是否会马上心脏病发作。人们常说&#xff0c;眼睛是心灵的窗户。但谷歌公司的研究人员将其视为个人健康的“指示器”。这个…

mysql删除赋权_mysql 添加用户 删除用户 赋权

MySql中添加用户,新建数据库,用户授权,删除用户,修改密码(注意每行后边都跟个;表示一个命令语句结束):1.新建用户1.1 登录MYSQL&#xff1a;>mysql -u root -p>密码1.2 创建用户&#xff1a;mysql> insert into mysql.user(Host,User,Password) values("localhos…

AI智能手机会是什么样?至少有这十个功能

来源&#xff1a;腾讯科技&#xff0c;编译&#xff1a;云开概要&#xff1a;AI功能将成为智能手机厂商提升产品差异度&#xff0c;获得新客户&#xff0c;留住现有用户的一种手段。业界媒体digit近日发表文章称&#xff0c;据调研公司Gartner预测&#xff0c;到2022年&#xf…

Mockito教程--思维导图笔记

笔记来源&#xff1a;https://blog.csdn.net/xiang__liu/article/details/81147933 思维导图地址&#xff1a;https://www.processon.com/view/link/5da7bfbfe4b0ea86c2b3db94

有生之年,人工智能会给世界带来什么变化?这里是现代机器人之父Rodney Brooks关于未来的预言

来源&#xff1a;网络大数据概要&#xff1a;所有的新技术都会“这项技术对人类有多少好处”或者“这项技术有多糟糕”之类的预测。新年伊始&#xff0c;世界著名的机器人学家&#xff0c;机器人企业家(iRobot和Rethink Robotics两家知名机器人企业的创始人)&#xff0c;澳大利…

linux配置mysql数据库_Linux下配置mysql数据库

1 linux下安装mysql数据库1、将安装包上传到linux目录下/usr/local/wollo2、使用 tar命令在当前目录下解压mysql解压命令为&#xff1a;[rootbogon wollo]# tar -zxvf mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz3、将解压后的mysql文件夹复制到usr目录下的local目录中复制命令…

《学习究竟是什么》思维导图笔记

《学习究竟是什么》思维导图笔记 详细地址&#xff1a;https://www.processon.com/view/5f0184a6e401fd3908b1f1a7#map

百度CES大秀,Apollo2.0与DuerOS新产品背后的百度开放新姿态

来源&#xff1a;亿欧概要&#xff1a;在过去的一年里&#xff0c;无论是自动驾驶开放平台 Apollo和智能语音交互平台DuerOS都取得了外界瞩目的成绩&#xff0c;百度迫切地希望把这份成绩传达出去&#xff0c;并且吸引来更多的合作伙伴&#xff0c;扩大战果。美国当地时间1月8日…

jmeter里的连接数_Jmeter之连接问题

Connection reset报错原理服务器端因为某种原因关闭了Connection&#xff0c;而客户端依然在读写数据&#xff0c;此时服务器会返回复位标志“RST”&#xff0c;然后此时客户端就会提示“java.net.SocketException: Connection reset”。产生原因服务器的并发连接数超过了其承载…

HttpClient 指南思维导图笔记

完整思维导图&#xff1a;https://www.processon.com/view/link/5ff28968e401fd661a0f0c2f

机器人产业的前途取决于人工智能关键技术的发展

来源&#xff1a;亿欧概要&#xff1a;让机器人实现智能的关键技术在最近十年会发展到什么程度&#xff1f;整个产业的应用前景将会如何&#xff1f;目前的机器人已经能够胜任精确、重复性的工作&#xff0c;但很多时候&#xff0c;它还不能够灵活地为新任务进行自我调整&#…

mysql binlog过期策略_对存在过期 binlog 的 MySQL5.7 添加从服务器

数据库版本&#xff1a;MySQL 5.7原数据库&#xff1a;mysql01从数据库&#xff1a;mysql02原数据库配置文件datadir/var/lib/mysqlsocket/var/lib/mysql/mysql.socksymbolic-links0log-error/var/log/mysqld.logpid-file/var/run/mysqld/mysqld.pidserver-id1gtid_modeonenfor…

携手320+合作伙伴,英伟达扔下一枚自动驾驶炸弹,打响新年越野赛 | CES2018

来源&#xff1a;36Kr概要&#xff1a;英伟达宣布世界首个自动机器处理器英伟达DRIVE Xavier&#xff0c;2018年第一季度发布&#xff0c;称这是英伟达有史以来最大的研发投入&#xff0c;研发投入高达 20 亿美元。还是那个伸手就可以从兜里掏出芯片的老黄。黄仁勋以2个小时的主…

对象设计——责任、角色和协作思维导图笔记

思维导图url&#xff1a;https://www.processon.com/view/link/5ff6660007912930e01fc923

mysql h 127.0.0.1_MySQL 连接时尽量使用 127.0.0.1 而不是 localhost

原因Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead o…

英特尔宣布全新自动驾驶平台整合处理器和视觉芯片

来源&#xff1a;网易科技概要&#xff1a;在英特尔主题演讲环节中&#xff0c;英特尔公司Mobileye联合创始人Amnon Shashua发布了英特尔全新的自动驾驶平台&#xff0c;包含2个EyeQ5芯片以及一个凌动芯片。美国拉斯维加斯时间1月9日至12日&#xff0c;第51届国际消费类电子产品…