当前位置: 首页 > news >正文

安卓多用户管理之Userinfo

目录

  • 前言
  • Userinfo----用户信息
    • 1.1 属性
    • 1.2 构造器
    • 1.3 信息的判断及获取方法
        • 1.3.1 获取默认用户类型
        • 1.3.2 基础信息判断
    • 1.4 序列化部分
  • 总结


前言

UserManagerService内部类UserData中有一个Userinfo类型的info参数,在UserData中并未有所体现,但在后续的UserManagerService里会有对info参数的各种操作,需要看下Userinfo类的基本属性和方法


Userinfo----用户信息

源码有500行左右,复制在一块略显臃肿,对其分类解读。
源码结构大致如下:

public class UserInfo implements Parcelable {
...............
属性
...............
构造器
................
信息的判断及获取方法
................
序列化部分的方法
.................
}

1.1 属性

    /*** Primary user. Only one user can have this flag set. It identifies the first human user* on a device. This flag is not supported in headless system user mode.* 主要用户。只有一个用户可以设置此标志。它识别第一个人类用户* 在设备上。无头系统用户模式不支持此标志。*/@UnsupportedAppUsagepublic static final int FLAG_PRIMARY = 0x00000001;/*** User with administrative privileges. Such a user can create and* delete users.* 具有管理权限的用户。这样的用户可以创建* 删除用户。*/public static final int FLAG_ADMIN   = 0x00000002;/*** Indicates a guest user that may be transient.* @deprecated Use {@link UserManager#USER_TYPE_FULL_GUEST} instead.* 表示可能是临时的访客用户。* @不推荐使用{@link UserManager#USER_TYPE_FULL_GUEST}。*/@Deprecatedpublic static final int FLAG_GUEST   = 0x00000004;/*** Indicates the user has restrictions in privileges, in addition to those for normal users.* Exact meaning TBD. For instance, maybe they can't install apps or administer WiFi access pts.* @deprecated Use {@link UserManager#USER_TYPE_FULL_RESTRICTED} instead.* 表示除普通用户的权限外,用户还具有权限限制。* 确切含义待定。例如,他们可能无法安装应用程序或管理WiFi接入点。* @不推荐使用{@link UserManager#USER_TYPE_FULL_RESTRICTED}。*/@Deprecatedpublic static final int FLAG_RESTRICTED = 0x00000008;/*** Indicates that this user has gone through its first-time initialization.* 指示此用户已完成首次初始化。*/public static final int FLAG_INITIALIZED = 0x00000010;/*** Indicates that this user is a profile of another user, for example holding a users*corporate data.* @deprecated Use {@link UserManager#USER_TYPE_PROFILE_MANAGED} instead.* 指示此用户是另一个用户的配置文件,例如持有用户的公司数据。* @不推荐使用{@link UserManager#USER_TYPE_PROFILE_MANAGED}。*/@Deprecatedpublic static final int FLAG_MANAGED_PROFILE = 0x00000020;/*** Indicates that this user is disabled.** <p>Note: If an ephemeral user is disabled, it shouldn't be later re-enabled. Ephemeral users* are disabled as their removal is in progress to indicate that they shouldn't be re-entered.*指示此用户已被禁用。*<p>注意:如果临时用户被禁用,以后就不应该重新启用它。短暂用户在删除过程中被禁用,表示不应重新输入。*/public static final int FLAG_DISABLED = 0x00000040;public static final int FLAG_QUIET_MODE = 0x00000080;/*** Indicates that this user is ephemeral. I.e. the user will be removed after leaving* the foreground.* *指示此用户是临时用户。即用户离开前台后将被删除。*/public static final int FLAG_EPHEMERAL = 0x00000100;/*** User is for demo purposes only and can be removed at any time.* @deprecated Use {@link UserManager#USER_TYPE_FULL_DEMO} instead.* *用户仅用于演示目的,可以随时删除。*@不推荐使用{@link UserManager#USER_TYPE_FULL_DEMO}。*/@Deprecatedpublic static final int FLAG_DEMO = 0x00000200;/*** Indicates that this user is a non-profile human user.** <p>When creating a new (non-system) user, this flag will always be forced true unless the* user is a {@link #FLAG_PROFILE}. If user {@link UserHandle#USER_SYSTEM} is also a* human user, it must also be flagged as FULL.* /***指示此用户是非配置文件的人类用户。*<p>当创建新的(非系统)用户时,除非该用户标志了flag_PROFILE,否则此标志将始终强制为true。*如果用户标志了UserHandle#user_SYSTEM也是人类用户,则还必须将其标记为FULL。 */public static final int FLAG_FULL = 0x00000400;/*** Indicates that this user is {@link UserHandle#USER_SYSTEM}. Not applicable to created users.* *表示此用户是{@link UserHandle#user_SYSTEM}。不适用于创建的用户。*/public static final int FLAG_SYSTEM = 0x00000800;/*** Indicates that this user is a profile human user, such as a managed profile.* Mutually exclusive with {@link #FLAG_FULL}.**指示此用户是配置文件的人工用户,例如托管配置文件。*与{@link#FLAG_FULL}互斥。*/public static final int FLAG_PROFILE = 0x00001000;/*** @hide*/@IntDef(flag = true, prefix = "FLAG_", value = {FLAG_PRIMARY,FLAG_ADMIN,FLAG_GUEST,FLAG_RESTRICTED,FLAG_INITIALIZED,FLAG_MANAGED_PROFILE,FLAG_DISABLED,FLAG_QUIET_MODE,FLAG_EPHEMERAL,FLAG_DEMO,FLAG_FULL,FLAG_SYSTEM,FLAG_PROFILE})@Retention(RetentionPolicy.SOURCE)public @interface UserInfoFlag {}/***将"NO_PROFILE_GROUP_ID"设置为一个表示无效用户ID的常量。*/public static final int NO_PROFILE_GROUP_ID = UserHandle.USER_NULL;@UnsupportedAppUsagepublic @UserIdInt int id;@UnsupportedAppUsagepublic int serialNumber;@UnsupportedAppUsagepublic String name;@UnsupportedAppUsagepublic String iconPath;@UnsupportedAppUsagepublic @UserInfoFlag int flags;@UnsupportedAppUsagepublic long creationTime;@UnsupportedAppUsagepublic long lastLoggedInTime;public String lastLoggedInFingerprint;/*** Type of user, such as {@link UserManager#USER_TYPE_PROFILE_MANAGED}, corresponding to* {@link com.android.server.pm.UserTypeDetails#getName()}.*/public String userType;/*** If this user is a parent user, it would be its own user id.* If this user is a child user, it would be its parent user id.* Otherwise, it would be {@link #NO_PROFILE_GROUP_ID}.*/@UnsupportedAppUsagepublic int profileGroupId;public int restrictedProfileParentId;/*** Index for distinguishing different profiles with the same parent and user type for the* purpose of badging.* It is used for determining which badge color/label to use (if applicable) from* the options available for a particular user type.* 用于区分具有相同父级和用户类型的不同配置文件以进行标记的索引。* 它用于从特定用户类型的可用选项中确定使用哪种徽章颜色/标签(如果适用)。*/public int profileBadge;/** User is only partially created. */@UnsupportedAppUsagepublic boolean partial;/***代一个待移除的访客用户或者访客配置文件。这个变量的作用可能是用于跟踪需要移除的访客用户或者配置文件的信息,*以便在系统操作中进行相应的处理。*/@UnsupportedAppUsagepublic boolean guestToRemove;/*** This is used to optimize the creation of an user, i.e. OEMs might choose to pre-create a* number of users at the first boot, so the actual creation later is faster.** <p>A {@code preCreated} user is not a real user yet, so it should not show up on regular* user operations (other than user creation per se).** <p>Once the pre-created is used to create a "real" user later on, {@code preCreate} is set to* {@code false}.*这用于优化用户的创建,即原始设备制造商可能会选择在第一次启动时预先创建多个用户,因此以后的实际创建速度更快。*<p>{@code preCreated}用户还不是真正的用户,因此它不应该出现在常规用户操作中(而不是用户创建本身)。*<p>一旦预先创建的用于稍后创建“真正”用户,{@code preCreate}将设置为{@code false}。*/public boolean preCreated;/*** When {@code true}, it indicates this user was created by converting a {@link #preCreated}* user.** <p><b>NOTE: </b>only used for debugging purposes, it's not set when marshalled to a parcel.*当{@code true}时,表示该用户是通过转换{@link#preCreated}创建的用户。*<p><b>注意:</b>仅用于调试目的,当它被整理到一个包裹时没有设置。*/public boolean convertedFromPreCreated;
