官方文档 搬运 MAXMIND IP定位 mysql导入 简单使用

官方文档地址:

官方文档       

文件下载

1. 导入mysql可能报错

Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

查看配置

    SHOW GLOBAL VARIABLES LIKE '%secure%';

secure_file_priv 原来是NULL 依旧报错 

 mysql --help | grep my.cnf                                                            /etc/my.cnf /etc/mysql/my.cnf /opt/homebrew/etc/my.cnf ~/.my.cnf#修改配置
vim /opt/homebrew/etc/my.cnf#追加或修改
secure-file-priv = "/"#重启mysql
mysql.server restart

将 GeoIP2 和 GeoLite2 数据库导入 MySQL

在本页

  • 下载并提取数据库
    • 保持数据库更新
    • 提取 CSV 文件
  • 为网络数据创建表
  • 转换网络字段
  • 架构
    • 将数据加载到网络表中
    • 通过查询来测试我们的表
    • 对表格进行排序以便更快地进行搜索
    • 分解查询以加快搜索速度
  • 可选:创建位置数据表
    • 位置表架构
    • 将数据加载到位置表中
    • 查询我们的表格

本指南将向您展示如何将 GeoIP2 或 GeoLite2 数据库导入 MySQL,以便在您的服务器上轻松查询和操作它们。

导入 CSV 数据库包括下载数据库、提取数据库、创建表来保存数据以及为加快查询速度而对这些表进行索引。

下载并提取数据库

首先,请确保您已下载要导入的 GeoIP2 或 GeoLite2 数据库的最新版本。您可以 通过您的帐户门户下载数据库。CSV 格式的数据库以单个 zip 文件的形式提供。有关存档的 zip 结构和内容的详细信息,请参阅我们的 CSV 数据库文档。在本教程中,我们将使用 GeoIP2 City CSV 文件,但您可以获取有关 我们的任何 CSV 格式数据库的信息并相应地调整以下说明。

保持数据库更新

如果您要导入数据库以供持续使用,您将需要 自动下载和提取 CSV 文件的过程 ,以确保您的数据库始终是最新的。

提取 CSV 文件

下载数据库后,将 zip 文件解压到所需目录中。如果要导入 GeoIP2 City 数据库,您将获得许多文件。在本教程中,我们将使用以下文件:

  • GeoIP2-City-Blocks-IPv4.csv
  • GeoIP2-City-Blocks-IPv6.csv
  • GeoIP2-City-Locations-en.csv

如果您使用英语以外的语言,则可以Locations从 zip 存档中选择适当的文件。例如,如果您想将中文位置名称加载到 MySQL,则可以使用 GeoIP2-City-Locations-zh-CN.csv而不是GeoIP2-City-Locations-en.csv。我们关于 CSV 格式数据库的文档包括 GeoIP2 和 GeoLite2 数据库中当前包含的所有位置文件的列表。

为网络数据创建表

GeoIP2-City-Blocks-IPv4.csv首先我们创建一个表来保存和中包含的网络信息 GeoIP2-City-Blocks-IPv6.csv

转换网络字段

您可以在GeoIP2 和 GeoLite2 CSV 数据库文件部分Blocks中找到这些文件架构的完整描述 。如果您使用的是其他数据库,则可以找到相应数据库的Blocks文件架构,并调整表格以满足该结构。

数据库的字段network使用 CIDR 表示法。遗憾的是,MySQL 不提供处理该格式数据的任何功能,因此我们必须先将网络转换为其他格式,以便以后轻松查询。我们选择将网络表示为一对 IP 地址,它们分别是网络中的第一个和最后一个地址。我们将转换此字段,以便这两个 IP 地址都表示为十六进制数。

我们可以使用 数据库转换工具 将此字段转换为十六进制数。下载程序并将其安装到提取 CSV 文件的同一目录中后,即可运行它:


$ ./geoip2-csv-converter -block-file GeoIP2-City-Blocks-IPv4.csv -include-hex-range -output-file GeoIP2-City-Blocks-IPv4-Hex.csv
$ ./geoip2-csv-converter -block-file GeoIP2-City-Blocks-IPv6.csv -include-hex-range -output-file GeoIP2-City-Blocks-IPv6-Hex.csv

架构

现在我们可以创建一个名为的表geoip2_network来保存我们刚刚转换的数据。我们将使用类型来表示 IP 地址varbinary(16),该类型足够大,可以表示 128 位(16 字节)IPv6 地址。

