流批一体计算引擎-9-[Flink]中的数量窗与时间窗

1 数量窗

1.1 数量滚动窗口

0基础学习PyFlink——个数滚动窗口(Tumbling Count Windows)

1.1.1 代码分析

Tumbling Count Windows是指按元素个数计数的滚动窗口。
滚动窗口是指没有元素重叠的窗口。
(1)构造了一个KeyedStream,用于存储word_count_data中的数据。

word_count_data = [("A",), ("A", ), ("B", ), ("A",)]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING()])
    # 从列表生成source,指定列表中每个元素的类型
    source = env.from_collection(word_count_data, source_type_info)

    # 按键分组
    keyed_stream = source.key_by(lambda i: i[0])

我们并没有让Source是流的形式,是因为为了降低例子复杂度。但是我们将runntime mode设置为流(STREAMING)模式。

(2)定义一个Reduce类,用于对元组中的数据进行计算。
这个类需要继承于WindowFunction,并实现相应方法(本例中是apply)。
apply会计算一个相同key的元素个数。

class SumWindowFunction(WindowFunction[tuple, tuple, str, CountWindow]):
    def apply(self, key: str, window: CountWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]

(3)keyed_stream.count_window(2)将此keyyedstream窗口转换为滚动计数窗口或滑动计数窗口。

out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (keyed_stream.count_window(2)
               .apply(SumWindowFunction(), out_type_info))

1.1.2 整体代码

from typing import Iterable
from pyflink.common import Types
from pyflink.datastream import StreamExecutionEnvironment, RuntimeExecutionMode, WindowFunction
from pyflink.datastream.window import CountWindow


class SumWindowFunction(WindowFunction[tuple, tuple, str, CountWindow]):
    def apply(self, key: str, window: CountWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]


word_count_data = [("A",), ("A", ), ("B", ), ("A",)]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING()])
    # 从列表生成source,指定列表中每个元素的类型
    source = env.from_collection(word_count_data, source_type_info)

    # 按键分组
    keyed_stream = source.key_by(lambda i: i[0])

    # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (keyed_stream.count_window(4)
               .apply(SumWindowFunction(), out_type_info))

    # # define the sink
    reduced.print()

    # submit for execution
    env.execute()


if __name__ == '__main__':
    word_count()

1.1.3 结果

(1)window=1,
A的个数是3,被3个窗口承载
B的个数是1,被1个窗口承载
在这里插入图片描述

(2)window=2
A的个数是3,但是会产生两个窗口,第一个窗口承载了前两个元素,第二个窗口当前只有一个元素。于是第一个窗口进行了Reduce计算,得出一个(A,2);第二个窗口还没进行reduce计算,就没有展现出结果;
B的个数是1,被1个窗口承载,只有一个元素,还没进行reduce计算,没有展示结果。
在这里插入图片描述
(3)window=3
A的个数是3,被1个窗口承载,有3个元素;
B的个数是1,被1个窗口承载,只有一个元素,还没进行reduce计算,没有展示结果。
在这里插入图片描述
(4)window=4
A的个数是3,被1个窗口承载,只有3个元素,还没进行reduce计算,没有展示结果。
B的个数是1,被1个窗口承载,只有1个元素,还没进行reduce计算,没有展示结果。
输出空

1.2 数量滑动窗口

0基础学习PyFlink——个数滑动窗口(Sliding Count Windows)

1.2.1 整体代码

“滑动”是指这个窗口沿着一定的方向,按着一定的速度“滑行”。
滚动窗口,则是一个个“衔接着”,而不是像上面那样交错着。
它们的相同之处就是:只有窗口内的事件数量到达窗口要求的数值时,这些窗口才会触发计算。

from typing import Iterable
from pyflink.common import Types
from pyflink.datastream import StreamExecutionEnvironment, RuntimeExecutionMode, WindowFunction
from pyflink.datastream.window import CountWindow


class SumWindowFunction(WindowFunction[tuple, tuple, str, CountWindow]):
    def apply(self, key: str, window: CountWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]