属性类型含义
FLAG_PRIMARYint主要用户标志
FLAG_ADMINint具有管理权限的用户标志
FLAG_GUESTint临时的访客用户标志
FLAG_RESTRICTEDint受限制的标志
FLAG_INITIALIZEDint完成首次初始化标志
FLAG_MANAGED_PROFILEint被管理用户标志
FLAG_DISABLEDint被禁用标志
FLAG_QUIET_MODEint安静模式标志
FLAG_EPHEMERALint临时用户标志
FLAG_DEMOintdemo标志,可以随时删除
FLAG_FULLint非配置文件的人类用户标志
FLAG_SYSTEMint系统用户标志
FLAG_PROFILEint配置文件的人类用户标志
NO_PROFILE_GROUP_IDint字面翻译没有配置文件组ID,值为无效用户ID的常量
idint用户id
serialNumberint序列号
nameString名字
iconPathString图标路径
flagsint标志
creationTimelong创造时间
lastLoggedInTimelong上次登录时间
lastLoggedInFingerprintString上次登录的指纹
userTypeString用户类型
profileGroupIdint配置文件组ID
restrictedProfileParentIdint受限制配置文件的父级ID
profileBadgeint配置文件徽章
partialboolean偏好
guestToRemoveboolean待移除的访客
preCreatedboolean提前创建
convertedFromPreCreatedboolean通过提前创建转变的