create table geoip2_network (network_start varbinary(16) not null,network_end varbinary(16) not null,geoname_id int,registered_country_geoname_id int,represented_country_geoname_id int,is_anonymous_proxy bool,is_satellite_provider bool,postal_code text,latitude float,longitude float,accuracy_radius int,is_anycast bool,index(network_start),index(network_end)
);

network_start请注意,我们为和 添加了两个单独的索引network_end。如果我们在这两列上都使用复合索引,我们将无法加快稍后使用的查询速度。

将数据加载到网络表中

GeoIP2-City-Blocks-IPv4.csv我们现在可以将和 的内容导入GeoIP2-City-Blocks-IPv6.csv到我们刚刚创建的表中。

我们首先加载转换后的 IPv6 数据:

load data infile '/var/maxmind/GeoIP2-City-Blocks-IPv6-Hex.csv'
into table geoip2_network
fields terminated by ',' enclosed by '"' lines terminated by '\n' ignore 1 rows
(@network_start, @network_end, @geoname_id, @registered_country_geoname_id, @represented_country_geoname_id,@is_anonymous_proxy, @is_satellite_provider, @postal_code, @latitude, @longitude, @accuracy_radius)
set network_start = unhex(@network_start),network_end = unhex(@network_end),geoname_id = nullif(@geoname_id, ''),registered_country_geoname_id = nullif(@registered_country_geoname_id, ''),represented_country_geoname_id = nullif(@represented_country_geoname_id, ''),is_anonymous_proxy = nullif(@is_anonymous_proxy, ''),is_satellite_provider = nullif(@is_satellite_provider, ''),postal_code = nullif(@postal_code, ''),latitude = nullif(@latitude, ''),longitude = nullif(@longitude, ''),accuracy_radius = nullif(@accuracy_radius, '');

我们可以用同样的方式加载转换后的IPv4数据:

load data infile '/var/maxmind/GeoIP2-City-Blocks-IPv4-Hex.csv'
into table geoip2_network
fields terminated by ',' enclosed by '"' lines terminated by '\n' ignore 1 rows
(@network_start, @network_end, @geoname_id, @registered_country_geoname_id, @represented_country_geoname_id,@is_anonymous_proxy, @is_satellite_provider, @postal_code, @latitude, @longitude, @accuracy_radius)
set network_start = unhex(@network_start),network_end = unhex(@network_end),geoname_id = nullif(@geoname_id, ''),registered_country_geoname_id = nullif(@registered_country_geoname_id, ''),represented_country_geoname_id = nullif(@represented_country_geoname_id, ''),is_anonymous_proxy = nullif(@is_anonymous_proxy, ''),is_satellite_provider = nullif(@is_satellite_provider, ''),postal_code = nullif(@postal_code, ''),latitude = nullif(@latitude, ''),longitude = nullif(@longitude, ''),accuracy_radius = nullif(@accuracy_radius, '');

请注意,即使 CSV 文件中有表中缺少的额外列,数据也会被导入。

通过查询来测试我们的表

所有内容加载完毕后,我们现在可以在数据库中查找 IP 地址。由于我们将 IP 地址表示为varbinary(16),因此我们首先必须使用 MySQL 的内置inet6_aton函数将我们感兴趣的 IP 地址的文本表示转换为相同类型。

select geoname_id, registered_country_geoname_id, represented_country_geoname_id,postal_code, latitude, longitude, accuracy_radius
from geoip2_network
where inet6_aton('214.0.0.0') between network_start and network_end
limit 1;
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
| geoname_id | registered_country_geoname_id | represented_country_geoname_id | postal_code | latitude | longitude | accuracy_radius |
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
|    6252001 |                       6252001 |                           NULL | NULL        |   37.751 |   -97.822 |            1000 |
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
1 row in set (0.03 sec)

虽然这会产生正确的结果,但我们注意到查询性能可以更好。让我们改进它。

对表格进行排序以便更快地进行搜索

加快查询速度的一种方法是添加order by network_end如下内容:

select geoname_id, registered_country_geoname_id, represented_country_geoname_id,postal_code, latitude, longitude, accuracy_radius
from geoip2_network
where inet6_aton('214.0.0.0') between network_start and network_end
order by network_end
limit 1;
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
| geoname_id | registered_country_geoname_id | represented_country_geoname_id | postal_code | latitude | longitude | accuracy_radius |
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
|    6252001 |                       6252001 |                           NULL | NULL        |   37.751 |   -97.822 |            1000 |
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
1 row in set (0.00 sec)