word_count_data = [("A",), ("A", ), ("B", ), ("A",)]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING()])
    # 从列表生成source,指定列表中每个元素的类型
    source = env.from_collection(word_count_data, source_type_info)

    # 按键分组
    keyed_stream = source.key_by(lambda i: i[0])

    # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (keyed_stream.count_window(2,1)
               .apply(SumWindowFunction(), out_type_info))

    # # define the sink
    reduced.print()

    # submit for execution
    env.execute()


if __name__ == '__main__':
    word_count()

1.2.2 结果

(1)window=1,slide=1
在这里插入图片描述

(2)window=2,slide=1
在这里插入图片描述
(3)window=1,slide=2
在这里插入图片描述

2 时间窗

2.1 时间滚动窗口(处理时间)

参考0基础学习PyFlink——时间滚动窗口(Tumbling Time Windows)
对于数量滚动窗口,如果窗口内元素数量没有达到窗口大小时,计算个数的函数是不会被调用的。
如果想让不满足数量的窗口,也执行计算,就可以使用时间滚动窗口。
它不依赖于窗口中元素的个数,而是窗口的时间,即窗口时间到了,计算就会进行。

2.1.1 代码分析

(1)构造了一个KeyedStream,用于存储word_count_data中的数据。

word_count_data = [("A",), ("A", ), ("B", ), ("A",), ("A", ), ("B", ), ("A",)]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING()])
    # 从列表生成source,指定列表中每个元素的类型
    source = env.from_collection(word_count_data, source_type_info)

    # 按键分组
    keyed_stream = source.key_by(lambda i: i[0])

我们并没有让Source是流的形式,是因为为了降低例子复杂度。但是我们将runntime mode设置为流(STREAMING)模式。

(2)定义一个Reduce类,用于对元组中的数据进行计算。
这个类需要继承于WindowFunction,并实现相应方法(本例中是apply)。
apply会计算一个相同key的元素个数。

class SumWindowFunction(WindowFunction[tuple, tuple, str, TimeWindow]):
    def apply(self, key: str, window: TimeWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]

(3)这儿我们的Window使用的是滚动时间窗口(处理时间),其中参数Time.milliseconds(2)是指窗口时长,即2毫秒一个窗口。

 # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (keyed_stream\
                .window(TumblingProcessingTimeWindows.of(Time.milliseconds(2)))\
               .apply(SumWindowFunction(), out_type_info))

    # define the sink
    reduced.print()

    # submit for execution
    env.execute()

2.1.2 整体代码

from typing import Iterable
from pyflink.common import Types, Time
from pyflink.datastream import StreamExecutionEnvironment, RuntimeExecutionMode, WindowFunction
from pyflink.datastream.window import TimeWindow, TumblingProcessingTimeWindows


class SumWindowFunction(WindowFunction[tuple, tuple, str, TimeWindow]):
    def apply(self, key: str, window: TimeWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]


word_count_data = [("A",), ("A", ), ("B", ), ("A",), ("A", ), ("B", ), ("A",)]

def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING()])
    # 从列表生成source,指定列表中每个元素的类型
    source = env.from_collection(word_count_data, source_type_info)

    # 按键分组
    keyed_stream = source.key_by(lambda i: i[0])


    # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (keyed_stream\
                .window(TumblingProcessingTimeWindows.of(Time.milliseconds(2)))\
               .apply(SumWindowFunction(), out_type_info))

    # define the sink
    reduced.print()

    # submit for execution
    env.execute()


if __name__ == '__main__':
    word_count()

2.1.3 结果

运行多次代码可以得到不同的结果。
可以发现结果并不稳定。但是可以发现,每个元素都参与了计算,而不像数量滚动窗口那样部分数据没有被触发计算。
这是因为每次运行时,CPU等系统资源的繁忙程度是不一样的,这就影响了最后的运行结果。
(1)第一次运行
在这里插入图片描述
(2)第二次运行
在这里插入图片描述
(3)第三次运行
在这里插入图片描述

2.2 时间滑动窗口(处理时间)

0基础学习PyFlink——时间滑动窗口(Sliding Time Windows)

2.2.1 整体代码

