”2021年安徽省大数据与人工智能应用竞赛“ 大数据网络赛-本科组赛题 第二部分:大数据预处理部分 赛题回顾

在这里插入图片描述

本科组赛题 第二部分:大数据预处理部分

赛题数据

注意: 文本的编码为 UTF-8

数据1:数据calls.txt 通话记录

7,18000696806,赵贺彪
8,15151889601,张倩
9,13269361119,王世昌
10,15032293356,张涛
11,17731088562,张阳
12,15338595369,李进全
13,15733218050,杜泽文
14,15614201525,任宗阳
15,15778423030,梁鹏
16,18641241020,郭美彤
17,15732648446,刘飞飞
18,13341109505,段光星
19,13560190665,唐会华
20,18301589432,杨力谋
21,13520404983,温海英
22,18332562075,朱尚宽
23,18620192711,刘能宗
24,13566666666,刘柳
25,13666666666,邓二
26,13799999999,菜中路


数据样例解释说明:
数据calls.txt 通话记录 
样例:18620192711,15733218050,1506628174,1506628265,650000,810000
字段分别为:
呼叫者手机号,接受者手机号,开始时间戳,接受时间戳,呼叫者地址省份编码,接受者地址省份编码

数据2:数据location.txt 地区编码对应表

1,110000,北京市
2,120000,天津市
3,130000,河北省
4,140000,山西省
5,150000,内蒙古自治区
6,210000,辽宁省
7,220000,吉林省
8,230000,黑龙江省
9,310000,上海市
10,320000,江苏省
11,330000,浙江省
12,340000,安徽省
13,350000,福建省
14,360000,江西省
15,370000,山东省
16,410000,河南省
17,420000,湖北省
18,430000,湖南省
19,440000,广东省
20,450000,广西壮族自治区
21,460000,海南省
22,500000,重庆市
23,510000,四川省
24,520000,贵州省
25,530000,云南省
26,540000,西藏自治区
27,610000,陕西省
28,620000,甘肃省
29,630000,青海省
30,640000,宁夏回族自治区
31,650000,新疆维吾尔自治区
32,710000,台湾省
33,810000,香港特别行政区
34,820000,澳门特别行政区


数据样例解释说明:
数据location.txt 地区编码对应表
样例:1,110000,北京市
字段分别为: 
地址id,省份编码,省份名称

数据3:数据userPhone.txt 是手机号与姓名对应表