虽然这解决了我们对上一个查询的性能担忧,但对于 GeoIP2 数据库中不包含的地址,此查询的性能仍然很差:

elect geoname_id, registered_country_geoname_id, represented_country_geoname_id,postal_code, latitude, longitude, accuracy_radius
from geoip2_network
where inet6_aton('127.0.0.1') between network_start and network_end
order by network_end
limit 1;
Empty set (4.45 sec)

分解查询以加快搜索速度

我们可以解决这个问题,将查询分成两部分,这样 MySQL 就能更有效地使用我们创建的索引:

select geoname_id, registered_country_geoname_id, represented_country_geoname_id,postal_code, latitude, longitude, accuracy_radius
from (select *from geoip2_networkwhere inet6_aton('214.0.0.0') >= network_startorder by network_start desclimit 1
) net
where inet6_aton('214.0.0.0') <= network_end;
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
| geoname_id | registered_country_geoname_id | represented_country_geoname_id | postal_code | latitude | longitude | accuracy_radius |
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
|    6252001 |                       6252001 |                           NULL | NULL        |   37.751 |   -97.822 |            1000 |
+------------+-------------------------------+--------------------------------+-------------+----------+-----------+-----------------+
1 row in set (0.00 sec)
select geoname_id, registered_country_geoname_id, represented_country_geoname_id,postal_code, latitude, longitude, accuracy_radius
from (select *from geoip2_networkwhere inet6_aton('127.0.0.1') >= network_startorder by network_start desclimit 1
) net
where inet6_aton('127.0.0.1') <= network_end;
Empty set (0.00 sec)

使用该构造可以为所有地址提供良好的查询性能,无论 GeoIP2 数据库是否包含有关这些地址的任何信息。根据您的应用程序,您可能需要考虑将这种复杂性/冗长性封装在一个函数中。或者,MySQL 还提供可用于实现类似性能的空间数据类型,同时允许更自然地表达查询。

可选:创建位置数据表

如果postal_codelatitudelongitudeaccuracy_radius是我们感兴趣的所有内容,那么到此为止,我们的应用程序将能够轻松查询所需的内容。但是,GeoIP2 数据库提供了额外的位置信息。请注意geoname_id我们网络表中的字段。此字段可用于从我们之前下载的文件中查找有关地理位置的其他信息Locations。接下来我们将这些数据加载到 MySQL 中。

位置表架构

我们首先像以前一样创建一个表。与文件一样Blocks,GeoIP2 和 GeoLite2 城市位置文件的架构可以在 数据库文档的 CSV 部分中找到。

我们将此表命名为geoip2_location

create table geoip2_location (geoname_id int not null,locale_code text not null,continent_code text,continent_name text,country_iso_code text,country_name text,subdivision_1_iso_code text,subdivision_1_name text,subdivision_2_iso_code text,subdivision_2_name text,city_name text,metro_code int,time_zone text,is_in_european_union bool,primary key (geoname_id, locale_code(5))
);

将数据加载到位置表中

然后,我们geoip2_locationLocationsCSV 文件填充表格。在本例中,我们将从 填充表格GeoIP2-City-Locations-en.csv。使用带有后缀的文件-en将为我们提供英文的地理位置名称:

导入城市CSV
load data infile '/var/lib/mysql-files/GeoIP2-City-Locations-en.csv'
into table geoip2_location
fields terminated by ',' enclosed by '"' lines terminated by '\n' ignore 1 rows (geoname_id, locale_code, continent_code, continent_name,@country_iso_code, @country_name, @subdivision_1_iso_code, @subdivision_1_name,@subdivision_2_iso_code, @subdivision_2_name, @city_name, @metro_code, @time_zone,is_in_european_union
)
set country_iso_code = nullif(@country_iso_code, ''),country_name = nullif(@country_name, ''),subdivision_1_iso_code = nullif(@subdivision_1_iso_code, ''),subdivision_1_name = nullif(@subdivision_1_name, ''),subdivision_2_iso_code = nullif(@subdivision_2_iso_code, ''),subdivision_2_name = nullif(@subdivision_2_name, ''),city_name = nullif(@city_name, ''),metro_code = nullif(@metro_code, ''),time_zone = nullif(@time_zone, '');

导入国家