from typing import Iterable
from pyflink.common import Types, Time
from pyflink.datastream import StreamExecutionEnvironment, RuntimeExecutionMode, WindowFunction
from pyflink.datastream.window import TimeWindow, SlidingProcessingTimeWindows


class SumWindowFunction(WindowFunction[tuple, tuple, str, TimeWindow]):
    def apply(self, key: str, window: TimeWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]


word_count_data = [("A",), ("A", ), ("B", ), ("A",), ("A", ), ("B", ), ("A",)]

def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING()])
    # 从列表生成source,指定列表中每个元素的类型
    source = env.from_collection(word_count_data, source_type_info)

    # 按键分组
    keyed_stream = source.key_by(lambda i: i[0])


    # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (keyed_stream\
                .window(SlidingProcessingTimeWindows.of(Time.milliseconds(2),Time.milliseconds(1)))\
               .apply(SumWindowFunction(), out_type_info))

    # define the sink
    reduced.print()

    # submit for execution
    env.execute()


if __name__ == '__main__':
    word_count()

2.2.2 结果

运行两次上述代码,我们发现每次都不同,而且有重叠计算的元素。
(1)第一次运行
A:9,B:3
在这里插入图片描述
(2)第二次运行
A:7,B:3
在这里插入图片描述

4.3 时间滚动窗口(事件时间)

0基础学习PyFlink——事件时间和运行时间的窗口
使用的是运行时间(Tumbling ProcessingTimeWindows)作为窗口的参考时间,得到的结果是不稳定的。
这是因为每次运行时,CPU等系统资源的繁忙程度是不一样的,这就影响了最后的运行结果。
为了让结果稳定,我们可以不依赖运行时间(ProcessingTime),而使用不依赖于运行环境,只依赖于数据的事件时间(EventTime)。

一般,我们需要大数据处理的数据,往往存在一个字段用于标志该条数据的“顺序”。
这个信息可以是单调递增的ID,也可以是不唯一的时间戳,我们可以将这类信息看做事件发生的时间。

那如何让输入的数据中的“事件时间”参与到窗口时长的计算中呢?这儿就要引入时间戳和Watermark(水位线)的概念
假如我们把数据看成一张纸上的内容,水位线则是这张纸的背景。它并不影响纸上内容的表达,只是系统要用它来做更多的事情。
将数据中表达“顺序”的数据转换成时间戳,我们可以使用水位线单调递增时间戳分配器

2.3.1 代码分析

(1)构造了一个Stream,用于存储word_count_data中的数据。

word_count_data = [("A","2024-06-04 08:10:11.100"),
                   ("A", "2024-06-04 08:10:11.101"),
                   ("B", "2024-06-04 08:10:11.102"),
                   ("A","2024-06-04 08:10:11.103")]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING(),Types.STRING()])
    source = env.from_collection(word_count_data, source_type_info)

(2)定制策略

class ElementTimestampAssigner(TimestampAssigner):
    def extract_timestamp(self, value, record_timestamp)-> int:
        time_str = value[1]
        dt = datetime.datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S.%f")
        ts_s = dt.timestamp()  # 时间戳,单位秒
        ts_ms = int(ts_s * 1000)  # 时间戳,单位毫秒
        return ts_ms
# 定义水位线策略
watermark_strategy = WatermarkStrategy.for_monotonous_timestamps() \
    .with_timestamp_assigner(ElementTimestampAssigner())

for_monotonous_timestamps会分配一个水位线单调递增时间戳分配器,然后使用with_timestamp_assigner告知输入数据中“顺序”字段的值。这样系统就会根据这个字段的值生成一个单调递增的时间戳。这个时间戳相对顺序就和输入数据一样,是稳定的。
(3)运行策略
然后对原始数据使用该策略,这样source_with_wartermarks中的数据就包含了时间戳。

# 对原始数据使用该策略
source_with_wartermarks = source.assign_timestamps_and_watermarks(watermark_strategy)

(4)使用TumblingEventTimeWindows,即事件时间(EventTime)窗口,而不是运行时间(ProcessingTime)窗口。