18620192711,15733218050,1506628174,1506628265,650000,810000
18641241020,15733218050,1509757276,1509757464,330000,620000
15778423030,15614201525,1495290451,1495290923,370000,420000
13341109505,15151889601,1492661762,1492662200,330000,460000
13341109505,13666666666,1470111026,1470111396,360000,230000
15032293356,13799999999,1495937181,1495937360,500000,630000
15733218050,13341109505,1452601976,1452602401,620000,530000
13269361119,13269361119,1487640690,1487641023,450000,430000
13799999999,15338595369,1511928814,1511929111,540000,230000
15733218050,15778423030,1542457633,1542457678,450000,530000
13341109505,17731088562,1484364844,1484365342,460000,360000
18332562075,15778423030,1522426275,1522426473,140000,120000
13560190665,18301589432,1485648596,1485648859,620000,820000
15733218050,13520404983,1538992531,1538992605,130000,150000
15778423030,13566666666,1484008721,1484009210,810000,330000
13566666666,17731088562,1541812913,1541813214,220000,360000
15778423030,15733218050,1464198621,1464198803,630000,340000
15151889601,13341109505,1467441052,1467441538,640000,440000
18620192711,13666666666,1510997876,1510998253,450000,610000
13341109505,18641241020,1509074946,1509075201,710000,310000
17731088562,13341109505,1471571270,1471571706,430000,630000
13520404983,13560190665,1476626194,1476626683,500000,440000
15338595369,13341109505,1523996031,1523996059,420000,460000
15151889601,13341109505,1489658199,1489658394,330000,500000
13560190665,15338595369,1510890681,1510891129,410000,520000
15733218050,13566666666,1503498540,1503498726,420000,310000
17731088562,13560190665,1470571255,1470571708,540000,330000
15338595369,15614201525,1496767879,1496768364,520000,500000
17731088562,15778423030,1494602567,1494602784,500000,420000
15778423030,18641241020,1517445007,1517445358,450000,530000
13566666666,17731088562,1464697765,1464697894,360000,620000
15778423030,13799999999,1525543218,1525543493,500000,820000
13341109505,13520404983,1521861238,1521861421,500000,130000
13566666666,13560190665,1513918160,1513918538,340000,210000
15032293356,18620192711,1485688388,1485688537,540000,530000
13799999999,13341109505,1531196363,1531196438,230000,320000
15338595369,15151889601,1512125514,1512125978,540000,810000
18332562075,13560190665,1523311951,1523312239,650000,410000
15778423030,15032293356,1467953782,1467954054,810000,540000
15151889601,15733218050,1530848147,1530848231,310000,150000
13269361119,18301589432,1541271874,1541272273,310000,310000
15032293356,15338595369,1520833915,1520834201,450000,360000
15778423030,13269361119,1452817391,1452817596,820000,410000
13520404983,18332562075,1474563316,1474563593,710000,540000
18301589432,15778423030,1473596284,1473596528,620000,310000
15732648446,15151889601,1535584645,1535585117,530000,310000
18301589432,13269361119,1511910316,1511910341,340000,320000
13560190665,18641241020,1533379659,1533379717,120000,710000
15338595369,18332562075,1474152847,1474153092,330000,500000
13520404983,17731088562,1504907456,1504907617,820000,510000
15732648446,18301589432,1521692836,1521692977,220000,370000
15032293356,15614201525,1471445293,1471445756,360000,530000
18641241020,15778423030,1517192728,1517193050,210000,610000
17731088562,15733218050,1493420249,1493420555,370000,820000
18620192711,13799999999,1477952709,1477953088,310000,140000
13666666666,13799999999,1541066076,1541066541,230000,640000
13269361119,17731088562,1540060141,1540060511,150000,540000
18332562075,13799999999,1489772390,1489772817,540000,710000
13799999999,15732648446,1503882021,1503882332,530000,520000
13566666666,15614201525,1504983084,1504983241,820000,140000
18641241020,15032293356,1463447030,1463447080,330000,640000
18301589432,13566666666,1493646451,1493646796,310000,510000
15732648446,15032293356,1537185125,1537185619,430000,810000
15338595369,13341109505,1493411872,1493411891,370000,150000
15778423030,17731088562,1540631847,1540632271,320000,500000
13666666666,15614201525,1545200734,1545200959,360000,640000
15032293356,13799999999,1455000970,1455001084,460000,650000
18641241020,18620192711,1529968498,1529968626,410000,510000
17731088562,15732648446,1455361378,1455361505,440000,650000
18301589432,13666666666,1518564232,1518564421,210000,640000
15733218050,18620192711,1515672794,1515673149,360000,360000
13520404983,18620192711,1521620546,1521620913,820000,370000
18332562075,18641241020,1498131159,1498131300,820000,230000
13666666666,18301589432,1491354142,1491354544,220000,710000
18301589432,15614201525,1511731560,1511732015,810000,620000
13269361119,13666666666,1539065031,1539065096,810000,810000
15778423030,18641241020,1518364528,1518364995,130000,610000
15733218050,15032293356,1491974898,1491975316,340000,810000
13269361119,15733218050,1543514850,1543514946,410000,460000
13341109505,13666666666,1482223100,1482223577,220000,410000
15338595369,13341109505,1495958992,1495959292,330000,420000
13341109505,18641241020,1511010003,1511010292,540000,620000
18620192711,13269361119,1462453298,1462453559,320000,360000
13666666666,13799999999,1518047527,1518047967,640000,420000
13341109505,13666666666,1474872886,1474872907,360000,510000
13666666666,18641241020,1473575493,1473575663,150000,520000
15151889601,15732648446,1509418483,1509418891,510000,540000
13560190665,13520404983,1467696946,1467697103,150000,460000
13520404983,15614201525,1510958686,1510959064,320000,610000
15778423030,15614201525,1470012457,1470012660,210000,210000
15778423030,17731088562,1542680029,1542680382,630000,520000
18332562075,15338595369,1453896030,1453896522,640000,370000
15032293356,18620192711,1488286898,1488287248,530000,150000
18641241020,15733218050,1489804133,1489804185,150000,630000
15733218050,13666666666,1506782751,1506782854,220000,500000
13520404983,17731088562,1487421622,1487421784,230000,330000
15151889601,13269361119,1538113862,1538113902,370000,630000
15778423030,17731088562,1466691118,1466691412,540000,530000
15032293356,13520404983,1521151509,1521151701,520000,430000
15614201525,13666666666,1464083166,1464083352,330000,650000