1.2 构造器

四个构造器如下:

      /*** Creates a UserInfo whose user type is determined automatically by the flags according to* {@link #getDefaultUserType}; can only be used for user types handled there.* 创建UserInfo,其用户类型由根据{@link#getDefaultUserType}的标志自动确定;只能用于在那里处理的用户类型*/@UnsupportedAppUsagepublic UserInfo(int id, String name, int flags) {this(id, name, null, flags);}/*** Creates a UserInfo whose user type is determined automatically by the flags according to* {@link #getDefaultUserType}; can only be used for user types handled there.* 创建UserInfo,其用户类型由根据{@link#getDefaultUserType}的标志自动确定;只能用于在那里处理的用户类型*/@UnsupportedAppUsagepublic UserInfo(int id, String name, String iconPath, int flags) {this(id, name, iconPath, flags, getDefaultUserType(flags));}public UserInfo(int id, String name, String iconPath, int flags, String userType) {this.id = id;this.name = name;this.flags = flags;this.userType = userType;this.iconPath = iconPath;this.profileGroupId = NO_PROFILE_GROUP_ID;this.restrictedProfileParentId = NO_PROFILE_GROUP_ID;}public UserInfo(UserInfo orig) {name = orig.name;iconPath = orig.iconPath;id = orig.id;flags = orig.flags;userType = orig.userType;serialNumber = orig.serialNumber;creationTime = orig.creationTime;lastLoggedInTime = orig.lastLoggedInTime;lastLoggedInFingerprint = orig.lastLoggedInFingerprint;partial = orig.partial;preCreated = orig.preCreated;convertedFromPreCreated = orig.convertedFromPreCreated;profileGroupId = orig.profileGroupId;restrictedProfileParentId = orig.restrictedProfileParentId;guestToRemove = orig.guestToRemove;profileBadge = orig.profileBadge;}

1.3 信息的判断及获取方法

1.3.1 获取默认用户类型
    /*** Get the user type (such as {@link UserManager#USER_TYPE_PROFILE_MANAGED}) that corresponds to* the given {@link UserInfoFlag}s.* <p>The userInfoFlag can contain GUEST, RESTRICTED, MANAGED_PROFILE, DEMO, or else be* interpreted as a regular "secondary" user. It cannot contain more than one of these.* It can contain other UserInfoFlag properties (like EPHEMERAL), which will be ignored here.** @throws IllegalArgumentException if userInfoFlag is more than one type of user or if it*                                  is a SYSTEM user.**获取对应于的用户类型(例如{@link UserManager#user_type_PROFILE_MANAGED})*给定的{@link UserInfoFlag}s。*<p>userInfoFlag可以包含GUEST、RESTRICTED、MANAGED_PROFILE、DEMO,或者被解释为常规的“次要”用户。其中不能包含多个。*它可以包含其他UserInfoFlag属性(如EPHEMERAL),此处将忽略这些属性。*如果userInfoFlag是多种类型的用户,或者如果是SYSTEM用户。* @hide*/public static @NonNull String getDefaultUserType(@UserInfoFlag int userInfoFlag) {if ((userInfoFlag & FLAG_SYSTEM) != 0) {throw new IllegalArgumentException("Cannot getDefaultUserType for flags "+ Integer.toHexString(userInfoFlag) + " because it corresponds to a "+ "SYSTEM user type.");}final int supportedFlagTypes =FLAG_GUEST | FLAG_RESTRICTED | FLAG_MANAGED_PROFILE | FLAG_DEMO;switch (userInfoFlag & supportedFlagTypes) {case 0 :                   return UserManager.USER_TYPE_FULL_SECONDARY;case FLAG_GUEST:           return UserManager.USER_TYPE_FULL_GUEST;case FLAG_RESTRICTED:      return UserManager.USER_TYPE_FULL_RESTRICTED;case FLAG_MANAGED_PROFILE: return UserManager.USER_TYPE_PROFILE_MANAGED;case FLAG_DEMO:            return UserManager.USER_TYPE_FULL_DEMO;default:throw new IllegalArgumentException("Cannot getDefaultUserType for flags "+ Integer.toHexString(userInfoFlag) + " because it doesn't correspond to a "+ "valid user type.");}}