# reducing
out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
reduced = (source_with_wartermarks.key_by(lambda i: i[0])\
            .window(TumblingEventTimeWindows.of(Time.milliseconds(2)))\
           .apply(SumWindowFunction(), out_type_info))

# # define the sink
reduced.print()

# submit for execution
env.execute()

2.3.2 整体代码

from typing import Iterable
from pyflink.common import Types, Time, WatermarkStrategy
from pyflink.common.watermark_strategy import TimestampAssigner
from pyflink.datastream import StreamExecutionEnvironment, RuntimeExecutionMode, WindowFunction
from pyflink.datastream.window import TimeWindow,  TumblingEventTimeWindows
import datetime

class SumWindowFunction(WindowFunction[tuple, tuple, str, TimeWindow]):
    def apply(self, key: str, window: TimeWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]




class ElementTimestampAssigner(TimestampAssigner):
    def extract_timestamp(self, value, record_timestamp)-> int:
        time_str = value[1]
        dt = datetime.datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S.%f")
        ts_s = dt.timestamp()  # 时间戳,单位秒
        ts_ms = int(ts_s * 1000)  # 时间戳,单位毫秒
        return ts_ms


word_count_data = [("A","2024-06-04 08:10:11.100"),
                   ("A", "2024-06-04 08:10:11.110"),
                   ("B", "2024-06-04 08:10:11.102"),
                   ("A","2024-06-04 08:10:11.103")]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING(),Types.STRING()])
    source = env.from_collection(word_count_data, source_type_info)

    # 定义水位线策略
    watermark_strategy = WatermarkStrategy.for_monotonous_timestamps() \
        .with_timestamp_assigner(ElementTimestampAssigner())
    # 对原始数据使用该策略
    source_with_wartermarks = source.assign_timestamps_and_watermarks(watermark_strategy)

    # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (source_with_wartermarks.key_by(lambda i: i[0])\
                .window(TumblingEventTimeWindows.of(Time.milliseconds(2)))\
               .apply(SumWindowFunction(), out_type_info))

    # # define the sink
    reduced.print()

    # submit for execution
    env.execute()


if __name__ == '__main__':
    word_count()

2.3.3 结果

数据乱序也没关系,会自动排序。
在这里插入图片描述

在这里插入图片描述

2.4 时间滑动窗口(事件时间)

2.4.1 整体代码

from typing import Iterable
from pyflink.common import Types, Time, WatermarkStrategy
from pyflink.common.watermark_strategy import TimestampAssigner
from pyflink.datastream import StreamExecutionEnvironment, RuntimeExecutionMode, WindowFunction
from pyflink.datastream.window import TimeWindow,  SlidingEventTimeWindows
import datetime

class SumWindowFunction(WindowFunction[tuple, tuple, str, TimeWindow]):
    def apply(self, key: str, window: TimeWindow, inputs: Iterable[tuple]):
        print(inputs, window)
        return [(key, len(inputs))]




class ElementTimestampAssigner(TimestampAssigner):
    def extract_timestamp(self, value, record_timestamp)-> int:
        time_str = value[1]
        dt = datetime.datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S.%f")
        ts_s = dt.timestamp()  # 时间戳,单位秒
        ts_ms = int(ts_s * 1000)  # 时间戳,单位毫秒
        return ts_ms


word_count_data = [("A","2024-06-04 08:10:11.100"),
                   ("A", "2024-06-04 08:10:11.110"),
                   ("B", "2024-06-04 08:10:11.102"),
                   ("A","2024-06-04 08:10:11.103")]
def word_count():
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_runtime_mode(RuntimeExecutionMode.STREAMING)
    env.set_parallelism(1)  # 将所有数据写到一个文件

    source_type_info = Types.TUPLE([Types.STRING(),Types.STRING()])
    source = env.from_collection(word_count_data, source_type_info)

    # 定义水位线策略
    watermark_strategy = WatermarkStrategy.for_monotonous_timestamps() \
        .with_timestamp_assigner(ElementTimestampAssigner())
    # 对原始数据使用该策略
    source_with_wartermarks = source.assign_timestamps_and_watermarks(watermark_strategy)

    # reducing
    out_type_info = Types.TUPLE([Types.STRING(), Types.INT()])
    reduced = (source_with_wartermarks.key_by(lambda i: i[0])\
                .window(SlidingEventTimeWindows.of(Time.milliseconds(4),Time.milliseconds(2)))\
               .apply(SumWindowFunction(), out_type_info))

    # # define the sink
    reduced.print()

    # submit for execution
    env.execute()