load data infile '/var/maxMind/GeoLite2-Country-CSV_20240614/GeoLite2-Country-Locations-en.csv'
into table geoip2_locationfields terminated by ',' enclosed by '"' lines terminated by '\n' ignore 1 rows (geoname_id, locale_code, continent_code, continent_name,@country_iso_code, @country_name,is_in_european_union
)
set country_iso_code = nullif(@country_iso_code, ''),country_name = nullif(@country_name, '');

请注意,有许多不同的Locations文件可用。其他具有不同语言后缀的文件包含-en 某些geoname_ids 的不同语言的本地化版本数据。根据应用程序的需求,您可以决定将其他Locations文件导入本地化表。例如,您可以加载GeoIP2-City-Locations-en.csv 到名为 的表中geoip2_location-en,并加载 GeoIP2-City-Locations-zh-CN.csv到名为 的表中geoip2_location-zh。然后,您可以分别查询您需要的英语或中文位置表。

查询我们的表格

我们现在可以使用我们的geoip2_location表来解析表geoname_id提供的内容geoip2_network。例如:

select latitude, longitude, accuracy_radius, continent_name, country_name, subdivision_1_name, city_name
from (select *from geoip2_networkwhere inet6_aton('214.0.0.0') >= network_startorder by network_start desclimit 1
) net
left join geoip2_location location on (net.geoname_id = location.geoname_id and location.locale_code = 'en'
)
where inet6_aton('214.0.0.0') <= network_end;
+----------+-----------+-----------------+----------------+---------------+--------------------+-----------+
| latitude | longitude | accuracy_radius | continent_name | country_name  | subdivision_1_name | city_name |
+----------+-----------+-----------------+----------------+---------------+--------------------+-----------+
|   37.751 |   -97.822 |            1000 | North America  | United States | NULL               | NULL      |
+----------+-----------+-----------------+----------------+---------------+--------------------+-----------+
1 row in set (0.00 sec)

这里我们只对英语结果感兴趣,但如果我们对不同或其他语言感兴趣,我们可以调整我们的连接条件。

请注意左外连接是如何使用的。这是因为我们的geoip2_network 表的任何给定行可能都没有可用的附加位置信息。例如,某些 IP 地址无法解析为城市或分区。如果可用,使用左连接我们仍会收到latitudelongitude和 accuracy_radius作为查询结果,而如果没有可用的附加位置信息,则内连接将导致零行。

除了geoname_id提供网络位置信息的列之外,还有 和registered_country_geoname_id, represented_country_geoname_id分别提供有关 ISP 注册网络的国家/地区和 IP 地址用户所代表的国家/地区的位置信息。 两者的位置数据都可以通过其他连接来包含:

select latitude, longitude, accuracy_radius,location.continent_name as location_continent_name,location.country_name as location_country_name,location.subdivision_1_name as location_subdivision_1_name,location.city_name as location_city_name,registered_country.continent_name as registered_country_continent_name,registered_country.country_name as registered_country_country_name,represented_country.continent_name as represented_country_continent_name,represented_country.country_name as represented_country_country_name
from (select *from geoip2_networkwhere inet6_aton('214.0.0.0') >= network_startorder by network_start desclimit 1
) net
left join geoip2_location location on (net.geoname_id = location.geoname_id and location.locale_code = 'en'
)
left join geoip2_location registered_country on (net.registered_country_geoname_id = registered_country.geoname_idand registered_country.locale_code = 'en'
)
left join geoip2_location represented_country on (net.represented_country_geoname_id = represented_country.geoname_idand represented_country.locale_code = 'en'
)
where inet6_aton('214.0.0.0') <= network_end;
+----------+-----------+-----------------+-------------------------+-----------------------+-----------------------------+--------------------+-----------------------------------+---------------------------------+------------------------------------+----------------------------------+
| latitude | longitude | accuracy_radius | location_continent_name | location_country_name | location_subdivision_1_name | location_city_name | registered_country_continent_name | registered_country_country_name | represented_country_continent_name | represented_country_country_name |
+----------+-----------+-----------------+-------------------------+-----------------------+-----------------------------+--------------------+-----------------------------------+---------------------------------+------------------------------------+----------------------------------+
|   37.751 |   -97.822 |            1000 | North America           | United States         | NULL                        | NULL               | North America                     | United States                   | NULL                               | NULL                             |
+----------+-----------+-----------------+-------------------------+-----------------------+-----------------------------+--------------------+-----------------------------------+---------------------------------+------------------------------------+----------------------------------+
1 row in set (0.00 sec)

