基于MapReduce的汽车数据清洗与统计案例

数据简介

ecar168.csv(汽车销售数据表):

字段数据类型字段说明
rankingString排名
manufacturerString厂商
vehicle_typeString车型
monthly_sales_volumeString月销量
accumulated_this_yearString本年累计
last_monthString上月
chain_ratioString环比
corresponding_period_of_last_yeaString去年同期
year_on_yearString同比
seriesString系列
monthString统计时间
url_hrefString数据来源 url
url_titleString数据来源 标题
url_car_detailString汽车详情 url
"1,东风日产,日产轩逸,56201,421871,57525,-2.30%,48483,15.92%,全部,2020年10月,http://www.ecar168.cn/xiaoliang/phb_cx/37.htm,2020年10月全部车型销量排行榜,http://data.ecar168.cn/car/216/"
"2,长城汽车,哈弗H6,52734,266231,40475,30.29%,40623,29.81%,全部,2020年10月,http://www.ecar168.cn/xiaoliang/phb_cx/37.htm,2020年10月全部车型销量排行榜,http://data.ecar168.cn/car/658/"
"3,上汽大众,大众朗逸,40984,332685,39595,3.51%,40608,0.93%,全部,2020年10月,http://www.ecar168.cn/xiaoliang/phb_cx/37.htm,2020年10月全部车型销量排行榜,http://data.ecar168.cn/car/465/"
"4,一汽大众,大众宝来,37944,251470,37959,-0.04%,36799,3.11%,全部,2020年10月,http://www.ecar168.cn/xiaoliang/phb_cx/37.htm,2020年10月全部车型销量排行榜,http://data.ecar168.cn/car/477/"
"5,一汽大众,大众速腾,36380,238334,33219,9.52%,36015,1.01%,全部,2020年10月,http://www.ecar168.cn/xiaoliang/phb_cx/37.htm,2020年10月全部车型销量排行榜,http://data.ecar168.cn/car/203/"

ecar168_car_detail.csv(汽车信息表):

字段数据类型字段说明
manufacturerString厂商
vehicle_typeString车型
seriesString系列
url_hrefString数据来源url
url_titleString数据来源 标题
url_car_detailString汽车详情url/综述链接
priceString价格
url_salesString销量链接
"大众速腾,http://data.ecar168.cn/car/203/,13.18-19.68万,紧凑型,2019,1.2L、1.4L,手动、自动,5.4-5.6L(综合)"
"大众宝来,http://data.ecar168.cn/car/477/,9.88-15.6万,紧凑型,2019,1.4L、1.5L,手动、自动,5.6-5.9L(综合)"
"大众朗逸,http://data.ecar168.cn/car/465/,9.99-16.59万,紧凑型,2020,1.2L、1.4L、1.5L,手动、自动,5.1-5.7L(综合)"
"哈弗H6,http://data.ecar168.cn/car/658/,9.8-14.1万,SUV,2020,1.5L、2.0L,手动、自动,6.6-6.9L(综合)"
"长安CS75,http://data.ecar168.cn/car/1133/,9.58-14.68万,SUV,2019,1.5L,手动、自动,6.5-7.0L(综合)"

一、数据去重

在master节点上操作,编写mapreduce代码对ecar168.csv文本文件中的数据去重处理,并把处理完成的数据输出到hdfs上的/output/DupRemoval/路径下。(1分)

1.Mapper类