if __name__ == '__main__':
    word_count()

2.4.2 结果

在这里插入图片描述

3 pyflink中文乱码的问题

pyflink遇到的问题

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2025年QS世界大学排名,美国大学表现如何?

大多数访问学者申请,在探讨QS大学排名中美国大学的表现时,我们不难发现这些学府在全球高等教育舞台上占据着举足轻重的地位。QS排名作为评估全球大学综合实力的重要指标之一,充分展示了美国大学在学术声誉、科研实力、教学质量和国际影响力等…

专属部署的优势和企业价值

纷享销客支持多种部署方式,满足不同企业在高性能、隔离性、安全性、合规性等方面的要求。 公有云SaaS 公有云SaaS服务即直接使用纷享云服务,CRM应用、数据等均在纷享云,客户只需开通账号和相关服务,做到了即开即用。 纷享云采用…

Error:Kotlin: Module was compiled with an incompatible version of Kotlin.

一、问题:运行spring boot项目时,idea报出错误:时提示报错如下图: 错误代码: Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected …

springboot p2p金融信贷平台的设计与实现-计算机毕业设计源码82978

摘 要 信息化社会内需要与之针对性的信息获取途径,但是途径的扩展基本上为人们所努力的方向,由于站在的角度存在偏差,人们经常能够获得不同类型信息,这也是技术最为难以攻克的课题。针对p2p金融信贷平台等问题,对p2p金…

PDF编辑与修正 提高工作效率 Enfocus PitStop Pro 2022 中文

Enfocus PitStop Pro 2022是一款专为Mac用户设计的强大PDF编辑和校对工具。它支持添加、删除、合并、分割PDF页面,以及文本和图像的编辑,如文字替换、字体更改、颜色调整等。内置自动修复功能,能快速检测并修复缺失字体、重叠文本等常见问题。…

健身小程序:智能化助力个人健身旅程

一、智能化功能的核心 健身小程序的智能化功能主要体现在以下几个方面: 智能健身计划推荐:小程序内置了先进的算法,能够根据用户的身体状况、健身目标和时间安排,智能推荐个性化的健身计划。这些计划不仅科学合理,而且…

在Vue2和Vue3中ECharts如何使用,详细步骤,ref,$ref。echarts官网。

不管是在vue2中还是在vue3中其实本质上的原理和步骤都是一样的,只是语法可能有所不同。 为了方便大家看起乱,vue2和vue3我分开写。 echarts官网: https://echarts.apache.org/zh/index.html Vue2篇: 1.导入echarts包&#xf…

云联HIS系统源码,二级医院信息系统源码,支持云架构部署模式

采用java语言开发B/S广域互联模式,支持云架构部署模式,支持大数据分析技术;支持与医保平台接口、电子票据对接。 云HIS系统相关技术: 后台:JavaSpring,SpringBoot,SpringMVC,Sprin…

数学模型:操作系统中FCFS、SJF、HRRN算法的平均周转时间比较 c语言

摘 要 研究目的:比较操作系统中进程调度FCFS、SJF、HRRN算法的平均周转时间和带权周转时间的大小关系。 研究方法:在建模分析时,分别举4个进程的例子,1个进程用两个字母分别表示到达时间和执行时间。分两种极端情况&#xff0c…

解锁工业数据流:NeuronEX 规则调试功能实操指南

工业企业要实现数据驱动的新质生产力升级,一个重要的环节便是如何准确、可靠地收集并利用生产过程中的数据流。 NeuronEX 工业边缘软件中的规则调试功能,可帮助用户在安全的环境中模拟数据输入,测试和优化数据处理规则,从而提前发…