node 使用

github 文档地址icon-default.png?t=N7T8https://github.com/maxmind/GeoIP2-node#city-example

1. 导入模块

npm install @maxmind/geoip2-node

2. node使用

import { Reader } from "@maxmind/geoip2-node";const path = require("path");
const databasePath = path.resolve(__dirname, "../../../GeoLite2-Country.mmdb");export default class IpCenterV2 {//获取国家code
public async getIP(ip: any) {const result = Reader.open(databasePath).then((reader) => {return reader.country(ip)?.country?.isoCode;}).catch((error) => {console.error("Error opening MMDB:", error);return undefined;});return result || undefined;}}#调用const bIpDb = new IpCenterV2();et res = await bIpDb.getCountryISOCode(ip);

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

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

3D 图片悬停效果

3D 图片悬停效果 效果展示 CSS 知识点 background 属性的综合运用transform 属性的综合运用 页面整体布局 <div class"box"><span style"--i: 0"></span><span style"--i: 1"></span><span style"--i…

连锁门店收银系统源码!

1.系统概况 智慧新零售系统是一套针对零售行业的saas收银系统&#xff0c;线下线上一体化的收银系统。核心功能涵盖了线下收银、小程序商城、会员管理、50营销插件、ERP进销存管理、跑腿配送等行业解决方案。 2.适用行业及门店 智慧新零售是针对零售行业的saas收银系统&#…

RabbitMQ实践——交换器(Exchange)绑定交换器

在《RabbitMQ实践——交换器&#xff08;Exchange&#xff09;和绑定&#xff08;Banding&#xff09;》一文中&#xff0c;我们实验了各种交换器。我们可以把交换器看成消息发布的入口&#xff0c;而消息路由规则则是由“绑定关系”&#xff08;Banding&#xff09;来定义&…

白嫖Cloudflare Workers 搭建 Docker Hub镜像加速服务

简介 基于Cloudflare Workers 搭建 Docker Hub镜像加速服务。 首先要注册一个Cloudflare账号。 Cloudflare账号下域名的一级域名&#xff0c;推荐万网注册个top域名&#xff0c;再转移到Cloudflare&#xff0c;很便宜的。 注意 Worker 每天每免费账号有次数限制&#xff0c;…

汽车IVI中控开发入门及进阶(二十七):车载摄像头vehicle camera

前言: 在车载IVI、智能座舱系统中,有一个重要的应用场景就是视频。视频应用又可分为三种,一种是直接解码U盘、SD卡里面的视频文件进行播放,一种是手机投屏,就是把手机投屏软件已视频方式投屏到显示屏上显示,另外一种就是对视频采集设备(主要就是摄像头Camera)的视频源…

Python基础教程(二十):SMTP发送邮件

&#x1f49d;&#x1f49d;&#x1f49d;首先&#xff0c;欢迎各位来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里不仅可以有所收获&#xff0c;同时也能感受到一份轻松欢乐的氛围&#xff0c;祝你生活愉快&#xff01; &#x1f49d;&#x1f49…

【秋招突围】2024届秋招笔试-小红书笔试题-第一套-三语言题解(Java/Cpp/Python)

&#x1f36d; 大家好这里是清隆学长 &#xff0c;一枚热爱算法的程序员 ✨ 本系计划跟新各公司春秋招的笔试题 &#x1f4bb; ACM银牌&#x1f948;| 多次AK大厂笔试 &#xff5c; 编程一对一辅导 &#x1f44f; 感谢大家的订阅➕ 和 喜欢&#x1f497; &#x1f4e7; 清隆这边…

线稳源极跟随 线性电源前端降压

功率MOSFET线性电源涉及跟随.ms14 根本原理是Vgs对Id的控制&#xff0c;Vgs越大&#xff0c;Id越大&#xff0c;反之亦然。 观察转移特性曲线&#xff0c;结合接线图可知&#xff0c;电路稳定后&#xff0c;如果负载电阻增大&#xff0c;则Vsgnd增大&#xff0c;由于Vggnd有稳…

JS读取目录下的所有图片/require动态加载图片/文字高亮

<template class"aa"><div class"demo-image__lazy container"><div class"head"><div class"left-bar"><div><span>综合</span></div><div><span>定位</span><…

【Pandas驯化-02】pd.read_csv读取中文出现error解决方法