数据样例解释说明:
数据userPhone.txt 是手机号与姓名对应表
样例:26,13799999999,菜中路
字段分别为:
电话ID,电话号码,姓名

1、电信通话数据处理,与分析(10分)

请根据要求把 通话记录表 转换为 新的格式数据。
要求把 通话记录表 呼叫者手机号,接受者手机号 替换为 姓名,
开始时间与结束时间 转换成时间格式为 yyyy-MM-dd HH:mm:ss,例如2017-03-29 10:58:12;
计算通话时间,并以秒做单位 计算为通话时间=结束时间-开始时间
将呼叫者地址省份编码,接受者地址省份编码 替换成省份名称

1.将电话号码替换成人名
2.将拨打、接听电话的时间戳转换成日期
3.求出电话的通话时间,以秒做单位
4.将省份编码替换成省份名称
5.最后数据的样例:

邓二,张倩,2018-03-29 10:58:12,2018-03-29 10:58:42,30秒,黑龙江省,上海市

运行过程截图:

在这里插入图片描述

运行结果目录截图:

在这里插入图片描述

结果文件内容截图:

在这里插入图片描述

代码截图(要能体现出 上面的 1,2,3,4 点需求要求的代码):

package com.BMC.MapReduce.ahjs.ShengSaiChuSai;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Hashtable;

public class Test01 {

    //通话记录数据样例:18620192711,15733218050,1506628174,1506628265,650000,810000
    //map job
    public static class MyMapper extends Mapper<LongWritable, Text,Text, NullWritable>{

        //存储 呼叫者地址省份编码   地址省份名
        Hashtable<String ,String> location=null;

        //存储 呼叫者手机号   姓名
        Hashtable<String ,String> userPhone=null;

        @Override
        protected void setup(Mapper<LongWritable, Text, Text, NullWritable>.Context context) throws IOException, InterruptedException {
            //获取文件系统
            FileSystem fs = FileSystem.get(context.getConfiguration());

            /**
             * 处理location.txt 将地址编码 地址名 存在Hashtable
             */
            FSDataInputStream fsDataInputStream = fs.open(new Path("/MRinput/input04_ahjs_file/location.txt"));
            BufferedReader br = new BufferedReader(new InputStreamReader(fsDataInputStream));
            location= new Hashtable<>();
            String line=null;
            while ((line= br.readLine())!=null){
                String[] split = line.split(",");
                String id = split[1];
                String name = split[2];
                location.put(id,name);
            }

            /**
             * 处理userPhone.txt文件读取并构建成hashtable
             */
            FSDataInputStream fsDataInputStream1 = fs.open(new Path("/MRinput/input04_ahjs_file/userPhone.txt"));
            BufferedReader br1 = new BufferedReader(new InputStreamReader(fsDataInputStream1));
            userPhone = new Hashtable<>();
            while ((line=br1.readLine())!=null){
                String phone = line.split(",")[1];
                String name = line.split(",")[2];
                userPhone.put(phone,name);
            }
        }