package com.saddam.bigdata.platform.DupRemoval;import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;public class DupRemovalMapper extends Mapper<LongWritable, Text, Text, Text> {Text outKey=new Text();Text outValue=new Text();/*** @param key--->输入的key:偏移量;输出的key:一整行内容* @param value->输入的value:一整行内容;输出的value:一整行内容* @param context:1,东风日产,日产轩逸,56201,421871,57525,-2.30%,48483,15.92%,全部,2020年                        10月,http://www.ecar168.cn/xiaoliang/phb_cx/37.htm,2020年10月全部车型                        销量排行榜,http://data.ecar168.cn/car/216/ * @throws IOException* @throws InterruptedException*/@Overrideprotected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {//补全代码String line=value.toString();//获取一行outKey.set(line);outValue.set(line);context.write(outKey,outValue);}
}

2.Reducer类

package com.saddam.bigdata.platform.DupRemoval;import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;public class DupRemovalReducer extends Reducer<Text, Text, NullWritable, Text> {@Overrideprotected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {context.write(null,key);}
}

3.Driver类

package com.saddam.bigdata.platform.DupRemoval;import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;public class DupRemovalMapReduce {public static void main(String[] args) throws Exception {Configuration conf = new Configuration();Job job = Job.getInstance(conf, "DupaRemoval");job.setJarByClass(DupRemovalMapReduce.class);job.setMapperClass(DupRemovalMapper.class);job.setReducerClass(DupRemovalReducer.class);job.setMapOutputKeyClass(Text.class);job.setMapOutputValueClass(Text.class);job.setOutputKeyClass(NullWritable.class);job.setOutputValueClass(Text.class);//补全代码String inputPath ="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\input\\car_data.csv";String outputPath ="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\output\\output_car_dup333333";FileInputFormat.setInputPaths(job,new Path(inputPath));FileOutputFormat.setOutputPath(job,new Path(outputPath));boolean b = job.waitForCompletion(true);if (!b) {System.out.println("wordcount task fail!");}}
}

二、数据筛选

在master节点上操作,编写 mapreduce 代码对 hdfs 上的/output/DupRemoval/part-r-00000数据中month字段统一清洗为yyyy-mm(例:2012-04)格式,并保留month(清洗后)、manufacturer 、vehicle_type、monthly_sales_volume、series 、url_car_detail 6个字段输出到hdfs上的/output/dataclean/路径下。(2分)

1.Mapper类

package com.saddam.bigdata.platform.CarData_3000.Clean3000;import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;public class Clean3Mapper extends Mapper<LongWritable, Text, Text, Text> {Text outKey = new Text();Text outValue = new Text();@Overrideprotected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {String[] word = value.toString().split(",");try {//2020年10月String word10 = word[10].replaceAll("年", "-");//word10:2020-10月word10=word10.replaceAll("月","");//word10:2020-10String year=word10.substring(0,5);String month=word10.substring(5);if (month.length()==1){month="0"+month;word10=year+month;}outKey.set(word10);outValue.set(word10 + "," + word[1] + "," + word[2] + "," + word[3] + "," + word[9] + "," + word[13]);context.write(outKey, outValue);} catch (Exception e) {}}
}

2.Reducer类

package com.saddam.bigdata.platform.CarData_3000.Clean3000;import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;public class Clean3Reducer extends Reducer<Text, Text, NullWritable, Text> {@Overrideprotected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {for (Text value : values) {context.write(null,value);}}
}

3.Driver类

package com.saddam.bigdata.platform.CarData_3000.Clean3000;import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;public class Clean3Driver {public static void main(String[] args) throws Exception {Configuration conf = new Configuration();Job job = Job.getInstance(conf, "carclean");job.setJarByClass(Clean3Driver.class);job.setMapperClass(Clean3Mapper.class);job.setReducerClass(Clean3Reducer.class);job.setMapOutputKeyClass(Text.class);job.setMapOutputValueClass(Text.class);job.setOutputKeyClass(NullWritable.class);job.setOutputValueClass(Text.class);String inputPath="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\output\\Car_Data\\3000_dup\\part-r-00000";String outputPath="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\output\\Car_Data\\3000_clean";FileInputFormat.setInputPaths(job,new Path(inputPath));FileOutputFormat.setOutputPath(job,new Path(outputPath));job.waitForCompletion(true);}
}

三、数据整合

在master节点上操作,编写 mapreduce 代码实现以下要求的操作:(3分)oil_consumption字段清洗掉多余内容只保留数值,并计算平均值,保留2位小数,生成为oil_consumption_average新字段。
transmission_case字段中的"手动 自动"类别替换为"全动"。
整合hdfs上的/data/ecar168_car_detail.csv和/output/carjoindetail/part-r-00000数据,要求如下:
以/data/ecar168_car_detail.csv数据为基准,整合/output/carjoindetail/part-r-00000的数据。
按顺序输出date,manufacturer,vehicle_type,monthly_sales_volume,series,url_car_detail,price,car_type,displacement,transmission_case,oil_consumption_average字段。
输出路径为:hdfs://master:9000/output/carjoindetail/

1.Mapper类

package com.saddam.bigdata.platform.CarData_3000.Join3000;import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;import java.io.IOException;public class Join3Mapper extends Mapper<LongWritable, Text, Text, MapWritable> {//创建对象MapWritable mapWritable=new MapWritable();@Overrideprotected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {//获取当前处理的切片FileSplit inputSplit=(FileSplit)context.getInputSplit();//获取切片所属的文件名称(文件名称)String filename=inputSplit.getPath().getName();//切割处理读取的每一行数据String line=value.toString();String[] words=line.split(",");//将Key的值赋空Text TextKey=null;//判断文本名if (filename.equals("part-r-00000")){
//以/data/ecar168_car_detail.csv数据为基准,整合/output/carjoindetail/part-r-00000的数据。//details:大众速腾,http://data.ecar168.cn/car/203/,13.18-19.68万,紧凑型,2019,1.2L、1.4L,手动、自动,5.4-5.6L(综合)//part-r-00000:2019-11,华晨中华,中华H530,84,全部,http://data.ecar168.cn/car/778/TextKey=new Text(words[2]+words[5]);Text month=new Text(words[0]);//获取日期Text manufacturer=new Text(words[1]);//获取厂商Text vehicle_type=new Text(words[2]);//获取车型Text monthly_sales_volume=new Text(words[3]);//获取月销量Text series=new Text(words[4]);//获取系列Text url_car_detail=new Text(words[5]);//获取汽车详情urlmapWritable.put(new Text("flag"),new Text("car"));mapWritable.put(new Text("month"),month);mapWritable.put(new Text("manufacturer"),manufacturer);mapWritable.put(new Text("vehicle_type"),vehicle_type);mapWritable.put(new Text("monthly_sales_volume"),monthly_sales_volume);mapWritable.put(new Text("series"),series);mapWritable.put(new Text("url_car_detail"),url_car_detail);context.write(TextKey,mapWritable);}else {TextKey=new Text(words[0]+words[1]);Text vehicle_type=new Text(words[0]);Text url_href=new Text(words[1]);Text price=new Text(words[2]);Text car_type=new Text(words[3]);Text time_to_market=new Text(words[4]);Text displacement=new Text(words[5]);Text transmission_case=new Text(words[6]);//处理油量String oil_consumption_str=words[7];//5.4-5.6L(综合)oil_consumption_str=oil_consumption_str.replaceAll("(综合)","");//5.4-5.6Loil_consumption_str=oil_consumption_str.replaceAll("L","");//5.4-5.6/*** indexOf() 方法有以下四种形式:** public int indexOf(int ch): 返回指定字符在字符串中第一次出现处的索引,如果此字符串中没有这样的字符,则返回 -1。** public int indexOf(int ch, int fromIndex): 返回从 fromIndex 位置开始查找指定字符在字符串中第一次出现处的索引,如果此字符串中没有这样的字符,则返回 -1。** int indexOf(String str): 返回指定字符在字符串中第一次出现处的索引,如果此字符串中没有这样的字符,则返回 -1。** int indexOf(String str, int fromIndex): 返回从 fromIndex 位置开始查找指定字符在字符串中第一次出现处的索引,如果此字符串中没有这样的字符,则返回 -1。*/if (oil_consumption_str.indexOf("-")>0){String[] oil_consumption_=oil_consumption_str.split("-");float oil_consumption_0=Float.parseFloat(oil_consumption_[0]);float oil_consumption_1=Float.parseFloat(oil_consumption_[1]);oil_consumption_str=String.valueOf((oil_consumption_0+oil_consumption_1)/2).substring(0,3);}Text oil_consumption_average=new Text(oil_consumption_str);mapWritable.put(new Text("flag"),new Text("detail"));mapWritable.put(new Text("vehicle_type"),vehicle_type);mapWritable.put(new Text("url_href"),url_href);mapWritable.put(new Text("price"),price);mapWritable.put(new Text("car_type"),car_type);mapWritable.put(new Text("time_to_market"),time_to_market);mapWritable.put(new Text("displacement"),displacement);mapWritable.put(new Text("time_to_market"),time_to_market);mapWritable.put(new Text("transmission_case"),transmission_case);mapWritable.put(new Text("oil_consumption_average"),oil_consumption_average);context.write(TextKey,mapWritable);}}
}

2.Reducer类

package com.saddam.bigdata.platform.CarData_3000.Join3000;import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;public class Join3Reducer extends Reducer<Text, MapWritable, NullWritable, Text> {@Overrideprotected void reduce(Text key, Iterable<MapWritable> values, Context context) throws IOException, InterruptedException {boolean blag=false;List list=new ArrayList();Map map=new HashMap();for (MapWritable mapWritable:values){String flag=mapWritable.get(new Text("flag")).toString();if (flag.equals("car")){Map car=new HashMap();car.put("month",mapWritable.get(new Text("month")).toString());car.put("manufacturer",mapWritable.get(new Text("manufacturer")).toString());car.put("vehicle_type",mapWritable.get(new Text("vehicle_type")).toString());car.put("monthly_sales_volume",mapWritable.get(new Text("monthly_sales_volume")).toString());car.put("series",mapWritable.get(new Text("series")).toString());car.put("url_car_detail",mapWritable.get(new Text("url_car_detail")).toString());list.add(car);}if (flag.equals("detail")){blag=true;map.put("vehicle_type",mapWritable.get(new Text("vehicle_type")).toString());map.put("url_href",mapWritable.get(new Text("url_href")).toString());map.put("price",mapWritable.get(new Text("price")).toString());map.put("car_type",mapWritable.get(new Text("car_type")).toString());map.put("time_to_market",mapWritable.get(new Text("time_to_market")).toString());map.put("displacement",mapWritable.get(new Text("displacement")).toString());map.put("time_to_market",mapWritable.get(new Text("time_to_market")).toString());map.put("transmission_case",mapWritable.get(new Text("transmission_case")).toString());map.put("oil_consumption_average",mapWritable.get(new Text("oil_consumption_average")).toString());}}try {if (blag){String price=String.valueOf(map.get("price")).replaceAll(" ","");String transmission_case=String.valueOf(map.get("transmission_case"));if ("手动、自动".equals(transmission_case)){transmission_case="全动";}String outputmap=price+","+map.get("car_type")+","+map.get("displacement")+","+transmission_case+","+map.get("oil_consumption_average");for (Object obj:list){Map mapobj=(Map)obj;String output=mapobj.get("month")+","+mapobj.get("manufacturer")+","+mapobj.get("vehicle_type")+","+mapobj.get("monthly_sales_volume")+","+mapobj.get("series")+","+mapobj.get("url_car_detail")+","+outputmap;context.write(null,new Text(output));}}}catch (Exception e){}}}

3.Driver类

package com.saddam.bigdata.platform.CarData_3000.Join3000;import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;public class Join3Driver {public static void main(String[] args) throws Exception {Configuration conf = new Configuration();Job job = Job.getInstance(conf, "carjoindetail");job.setJarByClass(Join3Driver.class);job.setMapperClass(Join3Mapper.class);job.setReducerClass(Join3Reducer.class);job.setMapOutputKeyClass(Text.class);job.setMapOutputValueClass(MapWritable.class);job.setOutputKeyClass(NullWritable.class);job.setOutputValueClass(Text.class);//根据题目要求编写代码String inputPath1 ="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\output\\Car_Data\\output_car_clean\\part-r-00000";String inputPath2 ="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\input\\ecar168_car_detail.txt";String outputPath ="D:\\Maven_java content root\\Maven_web\\hadoop-train\\mapreduce_data\\output\\Car_Data\\output_car3Join";//同时加载2个数据源FileInputFormat.setInputPaths(job,new Path(inputPath1),new Path(inputPath2));FileOutputFormat.setOutputPath(job,new Path(outputPath));boolean b = job.waitForCompletion(true);if (!b) {System.out.println("wordcount task fail!");}}
}

数据筛选结果

2007-08,哈飞汽车,赛豹V,287,全部,https://www.16888.com/125890/
2007-08,天津一汽,威姿,145,全部,https://www.16888.com/57968/
2007-09,天津一汽,威姿,287,全部,https://www.16888.com/57968/
2007-09,哈飞汽车,赛豹V,330,全部,https://www.16888.com/125890/
2007-10,哈飞汽车,赛豹V,576,全部,https://www.16888.com/125890/
2007-10,广汽三菱,欧蓝德,2,全部,https://www.16888.com/127531/
2007-10,天津一汽,威姿,203,全部,https://www.16888.com/57968/
2007-11,哈飞汽车,赛豹V,439,全部,https://www.16888.com/125890/
2007-11,广汽三菱,欧蓝德,87,全部,https://www.16888.com/127531/
2007-11,天津一汽,威姿,206,全部,https://www.16888.com/57968/
2007-12,广汽三菱,欧蓝德,7,全部,https://www.16888.com/127531/
2007-12,华晨中华,中华酷宝,182,全部,https://www.16888.com/58080/
2007-12,天津一汽,威姿,80,全部,https://www.16888.com/57968/
2007-12,哈飞汽车,赛豹V,387,全部,https://www.16888.com/125890/
2008-01,华晨中华,中华酷宝,487,全部,https://www.16888.com/58080/
2008-01,天津一汽,威姿,80,全部,https://www.16888.com/57968/
2008-01,哈飞汽车,赛豹V,540,全部,https://www.16888.com/125890/
2008-02,华晨中华,中华酷宝,132,全部,https://www.16888.com/58080/
2008-02,天津一汽,威姿,363,全部,https://www.16888.com/57968/
2008-02,哈飞汽车,赛豹V,465,全部,https://www.16888.com/125890/

数据整合结果

2020-10,长安标致雪铁龙,DS 4S,0,全部,http://data.ecar168.cn/car/1498/,17.19-22.99万,紧凑型,1.6L,自动,6.3
2020-10,长安标致雪铁龙,DS 6,0,全部,http://data.ecar168.cn/car/1298/,20.69-27.29万,SUV,1.6L,自动,6.7
2020-10,长安标致雪铁龙,DS 7,5,全部,http://data.ecar168.cn/car/1864/,20.89-31.99万,SUV,1.6L,自动,6.2
2020-10,广汽菲克,Jeep大指挥官PHEV,30,美系,http://data.ecar168.cn/car/2222/,30.98-33.68万,SUV,2.0L,自动,1.6
2020-10,广汽菲克,Jeep大指挥官PHEV,30,全部,http://data.ecar168.cn/car/2222/,30.98-33.68万,SUV,2.0L,自动,1.6
2020-10,广汽菲克,Jeep指南者,2092,美系,http://data.ecar168.cn/car/1576/,15.58-22.98万,SUV,1.3L,自动,6.8
2020-04,广汽菲克,Jeep指南者,2020,美系,http://data.ecar168.cn/car/1576/,15.58-22.98万,SUV,1.3L,自动,6.8
2020-10,广汽菲克,Jeep指南者,2092,全部,http://data.ecar168.cn/car/1576/,15.58-22.98万,SUV,1.3L,自动,6.8
2020-04,广汽菲克,Jeep指南者,2020,全部,http://data.ecar168.cn/car/1576/,15.58-22.98万,SUV,1.3L,自动,6.8
2020-04,广汽菲克,Jeep自由光,510,美系,http://data.ecar168.cn/car/1451/,17.98-31.98万,SUV,2.0L,自动,8.5
2020-10,广汽菲克,Jeep自由光,1259,美系,http://data.ecar168.cn/car/1451/,17.98-31.98万,SUV,2.0L,自动,8.5
2020-10,广汽菲克,Jeep自由光,1259,全部,http://data.ecar168.cn/car/1451/,17.98-31.98万,SUV,2.0L,自动,8.5

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

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

相关文章

BC134 蛇形矩阵

一&#xff1a;题目 二&#xff1a;思路分析 2.1 蛇形矩阵含义 首先&#xff0c;这道题我们要根据这个示例&#xff0c;找到蛇形矩阵是怎么移动的 这是&#xff0c;我们可以标记一下每次移动到方向 我们根据上图可以看出&#xff0c;蛇形矩阵一共有两种方向&#xff0c;橙色…

【Pytorch】新手入门:基于sklearn实现鸢尾花数据集的加载

【Pytorch】新手入门&#xff1a;基于sklearn实现鸢尾花数据集的加载 &#x1f308; 个人主页&#xff1a;高斯小哥 &#x1f525; 高质量专栏&#xff1a;Matplotlib之旅&#xff1a;零基础精通数据可视化、Python基础【高质量合集】、PyTorch零基础入门教程&#x1f448; 希望…

数据挖掘助力零售业务增长:从数据分析到策略制定的全过程

在数字化时代,数据挖掘已经成为企业获取竞争优势的关键手段之一。通过深入挖掘和分析海量数据,企业能够洞察消费者行为、市场趋势和潜在商机,从而制定更为精准和有效的业务策略。本文将通过一个具体的零售业务案例,分析数据挖掘的应用过程,展示如何从数据中发现价值,并将…

Hadoop运行搭建——系统配置和Hadoop的安装

Hadoop运行搭建 前言&#xff1a; 本文原文发在我自己的博客小站&#xff0c;直接复制文本过来&#xff0c;所以图片不显示(我还是太懒啦&#xff01;)想看带图版的请移步我的博客小站~ Linux镜像&#xff1a;CentOS7 系统安装&#xff1a;CentOS安装参考教程 系统网卡设置…

C语言——函数指针——函数指针变量详解

函数指针变量 函数指针变量的作用 函数指针变量是指向函数的指针&#xff0c;它可以用来存储函数的地址&#xff0c;并且可以通过该指针调用相应的函数。函数指针变量的作用主要有以下几个方面&#xff1a; 回调函数&#xff1a;函数指针变量可以作为参数传递给其他函数&…

三菱PLC基础指令

LD指令(a触点的逻辑运算开 指令表程序 0000 LD X000 0001 OUT Y000 LDI指令(b触点的逻辑运算开 指令表程序 0000 LDI X000 0001 OUT Y000 3.数据寄存器(D)的位指定*1(仅对应FX3u&#xff0c;FX3uc可编程控制器) 指令表程序 0000 LD D0.3 0001 OUT Y000 4.定时器 0000 LDI X00…

Objects类 --java学习笔记

Objects类 Objects是一个工具类&#xff0c;提供了很多操作对象的静态方法给我们使用 Objects类常用的三个方法 Objects.equals 比直接equals更安全&#xff0c;因为Objects.equals里面做了非空校验 Objects.isNull&#xff08;A&#xff09; 等价于 A null Objects.non…

Redisson学习

简介 Redisson 是一个在 Redis 的基础上实现的 Java 驻留内存数据网格&#xff08;In-Memory Data Grid&#xff09;。它提供了许多分布式 Java 对象和服务&#xff0c;包括分布式锁、分布式集合、分布式执行服务、分布式调度任务等。 使用 依赖 相关依赖&#xff0c;注意版…

【兔子机器人】修改GO电机id(软件方法、硬件方法)

一、硬件方法 利用上位机直接修改GO电机的id号&#xff1a; 打开调试助手&#xff0c;点击“调试”&#xff0c;查询电机&#xff0c;修改id号&#xff0c;即可。 但先将四个GO电机连接线拔掉&#xff0c;不然会将连接的电机一并修改。 利用24V电源给GO电机供电。 二、软件方…

回溯算法12-全排列II(Java/排列数去重操作)

12.全排列II 题目描述 给定一个可包含重复数字的序列 nums &#xff0c;按任意顺序 返回所有不重复的全排列。 示例 1&#xff1a; 输入&#xff1a;nums [1,1,2] 输出&#xff1a; [[1,1,2],[1,2,1],[2,1,1]]示例 2&#xff1a; 输入&#xff1a;nums [1,2,3] 输出&…

Spring Boot整合zxing实现二维码登录

zxing是google的一个二维码生成库&#xff0c;使用时需配置依赖&#xff1a; implementation("com.google.zxing:core:3.4.1") implementation("com.google.zxing:javase:3.4.1") zxing的基本使用 我们可以通过MultiFormatWriter().encode()方法获取一个…

AI预测福彩3D第3弹【2024年3月6日预测】

书接上回&#xff0c;经过连续两期使用人工神经网络对福彩3D进行预测&#xff0c;经过不断的调参优化&#xff0c;并及时总结规律&#xff0c;感觉还是有一定的信心提高七码的命中概率。 今天&#xff0c;咱们继续来验证&#xff0c;直接上今天的统计结果&#xff0c;首先&…

手写分布式配置中心(五)整合springboot(不自动刷新的)

springboot中使用配置方式有四种&#xff0c;分别是environment、BeanDefinition、Value、ConfigurationProperties。具体的原理可以看我之前的一篇文章https://blog.csdn.net/cjc000/article/details/132800290。代码在https://gitee.com/summer-cat001/config-center 原理 …

斐波那契算法

斐波那契数列 斐波那契数列&#xff08;Fibonacci sequence&#xff09;是一个非常著名的数学序列&#xff0c;它是由意大利数学家莱昂纳多斐波那契&#xff08;Leonardo Fibonacci&#xff09;在1202年的著作《计算之书》&#xff08;Liber Abaci&#xff09;中首次引入的。这…

SAP 凭证分割功能 - 概述系统配置 - Chapter01/02

目录 1. 概述 2. 系统配置 2.1.为文档拆分给总分类账科目分类 2.2.对凭证拆分的凭证类型进行分类 2.3.定义总账会计核算的凭证分解特征 2.4.定义零余额结算科目 配置步骤: 路径:IMG->财务会计->总帐会计->业务交易->凭证拆分->定义零余额结算科 2.5.定义…

移动端uni-app小程序搜索高亮前端处理,同时可设置相关样式,兼顾性能

在uni-app中我们会遇到搜索高亮显示的需求 如下图&#xff1a; 起初用的是富文本实现 使用replaceAll方法取代搜索字段为一个 标签并设置相应的样式&#xff0c;但是小程序的并没有把 标签渲染出来&#xff0c;所以放弃了&#xff0c;下面原代码&#xff1a; /* 搜索字体变色…

C++进阶:详细讲解继承

现在也是结束了初阶部分的内容&#xff0c;今天开始就进入进阶部分了。一刻也没有为初阶的结束而哀悼&#xff0c;立刻赶来“战场”的是进阶部分里的继承 文章目录 1.继承的概念和定义1.1继承的概念1.2继承的定义1.2.1继承的格式1.2.2再讲访问限定符(详讲protected)1.2.3**继承…

【被c++11弃用的智能指针auto_ptr】

C11标准之前的auto_ptr这个智能指针不被广泛使用的原因就是&#xff1a;在某些应用场景下&#xff0c;拷贝构造函数的意义不明确&#xff0c;同理赋值语句也是这个道理&#xff0c;意义同样不明确&#xff0c;因为C11标准之前并不存在移动赋值和移动构造的概念&#xff0c;还有…

NFT交易市场开发(一)

实现的基本功能 &#xff08;一&#xff09; 发行一个符合ERC20标准的测试Token&#xff0c;要求如下&#xff1a; 总量&#xff1a;&#xff1a;1亿精度&#xff1a;18名称&#xff1a;Fake USDT in CBI简称&#xff1a;cUSDT &#xff08;二&#xff09; 发行一个符合ERC72…

学习方法 学习态度

学习方法 弄清它的历史、局限性和本质 常用的:刻意练习、熟能生巧 不常用的:知道在哪里找就行 事有先后&#xff0c;物有次序&#xff0c;盖房屋必须从平地建起 学习态度 每天比前一天的自己进步一点点