首先将userInfoFlagFLAG_SYSTEM进行位与操作,如果结果不等于0就会抛出异常表示当前用户类型相当于系统用户。
FLAG_SYSTEM即0x00000800 是一个十六进制数,转换成二进制为 0000 0000 0000 0000 0000 1000 0000 0000。在这里,只有自己&自己情况下才会抛出异常。
然后定义了一个supportedFlagTypes变量,它包含了一系列支持的用户类型标志位,包含了FLAG_GUESTFLAG_RESTRICTEDFLAG_MANAGED_PROFILEFLAG_DEMO

如果是0,表示userInfoFlag不包含任何支持的用户类型标志位,因此返回UserManager.USER_TYPE_FULL_SECONDARY
如果按位与的结果匹配到了FLAG_GUESTFLAG_RESTRICTEDFLAG_MANAGED_PROFILE或者FLAG_DEMO,那么分别返回对应的用户类型。
最后,如果userInfoFlag不匹配任何已知的用户类型标志位,那么抛出一个IllegalArgumentException异常,说明userInfoFlag不对应任何有效的用户类型。

1.3.2 基础信息判断

该部分些许无聊,flags 位与标志再判断是否相等就不作更多说明。通过UserManagerAPI再判断相关状态暂不做更多说明…后续看情况再写一篇UserManager的文章,这部分真的太碎了…

    @UnsupportedAppUsagepublic boolean isPrimary() {return (flags & FLAG_PRIMARY) == FLAG_PRIMARY;}@UnsupportedAppUsagepublic boolean isAdmin() {return (flags & FLAG_ADMIN) == FLAG_ADMIN;}@UnsupportedAppUsagepublic boolean isGuest() {return UserManager.isUserTypeGuest(userType);}@UnsupportedAppUsagepublic boolean isRestricted() {return UserManager.isUserTypeRestricted(userType);}public boolean isProfile() {return (flags & FLAG_PROFILE) != 0;}@UnsupportedAppUsagepublic boolean isManagedProfile() {return UserManager.isUserTypeManagedProfile(userType);}@UnsupportedAppUsagepublic boolean isEnabled() {return (flags & FLAG_DISABLED) != FLAG_DISABLED;}public boolean isQuietModeEnabled() {return (flags & FLAG_QUIET_MODE) == FLAG_QUIET_MODE;}public boolean isEphemeral() {return (flags & FLAG_EPHEMERAL) == FLAG_EPHEMERAL;}public boolean isInitialized() {return (flags & FLAG_INITIALIZED) == FLAG_INITIALIZED;}public boolean isDemo() {return UserManager.isUserTypeDemo(userType);}public boolean isFull() {return (flags & FLAG_FULL) == FLAG_FULL;}/*** Returns true if the user is a split system user.* <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled,* the method always returns false.**如果用户是拆分系统用户,则返回true。*<p>如果没有启用{@link UserManager#isSplitSystemUser拆分系统用户模式},*该方法总是返回false。*/public boolean isSystemOnly() {return isSystemOnly(id);}/*** Returns true if the given user is a split system user.* <p>If {@link UserManager#isSplitSystemUser split system user mode} is not enabled,* the method always returns false.*如果给定用户是拆分系统用户,则返回true。*<p>如果没有启用{@link UserManager#isSplitSystemUser拆分系统用户模式},*该方法总是返回false。*/public static boolean isSystemOnly(int userId) {return userId == UserHandle.USER_SYSTEM && UserManager.isSplitSystemUser();}/*** @return true if this user can be switched to.* @如果此用户可以切换到,则返回true。**/public boolean supportsSwitchTo() {if (isEphemeral() && !isEnabled()) {// Don't support switching to an ephemeral user with removal in progress.//不支持在删除过程中切换到临时用户。return false;}if (preCreated) {// Don't support switching to pre-created users until they become "real" users.//在用户成为“真实”用户之前,不支持切换到预先创建的用户。return false;}return !isProfile();}/*** @return true if this user can be switched to by end user through UI.* *@return true如果最终用户可以通过UI切换到此用户。*/public boolean supportsSwitchToByUser() {// Hide the system user when it does not represent a human user.// 当系统用户不代表人类用户时,隐藏系统用户。boolean hideSystemUser = UserManager.isHeadlessSystemUserMode();return (!hideSystemUser || id != UserHandle.USER_SYSTEM) && supportsSwitchTo();}// TODO(b/142482943): Make this logic more specific and customizable. (canHaveProfile(userType))//都产生todo了,可知该部分还不是完善,暂不做解读/* @hide */public boolean canHaveProfile() {if (isProfile() || isGuest() || isRestricted()) {return false;}if (UserManager.isSplitSystemUser() || UserManager.isHeadlessSystemUserMode()) {return id != UserHandle.USER_SYSTEM;} else {return id == UserHandle.USER_SYSTEM;}}

1.4 序列化部分

	//describeContents方法: 这个方法返回一个标志位,用于描述Parcelable对象特殊对象的对象类型。//通常情况下,如果对象中存在文件描述符,那么返回1,否则返回0。在这个例子中,返回0表示不包含文件描述符。@Overridepublic int describeContents() {return 0;}/***writeToParcel方法: 这个方法用于将对象的数据写入Parcel对象中,以便进行传输。在这个例子中,通过调用Parcel对象的*不同写入方法,将id、name、iconPath、flags、userType、serialNumber、creationTime、lastLoggedInTime、*lastLoggedInFingerprint、partial、preCreated、profileGroupId、guestToRemove、restrictedProfileParentId*和profileBadge等变量的值写入Parcel对象中。*/@Overridepublic void writeToParcel(Parcel dest, int parcelableFlags) {dest.writeInt(id);dest.writeString8(name);dest.writeString8(iconPath);dest.writeInt(flags);dest.writeString8(userType);dest.writeInt(serialNumber);dest.writeLong(creationTime);dest.writeLong(lastLoggedInTime);dest.writeString8(lastLoggedInFingerprint);dest.writeBoolean(partial);dest.writeBoolean(preCreated);dest.writeInt(profileGroupId);dest.writeBoolean(guestToRemove);dest.writeInt(restrictedProfileParentId);dest.writeInt(profileBadge);}@UnsupportedAppUsagepublic static final @android.annotation.NonNull Parcelable.Creator<UserInfo> CREATOR= new Parcelable.Creator<UserInfo>() {//createFromParcel方法: 这个方法接收一个Parcel对象作为参数,用于从Parcel中反序列化出一个UserInfo对象。//在这个例子中,这个方法返回一个新的UserInfo对象,通过读取Parcel对象中的数据来初始化UserInfo对象的各个字段。public UserInfo createFromParcel(Parcel source) {return new UserInfo(source);}//newArray方法: 这个方法接收一个整型参数size,用于创建一个指定大小的UserInfo数组。在这个例子中,//这个方法返回一个UserInfo类型的数组,其大小由传入的size参数决定。public UserInfo[] newArray(int size) {return new UserInfo[size];}};//这个构造函数通常用于在反序列化过程中创建UserInfo对象private UserInfo(Parcel source) {id = source.readInt();name = source.readString8();iconPath = source.readString8();flags = source.readInt();userType = source.readString8();serialNumber = source.readInt();creationTime = source.readLong();lastLoggedInTime = source.readLong();lastLoggedInFingerprint = source.readString8();partial = source.readBoolean();preCreated = source.readBoolean();profileGroupId = source.readInt();guestToRemove = source.readBoolean();restrictedProfileParentId = source.readInt();profileBadge = source.readInt();}

总结

Userinfo主要内容还是看它的属性,方法主要是通过属性标志位的与或操作判断结果,以及常见的序列化传输方法。

相关文章:

安卓多用户管理之Userinfo

目录 前言Userinfo----用户信息1.1 属性1.2 构造器1.3 信息的判断及获取方法1.3.1 获取默认用户类型1.3.2 基础信息判断 1.4 序列化部分 总结 前言 UserManagerService内部类UserData中有一个Userinfo类型的info参数&#xff0c;在UserData中并未有所体现&#xff0c;但在后续…...

JavaScript-流程控制-笔记

1.流程语句的分类 顺序结构 分支结构 循环结构 2.if语句 1&#xff09;if结构 if( 条件 ){ // 条件成立执行的代码 } 2&#xff09;if else 结构 if( 条件 ){ // 条件成立执行的代码 }else{ // 条件不成…...

springboot + vue3实现增删改查分页操作

springboot vue3实现增删改查分页操作 环境最终实现效果实现功能主要框架代码实现数据库后端前端 注意事项 环境 jdk17 vue3 最终实现效果 实现功能 添加用户&#xff0c;禁用&#xff0c;启用&#xff0c;删除&#xff0c;编辑&#xff0c;分页查询 主要框架 后端 spri…...

leetcode01-重复的子字符串

题目链接&#xff1a;459. 重复的子字符串 - 力扣&#xff08;LeetCode&#xff09; 一般思路&#xff1a; 如果存在k是S的字串&#xff0c;记k的长度为s&#xff0c;S的长度为n&#xff0c;则一定有n是s的倍数&#xff0c;且满足对于j∈[s,n]&#xff0c;一定存在s[j]s[j-s]; …...

目标检测数据集 - 夜间行人检测数据集下载「包含VOC、COCO、YOLO三种格式」

数据集介绍&#xff1a;夜间、低光行人检测数据集&#xff0c;真实场景高质量图片数据&#xff0c;涉及场景丰富&#xff0c;比如夜间街景行人、夜间道路行人、夜间遮挡行人、夜间严重遮挡行人数据&#xff1b;适用实际项目应用&#xff1a;公共场所监控场景下夜间行人检测项目…...

【YOLO系列】 YOLOv4思想详解

前言 以下内容仅为个人在学习人工智能中所记录的笔记&#xff0c;先将目标识别算法yolo系列的整理出来分享给大家&#xff0c;供大家学习参考。 本文未对论文逐句逐段翻译&#xff0c;而是阅读全文后&#xff0c;总结出的YOLO V4论文的思路与实现路径。 若文中内容有误&#xf…...

查询json数组

步骤一&#xff1a;创建表格 首先&#xff0c;我们需要创建一个表格来存储包含JSON对象数组的数据。可以使用以下代码创建一个名为 my_table 的表格&#xff1a; CREATE TABLE my_table (id INT PRIMARY KEY AUTO_INCREMENT,json_data JSON ); 上述代码创建了一个包含两个列的…...

Docker mysql 主从复制

目录 介绍&#xff1a;为什么需要进行mysql的主从复制 主从复制原理&#xff1a; ✨主从环境搭建 主从一般面试问题&#xff1a; 介绍&#xff1a;为什么需要进行mysql的主从复制 在实际的生产中&#xff0c;为了解决Mysql的单点故障已经提高MySQL的整体服务性能&#xff…...

第7章-第1节-Java中的异常处理

1、异常Exception概述&#xff1a; 1&#xff09;、异常的概念&#xff1a; 现实生活中万物在发展和变化会出现各种各样不正常的现象。 例如&#xff1a;人的成长过程中会生病。 实际工作中&#xff0c;遇到的情况不可能是非常完美的。 比如&#xff1a;你写的某个模块&…...

使用python生成一个月度账单消费金额柱状图表

阿里云月度账单根据月份、消费金额&#xff08;可开票&#xff09;生成一个柱状图表 import pandas as pd import matplotlib.pyplot as plt import os# 设置中文字体 plt.rcParams[font.sans-serif] [SimHei] # 用于显示中文的宋体# 获取当前工作目录下所有CSV文件 csv_fil…...

将一个独立的磁盘添加到已有的 `/` 分区

将一个独立的磁盘添加到已有的 / 分区是比较复杂的&#xff0c;因为 / 分区已经是一个逻辑卷&#xff08;LVM&#xff09;。在这种情况下&#xff0c;可以扩展现有的 LVM 体积组&#xff08;Volume Group&#xff09;&#xff0c;然后扩展 / 逻辑卷&#xff08;Logical Volume&…...

AI智能电销器人需要注意哪些问题呢

随着科技的不断发展&#xff0c;人们出行变得越来越方便&#xff0c;市面上很多产品也越来越智能化&#xff0c;高科技的产品不仅改变了我们的生活方式而且也改变了企业的竞争方式&#xff0c;很多的企业尤其是电销行业中的大佬己经意识到了AI电销机器人的好处&#xff0c;因此…...

呼叫中心研究分析:到2027年市场规模预计将达4966亿美元

由于业务运营中以客户为中心的方法的兴起&#xff0c;呼叫中心市场近年来出现了显着增长。随着对客户满意度的日益重视&#xff0c;全球对呼叫中心服务的需求猛增。在本次分析中&#xff0c;我们将从全球和中国的角度审视呼叫中心市场的发展趋势。全球市场&#xff1a; 到 2027…...

工业数据采集分析——工厂大脑 提升综合经济效益

随着企业对数字化的认知越来越清晰&#xff0c;对工业数智化的战略越来越明确&#xff0c;企业的诉求也在发生转变。中国的工业企业经过近几十年的发展&#xff0c;自动化、信息化&#xff0c;以及一些基础的数据系统建设在不同的行业中慢慢地推进。近几年&#xff0c;工业企业…...

python系列教程218——生成器表达式

朋友们&#xff0c;如需转载请标明出处&#xff1a;https://blog.csdn.net/jiangjunshow 声明&#xff1a;在人工智能技术教学期间&#xff0c;不少学生向我提一些python相关的问题&#xff0c;所以为了让同学们掌握更多扩展知识更好地理解AI技术&#xff0c;我让助理负责分享…...

jquery 实现简单的标签页效果

实现 <!DOCTYPE html> <html> <head><title>jq 实现简单的标签页效果</title><script src"/jquery/jquery-1.11.1.min.js"></script><style>.tab {cursor: pointer;width:100px;height:30px;float:left;text-align…...

C++ Web框架Drogon初体验笔记

这段时间研究了一下C的Web框架Drogon。从设计原理上面来说和Python的Web框架是大同小异的&#xff0c;但是难点在于编译项目上面&#xff0c;所以现在记录一下编译的过程。下面图是我项目的目录。其中include放的是头文件&#xff0c;src放的是视图文件&#xff0c;static放的是…...

x-cmd pkg | busybox - 嵌入式 Linux 的瑞士军刀

目录 简介首次用户功能特点竞品和相关作品 进一步阅读 简介 busybox 是一个开源的轻量级工具集合&#xff0c;集成了一批最常用 Unix 工具命令&#xff0c;只需要几 MB 大小就能覆盖绝大多数用户在 Linux 的使用&#xff0c;能在多款 POSIX 环境的操作系统&#xff08;如 Linu…...

Java异常简单介绍

文章目录 1. 异常分类和关键字1.1 分类1.2 关键字 2. Error2.1 Error定义2.2 常见的Error2.2.1 VirtualMachineError2.2.2 ThreadDeath2.2.3 LinkageError2.2.4 AssertionError2.2.5 InternalError2.2.6 OutOfMemoryError2.2.6.1 OOM原因2.2.6.2 OutOfMemoryError会导致宕机吗 …...

ocrmypdf_pdf识别

安装 安装说明 https://ocrmypdf.readthedocs.io/en/latest/installation.html#native-windows提到需要的软件&#xff1a; Python 3.7 (64-bit) or later Tesseract 4.0 or later Ghostscript 9.50 or later 安装 ocrmypdf pip install ocrmypdf 添加语言包 https://oc…...

卷积神经网络|猫狗分类系列--导入kaggle猫狗数据集

解决任何真实问题的重要一步是获取数据&#xff0c;Kaggle提供了大量不同数据科学问题的竞赛。 我们将从 https://www.kaggle.com/competitions/dogs-vs-cats/data 下载猫狗数据集&#xff0c;并对其进行一定的操作&#xff0c;以正确的导入到我们的计算机&#xff0c;为接下…...

【linux 多线程并发】线程本地数据存储的两种方式,每个线程可以有同名全局私有数据,以及两种方式的性能分析

线程本地数据(TLS) ​专栏内容&#xff1a; 参天引擎内核架构 本专栏一起来聊聊参天引擎内核架构&#xff0c;以及如何实现多机的数据库节点的多读多写&#xff0c;与传统主备&#xff0c;MPP的区别&#xff0c;技术难点的分析&#xff0c;数据元数据同步&#xff0c;多主节点的…...

2401d,d导入C的问题

原文 D中是否可用仅C头文件库? 在C语言中,我需要这样做: #define STB_DS_IMPLEMENTATION #include "stb_ds.h"在包含h文件前,必须在单个C文件中定义. 在D中试过: enum STB_DS_IMPLEMENTATION 1; import stb_ds;但它不管用.有建议吗?也许使用中间C文件会工作 ,但…...

SpringCloud GateWay实现路由限流

目录 RequestRateLimiterGatewayFilterFactory令牌桶算法实现限流 RequestRateLimiterGatewayFilterFactory Spring Cloud Gateway 内置了一个限流功能的过滤器工厂&#xff0c;那就是RequestRateLimiterGatewayFilterFactory &#xff0c;它使用 Redis 和 Lua 脚本实现令牌桶…...

打印日期c++

给出年份 y和一年中的第 d天&#xff0c;算出第 d天是几月几号。 输入格式 输入包含多组测试数据。 每组数据占一行&#xff0c;包含两个整数 y 和 d。 输出格式 每组数据输出一行一个结果&#xff0c;格式为 yyyy-mm-dd。 数据范围 输入最多包含 100 组数据, 1≤y≤3000, 1≤d…...

数据结构入门到入土——链表(1)

目录 一&#xff0c;顺序表表/ArrayList的缺陷 二&#xff0c;链表 三&#xff0c;链表的实现 四&#xff0c;与链表有关的题目练习&#xff08;1&#xff09; 1.删除链表中等于给定值 val 的所有节点 2.反转一个单链表 3.给定一个带有头结点 head 的非空单链表&#xf…...

MySQL C API的使用

MySQL C API的使用 介绍及使用 MySQL C API&#xff08;也称为 MySQL Connector/C&#xff09;是用于与 MySQL 数据库交互的 C 语言 API。它提供了一组函数和结构体&#xff0c;允许你在 C 程序中连接到 MySQL 数据库服务器&#xff0c;并执行查询、插入、更新等数据库操作。…...

JavaScript防御性编程

简单聊一下防御性编程&#xff0c;初衷是开发人员为了防止自己被裁员&#xff0c;而将代码编写为只有自己能看懂。如何只有自己能看懂&#xff1f;方法多种多样&#xff0c;但不能将简单问题复杂化&#xff0c;比如&#xff1a;编写一堆无效的逻辑关系&#xff0c;或将业务复杂…...

微信预约小程序制作指南:从小白到专家

在当今的数字时代&#xff0c;微信小程序已经成为了一种非常流行的应用方式。预约功能更是成为了许多小程序的核心功能之一。如果你也想为你的小程序添加预约功能&#xff0c;以下步骤将会对你有所帮助。 一、进入乔拓云网后台 乔拓云网是一个在线小程序开发平台&#xff0c;你…...

向量数据库:Milvus

特性 Milvus由Go(63.4%),Python(17.0%),C(16.6%),Shell(1.3%)等语言开发开发&#xff0c;支持python&#xff0c;go&#xff0c;java接口(C,Rust,c#等语言还在开发中)&#xff0c;支持单机、集群部署&#xff0c;支持CPU、GPU运算。Milvus 中的所有搜索和查询操作都在内存中执行…...

广州建站业务公司/九个关键词感悟中国理念

问题描述 一只青蛙一张嘴&#xff0c; 两只眼睛四条腿 两只青蛙两张嘴&#xff0c;四只眼睛八条腿 ⋯ ——— 来自未来的ACM社团的破冰游戏玩起了数青蛙的游戏 这个游戏对于通过大脑来计算的&#x1f43e;毛毛&#x1f43e;同学来说太困难了&#xff0c;而对于用CPU计算的小…...

网站制作时间代码/百度实时热点排行榜

Intellij Idea中的spring boot项目&#xff0c;使用main方法运行可以启动&#xff0c;但是使用mvn spring-boot:run启动总是报错 大概意思就是找不到类&#xff1a;org/apache/maven/shared/artifact/filter/collection/ArtifactsFilter 原来是没有在仓库中找到对应的插件&…...

wordpress 字数限制/微商怎么找客源人脉

举步维艰——如何调试显示器点亮前的故障 显示器是个人计算机&#xff08;PC&#xff09;系统中必不可少的输出设备&#xff0c;它是计算机向用户传递信息的首要媒介。用户也正是通过显示器来观察计算机所作的“工作”&#xff0c;与其交流。离开了显示器&#xff0c;我们便很难…...

深圳市建设工程监理协会网站/东莞百度快速排名

http://blog.csdn.net/syg90178aw/article/details/51647262 RN学习&#xff0c;好多知识都懒得写&#xff0c;趁今天有空&#xff0c;来一发吧&#xff0c;Modal控件的一个小demo&#xff1b;参考文章地址&#xff1a;http://reactnative.cn/docs/0.27/modal.html#content Mo…...

网站怎么做全屏滚动/网络推广引流最快方法

618购物节已经结束了&#xff0c;苹果无疑是最大赢家&#xff0c;iPhone13牢牢占据着热销榜首&#xff0c;销量高达300万部&#xff0c;超过了位居其后的19款手机总销量&#xff0c;可见iPhone13的受欢迎程度&#xff0c;那么国产手机是否就没有可以与它抗衡的呢&#xff1f;其…...

做网站需要用到的符号语言/推广广告赚钱软件

20202020年电大远程网络教育计算机应用基础统考题真年电大远程网络教育计算机应用基础统考题真题两份合集内附答案题两份合集内附答案试题一试题一一、单选题一、单选题1. ______1.在计算机内部&#xff0c;数据加工、处理和传送的形式是______。在计算机内部&#xff0c;数据加…...