        @Override
        protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, NullWritable>.Context context) throws IOException, InterruptedException {

            /**
             * 1.将电话号码替换成人名
             * 2.将拨打、接听电话的时间戳转换成日期
             * 3.求出电话的通话时间,以秒做单位
             * 4.将省份编码替换成省份名称
             * 5.最后数据的样例:
             * 邓二,张倩,,2018-03-29 10:58:12,2018-03-29 10:58:42,30秒,黑龙江省,上海市
             * 通话记录数据:
             *      初始样例:
             *      18620192711,15733218050,1506628174,1506628265,650000,810000
             *字段分别为:
             * 呼叫者手机号,接受者手机号,开始时间戳,结束时间戳,呼叫者地址省份编码,接受者地址省份编码
             */
            //切分数据
            String[] splits = value.toString().split(",");
            //呼叫者手机号
            String caller = splits[0];
            //接受者手机号
            String receiver = splits[1];
            //开始时间戳
            String startTime = splits[2];
            //结束时间戳
            String endTime = splits[3];
            //呼叫者地址省份编码
            String callerPID = splits[4];
            //接受者地址省份编码
            String receiverPID = splits[5];

            //1.将电话号码替换成人名
            String callerName = userPhone.getOrDefault(caller, "姓名为空");
            String receiverName = userPhone.getOrDefault(receiver, "姓名为空");

            //2.将拨打、接听电话的时间戳转换成日期
            //创建 时间格式化 格式yyyy-MM-dd HH:mm:ss
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            //格式化时间
            String startTimeFormat = simpleDateFormat.format(new Date(Long.parseLong(startTime)));
            String endTimeFormat = simpleDateFormat.format(new Date(Long.parseLong(endTime)));

            //3.求出电话的通话时间,以秒做单位
            Long time = Long.parseLong(endTime) - Long.parseLong(startTime);

            //4.将省份编码替换成省份名称
            String callerPName = location.getOrDefault(callerPID, "地址为空");
            String receiverPName = location.getOrDefault(receiverPID, "地址为空");


            //输出map job 处理结果
            context.write(
                    new Text(callerName+","
                            +receiverName+","
                            +startTimeFormat+","
                            +endTimeFormat+","
                            +time+"秒"+","
                            +callerPName+","
                            +receiverPName+","),NullWritable.get());

        }
    }



    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = new Configuration();

        Job job = Job.getInstance(conf);
        job.setJobName("Test01");

        job.setJarByClass(Test01.class);

        job.setMapperClass(MyMapper.class);
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(NullWritable.class);

        FileInputFormat.addInputPath(job,new Path("/MRinput/input04_ahjs_file/input_calls"));

        //判断文件路径是否已存在
        FileSystem fileSystem = FileSystem.get(job.getConfiguration());
        if (fileSystem.exists(new Path("/MRoutput/output_anjs_test01"))){
            fileSystem.delete(new Path("/MRoutput/output_anjs_test01"));
        }

        FileOutputFormat.setOutputPath(job,new Path("/MRoutput/output_anjs_test01"));

        job.waitForCompletion(true);

    }
}

2、请使用MapReduce统计 calls.txt中的每个手机号码的,呼叫时长和呼叫次数,被叫时长,被叫次数 ,并输出格式 为 手机号码,呼叫时长,呼叫次数,被叫时长,被叫次数;(12分)

数据格式样例:其中在呼叫时长后面加单位 秒 ;呼叫次数后面加 单位 次;被叫时长后面加单位 秒 ;被叫次数后面加 单位 次
13269361119,65秒,5次,864秒,5次

结果截图:

运行过程截图:

在这里插入图片描述

运行结果目录截图:

在这里插入图片描述

结果文件内容截图:

在这里插入图片描述


任务代码:

package com.BMC.MapReduce.ahjs.ShengSaiChuSai;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class Test02 {

    /**
     * 通话记录数据样例:18620192711,15733218050,1506628174,1506628265,650000,810000
     * 统计calls.txt 中的每个手机号码的,呼叫时长和呼叫次数,被叫时长,被叫次数 ,
     * 并输出格式手机号码,呼叫时长,呼叫次数,被叫时长,被叫次数
     */
    //Map Job
    public static  class  MyMapper extends Mapper<LongWritable, Text,Text,Text>{
        @Override
        protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context) throws IOException, InterruptedException {
            String[] split = value.toString().split(",");
            String caller = split[0];
            String receiver = split[1];
            String startTime = split[2];
            String endTime = split[3];

            //计算呼叫时长
            long time =  Long.parseLong(endTime)-Long.parseLong(startTime) ;

            //输出map数据 key:(手机号码,呼叫时长)  value:呼叫号码标签call
            context.write(new Text(caller),new Text(time+","+"call"));
            //key:(手机号码,被叫时长) value:被叫号码标签receiver
            context.write(new Text(receiver),new Text(time+","+"receiver"));

        }
    }

    //Reduce Job
    public static class MyReducer extends Reducer<Text,Text,Text,Text>{
        @Override
        protected void reduce(Text key, Iterable<Text> values, Reducer<Text, Text, Text, Text>.Context context) throws IOException, InterruptedException {
           //统计 呼叫时长,呼叫次数,被叫时长,被叫次数
            int callTime=0;
            int callCount=0;
            int receiverTime=0;
            int receiverCount=0;
            for (Text value : values) {
                String[] split = value.toString().split(",");
                if ("call".equals(split[1])){
                    //统计呼叫号码 时长和 次数
                    callTime= Integer.parseInt(split[0]);
                    callCount++;
                }else if ("receiver".equals(split[1])){
                    //统计被叫号码 时长和 次数
                    receiverTime= Integer.parseInt(split[0]);
                    receiverCount++;
                }
            }
            context.write(key,new Text(
                    callTime+","+callCount+","+receiverTime+","+receiverCount
            ));
        }

    }
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = new Configuration();
        //配置kv链接符 ”,“
        conf.set("mapred.textoutputformat.separator",",");

        Job job = Job.getInstance(conf);

        job.setJobName("Test02");
        job.setJarByClass(Test02.class);

        job.setMapperClass(MyMapper.class);
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Text.class);

        job.setReducerClass(MyReducer.class);
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

        FileInputFormat.addInputPath(job,new Path("/MRinput/input04_ahjs_file/input_calls"));
        //判断文件路径是否已存在
        FileSystem fileSystem = FileSystem.get(job.getConfiguration());
        if (fileSystem.exists(new Path("/MRoutput/output_anjs_test02"))){
            fileSystem.delete(new Path("/MRoutput/output_anjs_test02"));
        }
        FileOutputFormat.setOutputPath(job,new Path("/MRoutput/output_anjs_test02"));

        job.waitForCompletion(true);
    }

}

3、请使用MapReduce统计 calls.txt中的 被叫省份中 被叫次数最高的前三条记录(8分)。返回格式:省 ,被叫号码,被叫次数

结果截图:
运行过程截图:

在这里插入图片描述

运行结果目录截图:

在这里插入图片描述

结果文件内容截图:

在这里插入图片描述

详细代码:

package com.BMC.MapReduce.ahjs.ShengSaiChuSai;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;
import java.util.*;


public class Test03 {
    /**
     * 统计 calls.txt中的 被叫省份中 被叫次数最高的前三条记录
     * 返回格式:省 ,被叫号码,被叫次数
     * 通话记录数据样例:18620192711,15733218050,1506628174,1506628265,650000,810000
     */
    public static class MyMapper extends Mapper<LongWritable, Text,Text,Text>{
        @Override
        protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context) throws IOException, InterruptedException {

            String[] split = value.toString().split(",");

            String receiver = split[1];
            String receiverPID = split[5];

           // context.write(new Text(receiverPID),new Text(receiver+","+1));
            context.write(new Text(receiverPID), new Text(receiver));
        }
    }



    public static class MyReducer extends Reducer<Text,Text,Text,IntWritable>{
        @Override
        protected void reduce(Text key, Iterable<Text> values, Reducer<Text, Text, Text, IntWritable>.Context context) throws IOException, InterruptedException {

            String provinceId = key.toString();

            //排序,统计被叫次数前三的
            //定义一个Hashtable,接收 receiver  sum
            Hashtable<String, Integer> ht = new Hashtable<String, Integer>();

            // 遍历values 构造Hashtable
            for (Text value : values) {
                String receiver = value.toString();
                Integer receiverCount= ht.getOrDefault(receiver, 0);
                receiverCount++;
                ht.put(receiver, receiverCount);
            }

            //排序,取前三
            ArrayList<Map.Entry<String, Integer>> list = new ArrayList<>(ht.entrySet());

            //构造,排序
            Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
                //重新构造,排序规则
                @Override
                public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                    return o2.getValue().compareTo(o1.getValue());
                }
            });

            //取前三
            int cnt = 1;
            for (Map.Entry<String, Integer> mapping : list) {
                if (count <= 3) {
                    String receiver = mapping.getKey();
                    Integer receiverCount= mapping.getValue();
                    context.write(new Text(provinceId + "," + receiver), new IntWritable(receiverCount));
                }
                count ++;
            }

        }
    }

    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
        Configuration conf = new Configuration();
        conf.set("mapred.textoutputformat.separator",",");

        Job job = Job.getInstance(conf);
        job.setJobName("Test03");
        job.setJarByClass(Test03.class);

        job.setMapperClass(MyMapper.class);
        job.setMapOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);


        job.setReducerClass(MyReducer.class);
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

		//指定输入输出路径
        FileInputFormat.addInputPath(job,new Path("/MRinput/input04_ahjs_file/input_calls"));

        FileSystem fs = FileSystem.get(job.getConfiguration());
        if (fs.exists(new Path("/MRoutput/output_anjs_test03"))){
            fs.delete(new Path("/MRoutput/output_anjs_test03"),true);
        }
        FileOutputFormat.setOutputPath(job,new Path("/MRoutput/output_anjs_test03"));

        job.waitForCompletion(true);

    }
}