【Pandas】驯化-02pd.read_csv读取中文出现error解决方法 本次修炼方法请往下查看 &#x1f308; 欢迎莅临我的个人主页 &#x1f448;这里是我工作、学习、实践 IT领域、真诚分享 踩坑集合&#xff0c;智慧小天地&#xff01; &#x1f387; 相关内容文档获取 微信公众号 &…

用Canvas绘制2D平面近大远小的马路斑马线

用Canvas绘制2D平面近大远小的马路斑马线 设置canvas和上下文&#xff1a; 首先&#xff0c;你需要创建一个元素&#xff0c;并获取其2D渲染上下文。 绘制斑马线&#xff1a; 使用fillRect或strokeRect方法绘制斑马线。你可以通过循环和计算来绘制多条具有不同宽度和间隔的…

k8s之HPA,命名空间资源限制

一、HPA 的相关知识 HPA&#xff08;Horizontal Pod Autoscaling&#xff09;Pod 水平自动伸缩&#xff0c;Kubernetes 有一个 HPA 的资源&#xff0c;HPA 可以根据 CPU 利用率自动伸缩一个 Replication Controller、Deployment 或者Replica Set 中的 Pod 数量。 &#xff08;…

堆栈溢出的攻击 -fno-stack-protector stack smash 检测

在程序返回的一条语句堆栈项目处&#xff0c;用新函数的起始地址覆盖&#xff0c;将会跳转到执行新函数。 现在系统对这个行为做了判断&#xff0c;已经无法实施这类攻击或技巧。 1&#xff0c;测试代码 #include <stdio.h> void cc() {printf("I am cc( )\n"…

小功率无变压器电源设计

采用无变压器电源解决方案为低功率电路提供所需电源通常是有利的。 事实上&#xff0c;如果负载电流只有几十毫安&#xff0c;则可以将输入交流电压转换为直流电压&#xff0c;而无需使用大型、昂贵且笨重的变压器。不带变压器的替代方案也更便宜、更轻并且占地面积更小。无变…

CorelDraw 2024软件安装包下载 丨不限速下载丨亲测好用

​简介&#xff1a; CorelDRAW Graphics Suite 订阅版拥有配备齐全的专业设计工具包&#xff0c;可以通过非常高的效率提供令人惊艳的矢量插图、布局、照片编辑和排版项目。价格实惠的订阅就能获得令人难以置信的持续价值&#xff0c;即时、有保障地获得独家的新功能和内容、…

【Photoshop】PS修改文字内容

Photoshop(PS)修改图片上文字内容&#xff0c;网上教材不少&#xff0c;本人整理实践过的方法&#xff0c;分享给各位。本人实践方法&#xff1a; 内容识别填充&#xff1a;适用于背景色复杂的图片内容修补工具&#xff1a;适用于背景色为纯色的图片 方式一&#xff1a;内容识…

Flink作业执行之 1.DataStream和Transformation

Flink作业执行之 1.DataStream和Transformation 1. 滥觞 在使用Flink完成业务功能之余&#xff0c;有必要了解下我们的任务是如何跑起来的。知其然&#xff0c;知其所以然。 既然重点是学习应用程序如何跑起来&#xff0c;那么应用程序的内容不重要&#xff0c;越简单越好。…

Linux基础命令[29]-chown

文章目录 1. chown 命令说明2. chown 命令语法3. chown 命令示例3.1 修改属主3.2 修改属组3.3 修改属主和属组3.4 修改文件夹所属 4. 总结 1. chown 命令说明 chown&#xff1a;更改文件的用户或用户组&#xff0c;需要 root 用户或 sudo 权限的用户执行该命令。基本信息如下&…

【电路笔记】-共集极放大器

共集极放大器 文章目录 共集极放大器1、概述2、等效电路3、电压增益4、偏置方法5、输入阻抗6、输出阻抗7、电流增益8、示例:共集电极放大器的电压、电流和功率增益9、达林顿对10、总结1、概述 本文介绍另一种用于放大信号的双极晶体管架构,通常称为共集电极放大器 (CCA)。 C…

python如何对list求和

如何在Python中对多个list的对应元素求和&#xff0c;前提是每个list的长度一样。比如&#xff1a;a[1&#xff0c;2&#xff0c;3]&#xff0c;b[2&#xff0c;3&#xff0c;4]&#xff0c;c[3&#xff0c;4&#xff0c;5]&#xff0c;对a&#xff0c;b&#xff0c;c的对应元素…