低代码是什么,低代码平台可以解决哪些业务问题

低代码(Low-Code)是一种软件开发方法,它使得开发人员能够通过图形界面、拖放组件和模型驱动的逻辑,快速地构建和部署应用程序,而无需编写大量的代码。 近年来,低代码正在逐步帮助企业解决业务问题&#xff…

STL——Stacks容器

一、stack 1.操作 语法: <><>!所有的这些操作可以被用于堆栈. 相等指堆栈有相同的元素并有着相同的顺序。 2.empty 语法: bool empty();如当前堆栈为空&#xff0c;empty() 函数 返回 true 否则返回false. 3.pop 语法: void pop();pop() 函数移除堆栈中最顶层元…

React 懒加载源码实现

懒加载 React 中懒加载是一种按需加载组件的机制&#xff0c;有些组件不需要在页面初始化就进行加载&#xff0c;这些组件可以按需加载&#xff0c;当需要时再进行加载。懒加载是怎么实现的呢&#xff1f;如果要实现一个懒加载功能应该怎么去做呢&#xff1f;可以通过异步动态…

专业学习|博弈论-课程改革

学习来源&#xff1a;北京大学刘霖《博弈论》MOOC公开课 备注&#xff1a;仅做学习分享&#xff0c;请勿转载&#xff0c;转载必究&#xff01; &#xff08;一&#xff09;博弈论的预备知识 基本的微积分的知识和概率论的知识。简单的说会求导数&#xff0c;会求简单的积分&am…

BUUCTF---web---[SUCTF 2019]CheckIn

1、点击题目连接来到页面 2、上传正常的jpg文件&#xff0c;提示内容不能有<?。本来打算上传图片马&#xff0c;但是有过滤 3、可以改成下面的图片马&#xff1a; <script languagephp>eval($_POST[cmd]);</script> 4、将上面的一句话木马先写成txt再修改后缀为…

01_基于人脸的常见表情识别实战_深度学习基础知识

1. 感知机 感知机通常情况下指单层的人工神经网络,其结构与 MP 模型类似(按照生物神经元的结构和工作原理造出来的一个抽象和简化了模型,也称为神经网络的一个处理单元) 假设由一个 n 维的单层感知机,则: x 1 x_1 x1​ 至 x n x_n xn​ 为 n 维输入向量的各个分量w 1 j…

【C语言】一篇带你高强度解析精通 字符串函数和内存函数 (万字总结大全,含思维导图)(建议收藏!!!)

【 库函数】——字符串函数和内存函数 目录 思维导图&#xff1a; 一&#xff1a;字符串函数 1.1&#xff1a;字符串常规函数 1.1.1&#xff1a;长度不受限制的字符串函数 1.1.1.1&#xff1a;strlen函数 1.1.1.2&#xff1a;strcpy函数 1.1.1.3&#xff1a;strcat函数 …

芯片级激光器研发取得新进展

欢迎关注GZH《光场视觉》 自 20 世纪 60 年代以来&#xff0c;激光给世界带来了革命性的变化&#xff0c;如今已成为从尖端手术和精密制造到光纤数据传输等现代应用中不可或缺的工具。 但是&#xff0c;随着激光应用需求的增长&#xff0c;挑战也随之而来。例如&#xff0c;光…

勒索病毒搜索引擎

360勒索病毒搜索引擎 https://lesuobingdu.360.cn/ 腾讯勒索病毒搜索引擎 https://guanjia.qq.com/pr/ls/ VenusEye勒索病毒搜索引擎 https://lesuo.venuseye.com.cn/ 奇安信勒索病毒搜索引擎 https://lesuobingdu.qianxin.com/index/getFile 深信服勒索病毒搜索引擎…

idea插件开发之hello idea plugin

写在前面 最近一直想研究下自定义idea插件的内容&#xff0c;这样如果是想要什么插件&#xff0c;但又一时找不到合适的&#xff0c;就可以自己来搞啦&#xff01;这不终于有时间来研究下&#xff0c;但过程可谓是一波三折&#xff0c;再一次切身体验了下万事开头难。那么&…