原文地址:https://blog.csdn.net/dazuo_001/article/details/120487113

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


可以认为OpenFeign是Feign的增强版,不同的是OpenFeign支持Spring MVC注解。OpenFeign和Feign底层都内置了Ribbon负载均衡组件,在导入OpenFeign依赖后无需专门导入Ribbon依赖,用做客户端负载均衡,去调用注册中心服务。
为进一步规范小程序交易生态、提升用户购物体验、满足用户在有交易的小程序中便捷查看订单信息的诉求,自2022年12月31日起,对于有“选择商品/服务-下单-支付”功能的小程序,需按照平台制定的规范,在小程序内设置订单中心页。开发者可通过小程序代码提审环节,或通过「设置-基础设置-小程序订单中心path设置」模块设置订单中心页path。1、 新注册或有版本迭代需求的小程序,可在提审时通过参数配置该商家小程序的订单中心页path。2、无版本迭代需求的小程序,可在小程序订单中心path设置入口进行设置。
云原生之使用Docker部署Dashdot服务器仪表盘
本文主要描述TensorFlow之回归模型的基本原理
1.漏洞描述Apache Druid 是一个集时间序列数据库、数据仓库和全文检索系统特点于一体的分析性数据平台。Apache Druid对用户指定的HTTP InputSource没有做限制,并且Apache Druid默认管理页面是不需要认证即可访问的,可以通过将文件URL传递给HTTP InputSource来绕过。因此未经授权的远程攻击者可以通过构造恶意参数读取服务器上的任意文件,造成服务器敏感性信息泄露。2.影响版本Apache Druid &lt;= 0.21.13...
内部类(当作类中的一个普通成员变量,只不过此成员变量是class的类型):一个Java文件中可以包含多个class,但是只能有一个public class 如果一个类定义在另一个类的内部,此时可以称之为内部类使用:创建内部类的时候,跟之前的方法不一样,需要在内部类的前面添加外部类来进行修饰 OuterClass.InnerClass innerclass = new OuterClass().new InnerClass();特点:1.内部类可以方便的访问外部类的私有属性...
本文通过解读国密的相关内容与标准,呈现了当下国内技术环境中对于国密功能支持的现状。并从 API 网关 Apache APISIX 的角度,带来有关国密的探索与功能呈现。作者:罗泽轩,Apache APISIX PMC什么是国密顾名思义,国密就是国产化的密码算法。在我们日常开发过程中会接触到各种各样的密码算法,如 RSA、SHA256 等等。为了达到更高的安全等级,许多大公司和国家会制定自己的密码算法。国密就是这样一组由中国国家密码管理局制定的密码算法。在国际形势越发复杂多变的今天,密码算法的国产化
CENTOS环境Apache最新版本httpd-2.4.54编译安装
Apache HTTPD是一款HTTP服务器,它可以通过mod_php来运行PHP网页。影响版本:Apache 2.4.0~2.4.29 存在一个解析漏洞;在解析PHP时,将被按照PHP后缀进行解析,导致绕过一些服务器的安全策略。我们查看一下配置:读取配置文件,前三行的意思是把以 结尾的文件当成 文件执行。问题就在它使用的是 符号匹配的,我们都知道这个符号在正则表达式中的意思是匹配字符串的末尾,是会匹配换行符的,那么漏洞就这样产生了。 进入容器里,打开index.php,发现如果文件后缀名为 php、
apache Hop现在好像用的人很少, 我就自己写一个问题收集的帖子吧, 后面在遇到什么问题都会在该文章上同步更新
2.启动容器ps:注意端口占用,当前部署在 8080 端口上了,确保宿主机端口未被占用,不行就换其他端口ps:用户名和密码都是 admin,一会用于登录,其他随便填5.下载一个官方提供的样例数据库【可跳过】ps:此步国内无法访问,一般下载不了,能下的就下,不能下的跳过就行了,一会配置自己的数据库7.访问登录页面ps:注意端口是上面自己配置的端口,账号密码是 admin依次点击 Settings → Database Connections点击 DATABASE 就可以配置自己的数据库了
String类的常用方法1. String类的两种实例化方式1 . 直接赋值,在堆上分配空间。String str = "hello";2 . 传统方法。通过构造方法实例化String类对象String str1 = new String("Hello");2.采用String类提供的equals方法。public boolean equals(String anotherString):成员方法 str1.equals(anotherString);eg:publi
下载下载地址http://free.safedog.cn下载的setup:安装点击下面的图标开始安装:可能会提示:尝试先打开小皮面板的Apache服务:再安装安全狗:填入服务名:如果服务名乱写的话,会提示“Apache服务名在此机器上查询不到。”我干脆关闭了这个页面,直接继续安装了。安装完成后,需要进行注册一个账户,最后看到这样的界面:查看配置:...
一、问题描述一组生产者进程和一组消费者进程共享一个初始为空、大小n的缓冲区,只有缓冲区没满时,生产者才能把资源放入缓冲区,否则必须等待;只有缓冲区不为空时,消费者才能从中取出资源,否则必须等待。由于缓冲区是临界资源,它只允许一个生产者放入资源,或一个消费者从中取出资源。二、问题分析(1)、关系分析。生产者和消费者对缓冲区互斥访问是互斥关系,同时生产者和消费者又是一个相互协作的关系,只有生产者生产之后,消费者只能才能消费,它们还是同步关系。(2)、整理思路。只有生产生产者和消费者进程,正好是这两个进程
依赖注入的英文名是Dependency Injection,简称DI。事实上这并不是什么新兴的名词,而是软件工程学当中比较古老的概念了。如果要说对于依赖注入最知名的应用,大概就是Java中的Spring框架了。Spring在刚开始其实就是一个用于处理依赖注入的框架,后来才慢慢变成了一个功能更加广泛的综合型框架。我在学生时代学习Spring时产生了和绝大多数开发者一样的疑惑,就是为什么我们要使用依赖注入呢?现在的我或许可以给出更好的答案了,一言以蔽之:解耦。耦合度过高可能会是你的项目中一个比较
<dependency><groupId>org.apache.velocity</groupId><artifactId>velocity-engine-core</artifactId><version>使用人数最多的版本</version></dependency>importorg.apache.velocity.Template;importorg.apache.velo
Java Swing皮肤包前言:一.皮肤包分享二.皮肤包的使用1.先新建一个项目。2.导入皮肤包1.先导入我们刚刚下载的jar文件,右键项目demo即可2.如果右键没有这个选项,记得调为下图模式3.点击下图蓝色圆圈处4.找到刚刚下载的jar文件,点击打开即可5.我们看一下效果,是不是比原生的好看前言:因为Java Swing自身皮肤包不是很好看,甚至有点丑,怎么让你的界面更加好看,这里就需要用到皮肤包,我发现了一个还不错的皮肤包,让你的界面美观了几个等级。废话不多说。一.皮肤包分享百度网盘分享链接:
一、前言在做Java项目开发过程中,涉及到一些数据库服务连接配置、缓存服务器连接配置等,通常情况下我们会将这些不太变动的配置信息存储在以 .properties 结尾的配置文件中。当对应的服务器地址或者账号密码信息有所变动时,我们只需要修改一下配置文件中的信息即可。同时为了让Java程序可以读取 .properties配置文件中的值,Java的JDK中提供了java.util.Properties类可以实现读取配置文件。二、Properties类Properties 类位于 java.util.Pro
Mybatis环境JDK1.8Mysql5.7maven 3.6.1IDEA回顾JDBCMysqlJava基础MavenJunitSSM框架:配置文件的最好的方式:看官网文档Mybatis1、Mybatis简介1.1 什么是Mybatis如何获得Mybatismaven仓库:中文文档:https://mybatis.org/mybatis-3/zh/index.htmlGithub:1.2 持久化数据持久化持久化就是将程序的数据在持久状态和瞬时状态转