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

网站搭建心得/口碑营销的方法

网站搭建心得,口碑营销的方法,wordpress 主题 家居,日本巨乳真人做的视频网站Android VirtualDisplay创建流程及原理 Android DisplayManager提供了createVirtualDisplay接口,用于创建虚拟屏。虚拟屏可用于录屏(网上很多资料说这个功能),分屏幕(比如一块很长的屏幕,通过虚拟屏分出不…

Android VirtualDisplay创建流程及原理

  • Android DisplayManager提供了createVirtualDisplay接口,用于创建虚拟屏。虚拟屏可用于录屏(网上很多资料说这个功能),分屏幕(比如一块很长的屏幕,通过虚拟屏分出不同的区域)等等。

创建VirtualDisplay

  • DisplayManager中的函数原型如下。后两个Hide的API,只有平台的应用才可以使用。
// frameworks/base/core/java/android/hardware/display/DisplayManager.java
public VirtualDisplay createVirtualDisplay(@NonNull String name,int width, int height, int densityDpi, @Nullable Surface surface, int flags) {
}public VirtualDisplay createVirtualDisplay(@NonNull String name,int width, int height, int densityDpi, @Nullable Surface surface, int flags,@Nullable VirtualDisplay.Callback callback, @Nullable Handler handler) {
}
/** @hide */
public VirtualDisplay createVirtualDisplay(@Nullable MediaProjection projection,@NonNull String name, int width, int height, int densityDpi, @Nullable Surface surface,int flags, @Nullable VirtualDisplay.Callback callback, @Nullable Handler handler,@Nullable String uniqueId) {
}
/** @hide */
public VirtualDisplay createVirtualDisplay(@Nullable MediaProjection projection,@NonNull VirtualDisplayConfig virtualDisplayConfig,@Nullable VirtualDisplay.Callback callback, @Nullable Handler handler) {
}
  • 补充一点,MediaProjection中也提供了 createVirtualDisplay这个接口,实际上也是通过调用DisplayManager实现的功能。

// frameworks/base/media/java/android/media/projection/MediaProjection.javapublic VirtualDisplay createVirtualDisplay(@NonNull VirtualDisplayConfig virtualDisplayConfig,@Nullable VirtualDisplay.Callback callback, @Nullable Handler handler) {DisplayManager dm = mContext.getSystemService(DisplayManager.class);// 调用DisplayManager的接口return dm.createVirtualDisplay(this, virtualDisplayConfig, callback, handler);}
  • 创建VirtualDisplay时,需要传入Surface。**VirtualDisplay上要绘制的内容,实际是通过传入的Surface显示出来的。**比如在主屏(根据物理屏,分配逻辑Display)上创建了一个SurfaceView,通过把这个SurfaceView传给VirtualDisplay。那么VirtualDisplay的 内容,实际上是在主屏的SurfaceView上显示的。下面是一段Android原生的例子。
// frameworks/base/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarButtonTest.java
private Display createVirtualDisplay() {final String displayName = "NavVirtualDisplay";final DisplayInfo displayInfo = new DisplayInfo();mContext.getDisplay().getDisplayInfo(displayInfo);final DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);// 创建ImageReader,通过它得到一张SurfacemReader = ImageReader.newInstance(displayInfo.logicalWidth,displayInfo.logicalHeight, PixelFormat.RGBA_8888, 2);assertNotNull("ImageReader must not be null", mReader);// 创建虚拟屏,传入Surface。mVirtualDisplay = displayManager.createVirtualDisplay(displayName, displayInfo.logicalWidth,displayInfo.logicalHeight, displayInfo.logicalDensityDpi, mReader.getSurface(),0 /*flags*/);assertNotNull("virtual display must not be null", mVirtualDisplay);waitForDisplayReady(mVirtualDisplay.getDisplay().getDisplayId());return mVirtualDisplay.getDisplay();
}
  • 上面的例子中创建虚拟屏,返回Display(实际上是VirtualDislay)对象。有了Display对象,我们就可以将View绑定到这个虚拟的Display上了(绑定网上方法比较多可自行搜索)。关于Surface的创建,有很多种方法,比如通过SurfaceContron+Buffer这种方式也可以。
  • VituralDisplay创建时,需要提供flag。其值定义如下,可通过 “或”将flag组合。
 public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1 << 0;public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 1 << 1;public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 1 << 2;public static final int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 1 << 3;public static final int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 1 << 4;public static final int VIRTUAL_DISPLAY_FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD = 1 << 5;public static final int VIRTUAL_DISPLAY_FLAG_SUPPORTS_TOUCH = 1 << 6;public static final int VIRTUAL_DISPLAY_FLAG_ROTATES_WITH_CONTENT = 1 << 7;public static final int VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL = 1 << 8;public static final int VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 9;public static final int VIRTUAL_DISPLAY_FLAG_TRUSTED = 1 << 10;public static final int VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP = 1 << 11;
  • DisplayManager公开的接口中,有VirtualDisplay.Callback ,提供了其状态的回调。
    public static abstract class Callback {/*** Called when the virtual display video projection has been* paused by the system or when the surface has been detached* by the application by calling setSurface(null).* The surface will not receive any more buffers while paused.*/public void onPaused() { }/*** Called when the virtual display video projection has been* resumed after having been paused.*/public void onResumed() { }/*** Called when the virtual display video projection has been* stopped by the system.  It will no longer receive frames* and it will never be resumed.  It is still the responsibility* of the application to release() the virtual display.*/public void onStopped() { }}

VirtualDisplay原理

  • 关于VirtualDisplay的实现原理,主要从AndroidFramework角度进行分析。
    在这里插入图片描述
// /frameworks/base/core/java/android/hardware/display/DisplayManager.java
public VirtualDisplay createVirtualDisplay(@NonNull String name,int width, int height, int densityDpi, @Nullable Surface surface, int flags) {return createVirtualDisplay(name, width, height, densityDpi, surface, flags, null, null);
}public VirtualDisplay createVirtualDisplay(@NonNull String name,int width, int height, int densityDpi, @Nullable Surface surface, int flags,@Nullable VirtualDisplay.Callback callback, @Nullable Handler handler) {final VirtualDisplayConfig.Builder builder = new VirtualDisplayConfig.Builder(name, width,height, densityDpi);builder.setFlags(flags);if (surface != null) {builder.setSurface(surface);}return createVirtualDisplay(null /* projection */, builder.build(), callback, handler);
}// TODO : Remove this hidden API after remove all callers. (Refer to MultiDisplayService)
/** @hide */
public VirtualDisplay createVirtualDisplay(@Nullable MediaProjection projection,@NonNull String name, int width, int height, int densityDpi, @Nullable Surface surface,int flags, @Nullable VirtualDisplay.Callback callback, @Nullable Handler handler,@Nullable String uniqueId) {final VirtualDisplayConfig.Builder builder = new VirtualDisplayConfig.Builder(name, width,height, densityDpi);builder.setFlags(flags);if (uniqueId != null) {builder.setUniqueId(uniqueId);}if (surface != null) {builder.setSurface(surface);}return createVirtualDisplay(projection, builder.build(), callback, handler);
}/** @hide */
public VirtualDisplay createVirtualDisplay(@Nullable MediaProjection projection,@NonNull VirtualDisplayConfig virtualDisplayConfig,@Nullable VirtualDisplay.Callback callback, @Nullable Handler handler) {// 走的这里,会调用到DisplayManagerGlobal中。return mGlobal.createVirtualDisplay(mContext, projection, virtualDisplayConfig, callback,handler);
}
  • DisplayManagerGlobal调用DMS(DisplayManagerService)服务创建虚拟屏,得到DMS返回的DisplayID后,通过DisplayID在Client端创建了VirtualDisplay对象。
// /frameworks/base/core/java/android/hardware/display/DisplayManager.java
public VirtualDisplay createVirtualDisplay(@NonNull Context context, MediaProjection projection,@NonNull VirtualDisplayConfig virtualDisplayConfig, VirtualDisplay.Callback callback,Handler handler) {VirtualDisplayCallback callbackWrapper = new VirtualDisplayCallback(callback, handler);// 从MediaProjection过来的调用,这个地方非空。IMediaProjection projectionToken = projection != null ? projection.getProjection() : null;int displayId;try {// 告知DMS创建虚拟屏,并返回DisplayIDdisplayId = mDm.createVirtualDisplay(virtualDisplayConfig, callbackWrapper,projectionToken, context.getPackageName());} catch (RemoteException ex) {throw ex.rethrowFromSystemServer();}if (displayId < 0) {Log.e(TAG, "Could not create virtual display: " + virtualDisplayConfig.getName());return null;}// 通过DisplayID,取得Display对象信息(也是调用DMS得到的)Display display = getRealDisplay(displayId);if (display == null) {Log.wtf(TAG, "Could not obtain display info for newly created "+ "virtual display: " + virtualDisplayConfig.getName());try {// 创建失败,需要释放mDm.releaseVirtualDisplay(callbackWrapper);} catch (RemoteException ex) {throw ex.rethrowFromSystemServer();}return null;}// 创建VirtualDisplayreturn new VirtualDisplay(this, display, callbackWrapper,virtualDisplayConfig.getSurface());
}
  • DisplayManagerService(DMS)中创建DisplayDevice并添加到Device列表中管理
// /frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java
@Override // Binder call
public int createVirtualDisplay(VirtualDisplayConfig virtualDisplayConfig,IVirtualDisplayCallback callback, IMediaProjection projection, String packageName) {// 检查uid与包名,是否相符。final int callingUid = Binder.getCallingUid();if (!validatePackageName(callingUid, packageName)) {throw new SecurityException("packageName must match the calling uid");}if (callback == null) {throw new IllegalArgumentException("appToken must not be null");}if (virtualDisplayConfig == null) {throw new IllegalArgumentException("virtualDisplayConfig must not be null");}//  拿到client端传过来的surface对象final Surface surface = virtualDisplayConfig.getSurface();int flags = virtualDisplayConfig.getFlags();if (surface != null && surface.isSingleBuffered()) {throw new IllegalArgumentException("Surface can't be single-buffered");}// 下面开始针对Flag,做一些逻辑判断。if ((flags & VIRTUAL_DISPLAY_FLAG_PUBLIC) != 0) {flags |= VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR;// Public displays can't be allowed to show content when locked.if ((flags & VIRTUAL_DISPLAY_FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD) != 0) {throw new IllegalArgumentException("Public display must not be marked as SHOW_WHEN_LOCKED_INSECURE");}}if ((flags & VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY) != 0) {flags &= ~VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR;}if ((flags & VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR) != 0) {flags &= ~VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP;}if (projection != null) {try {if (!getProjectionService().isValidMediaProjection(projection)) {throw new SecurityException("Invalid media projection");}flags = projection.applyVirtualDisplayFlags(flags);} catch (RemoteException e) {throw new SecurityException("unable to validate media projection or flags");}}if (callingUid != Process.SYSTEM_UID &&(flags & VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR) != 0) {if (!canProjectVideo(projection)) {throw new SecurityException("Requires CAPTURE_VIDEO_OUTPUT or "+ "CAPTURE_SECURE_VIDEO_OUTPUT permission, or an appropriate "+ "MediaProjection token in order to create a screen sharing virtual "+ "display.");}}if (callingUid != Process.SYSTEM_UID && (flags & VIRTUAL_DISPLAY_FLAG_SECURE) != 0) {if (!canProjectSecureVideo(projection)) {throw new SecurityException("Requires CAPTURE_SECURE_VIDEO_OUTPUT "+ "or an appropriate MediaProjection token to create a "+ "secure virtual display.");}}if (callingUid != Process.SYSTEM_UID && (flags & VIRTUAL_DISPLAY_FLAG_TRUSTED) != 0) {if (!checkCallingPermission(ADD_TRUSTED_DISPLAY, "createVirtualDisplay()")) {EventLog.writeEvent(0x534e4554, "162627132", callingUid,"Attempt to create a trusted display without holding permission!");throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to "+ "create a trusted virtual display.");}}if (callingUid != Process.SYSTEM_UID&& (flags & VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP) != 0) {if (!checkCallingPermission(ADD_TRUSTED_DISPLAY, "createVirtualDisplay()")) {throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to "+ "create a virtual display which is not in the default DisplayGroup.");}}if ((flags & VIRTUAL_DISPLAY_FLAG_TRUSTED) == 0) {flags &= ~VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;}// Sometimes users can have sensitive information in system decoration windows. An app// could create a virtual display with system decorations support and read the user info// from the surface.// We should only allow adding flag VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS// to trusted virtual displays.final int trustedDisplayWithSysDecorFlag =(VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS| VIRTUAL_DISPLAY_FLAG_TRUSTED);if ((flags & trustedDisplayWithSysDecorFlag)== VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS&& !checkCallingPermission(INTERNAL_SYSTEM_WINDOW, "createVirtualDisplay()")) {throw new SecurityException("Requires INTERNAL_SYSTEM_WINDOW permission");}final long token = Binder.clearCallingIdentity();try {// 调用内部实现return createVirtualDisplayInternal(callback, projection, callingUid, packageName,surface, flags, virtualDisplayConfig);} finally {Binder.restoreCallingIdentity(token);}
}// /frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java
private int createVirtualDisplayInternal(IVirtualDisplayCallback callback,IMediaProjection projection, int callingUid, String packageName, Surface surface,int flags, VirtualDisplayConfig virtualDisplayConfig) {synchronized (mSyncRoot) {if (mVirtualDisplayAdapter == null) {Slog.w(TAG, "Rejecting request to create private virtual display "+ "because the virtual display adapter is not available.");return -1;}// 为虚拟屏创建Device(告知surfaceflinger创建Display)DisplayDevice device = mVirtualDisplayAdapter.createVirtualDisplayLocked(callback, projection, callingUid, packageName, surface, flags,virtualDisplayConfig);if (device == null) {return -1;}// 发送添加Device通知,这里比较重要mDisplayDeviceRepo.onDisplayDeviceEvent(device,DisplayAdapter.DISPLAY_DEVICE_EVENT_ADDED);// 检查Display是否创建成功final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(device);if (display != null) {return display.getDisplayIdLocked();}// Something weird happened and the logical display was not created.Slog.w(TAG, "Rejecting request to create virtual display "+ "because the logical display was not created.");mVirtualDisplayAdapter.releaseVirtualDisplayLocked(callback.asBinder());mDisplayDeviceRepo.onDisplayDeviceEvent(device,DisplayAdapter.DISPLAY_DEVICE_EVENT_REMOVED);}return -1;
}
  • 接下来DMS开始调用SurfaceFlinger的接口,创建Display。并将Display放入自身的List中管理。
// /frameworks/base/services/core/java/com/android/server/display/VirtualDisplayAdapter.java
public DisplayDevice createVirtualDisplayLocked(IVirtualDisplayCallback callback,IMediaProjection projection, int ownerUid, String ownerPackageName, Surface surface,int flags, VirtualDisplayConfig virtualDisplayConfig) {String name = virtualDisplayConfig.getName();// VIRTUAL_DISPLAY_FLAG_SECURE 的用途,是判断是否为安全的Display,这个参数会告知SurfaceFlingerboolean secure = (flags & VIRTUAL_DISPLAY_FLAG_SECURE) != 0;IBinder appToken = callback.asBinder();// 调用SurfaceFligner创建Display(Display的type是virtual)IBinder displayToken = mSurfaceControlDisplayFactory.createDisplay(name, secure);final String baseUniqueId =UNIQUE_ID_PREFIX + ownerPackageName + "," + ownerUid + "," + name + ",";final int uniqueIndex = getNextUniqueIndex(baseUniqueId);String uniqueId = virtualDisplayConfig.getUniqueId();if (uniqueId == null) {uniqueId = baseUniqueId + uniqueIndex;} else {uniqueId = UNIQUE_ID_PREFIX + ownerPackageName + ":" + uniqueId;}// 通过SurfaceFligner返回的displayToken,创建Device对象VirtualDisplayDevice device = new VirtualDisplayDevice(displayToken, appToken,ownerUid, ownerPackageName, surface, flags, new Callback(callback, mHandler),uniqueId, uniqueIndex, virtualDisplayConfig);//  放到虚拟屏的List中管理。mVirtualDisplayDevices.put(appToken, device);try {if (projection != null) {projection.registerCallback(new MediaProjectionCallback(appToken));}appToken.linkToDeath(device, 0);} catch (RemoteException ex) {mVirtualDisplayDevices.remove(appToken);device.destroyLocked(false);return null;}// Return the display device without actually sending the event indicating// that it was added.  The caller will handle it.return device;
}// /frameworks/base/services/core/java/com/android/server/display/DisplayDeviceRepository.java
//  mDisplayDeviceRepo.onDisplayDeviceEvent(device,
//				DisplayAdapter.DISPLAY_DEVICE_EVENT_ADDED); 
// 这段代码,会调用到下面的函数中。
private void handleDisplayDeviceAdded(DisplayDevice device) {synchronized (mSyncRoot) {DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();if (mDisplayDevices.contains(device)) {Slog.w(TAG, "Attempted to add already added display device: " + info);return;}Slog.i(TAG, "Display device added: " + info);device.mDebugLastLoggedDeviceInfo = info;// 需要是将Device(就是上面创建的虚拟屏幕Device)放入到DMS的管理listmDisplayDevices.add(device);// 通知Device添加,会调用到LogicalDisplayMappe的handleDisplayDeviceAddedLocked中。sendEventLocked(device, DISPLAY_DEVICE_EVENT_ADDED);}
}
// /frameworks/base/services/core/java/com/android/server/display/LogicalDisplayMapper.java
private void handleDisplayDeviceAddedLocked(DisplayDevice device) {DisplayDeviceInfo deviceInfo = device.getDisplayDeviceInfoLocked();// Internal Displays need to have additional initialization.// This initializes a default dynamic display layout for INTERNAL// devices, which is used as a fallback in case no static layout definitions// exist or cannot be loaded.if (deviceInfo.type == Display.TYPE_INTERNAL) {initializeInternalDisplayDeviceLocked(device);}// Create a logical display for the new display deviceLogicalDisplay display = createNewLogicalDisplayLocked(device, Layout.assignDisplayIdLocked(false /*isDefault*/));// 刷新布局和display配置applyLayoutLocked();updateLogicalDisplaysLocked();
}
  • 虚拟屏幕的创建,Client端通过Surface告知的DisplayID,创建VirtualDisplay对象。通过DisplayID,与DMS打交道。DMS服务端,通过SurfaceFlinger创建虚拟屏,拿到SurfaceFligner的DisplayToken,然后通过它创建VirtualDisplayDevice + LogicalDisplay来管理虚拟屏幕。
    在这里插入图片描述
如何上屏?
  • 创建虚拟屏幕的时候,会传入了一张Surface(比如绑定主屏的一张Buffer)。虚拟屏通过这张Surface拿到Surface对应的Buffer,将上屏内容绘制到这个Buffer上,然后提交到画面流水线上(SurfaceFlinger)。通过SurfaceFlinger将这个这个Buffer最终由SurfaceFlinger描画并显示到Surface所在那张Display上(根据VirtualDisplay位置去显示。)
    在这里插入图片描述

相关文章:

【Android】VirtualDisplay创建流程及原理

Android VirtualDisplay创建流程及原理 Android DisplayManager提供了createVirtualDisplay接口&#xff0c;用于创建虚拟屏。虚拟屏可用于录屏&#xff08;网上很多资料说这个功能&#xff09;&#xff0c;分屏幕&#xff08;比如一块很长的屏幕&#xff0c;通过虚拟屏分出不…...

Linux服务器快速搭建pytorch

Linux服务器搭建pytorch 文章目录 Linux服务器搭建pytorch一、使用FileZilla传输Anaconda二、激活Anaconda环境1.创建一个虚拟环境2.使用已有项目生成requirements.txt3.在虚拟环境中使用requirements.txt安装其他项目相关库 总结 一、使用FileZilla传输Anaconda 提示&#xf…...

声音克隆,定制自己的声音,使用最新版Bert-VITS2的云端训练+推理记录

说明 本次训练服务器使用Google Colab T4 GPUBert-VITS2库为&#xff1a;https://github.com/fishaudio/Bert-VITS2&#xff0c;其更新较为频繁&#xff0c;使用其2023.10.12的commit版本&#xff1a;主要参考&#xff1a;B站诸多大佬视频&#xff0c;CSDN:https://blog.csdn.…...

LeetCode讲解篇之198. 打家劫舍

LeetCode讲解篇之198. 打家劫舍 文章目录 LeetCode讲解篇之198. 打家劫舍题目描述题解思路题解代码 题目描述 题解思路 该问题可以通过递推来完成 递推公式&#xff1a; 前n间房的最大金额 max&#xff08;前n-1间房的最大金额&#xff0c; 前n-2间房的最大金额第n-1间房的最…...

【下载共享文件】Java基于SMB协议 + JCIFS依赖下载Windows共享文件(亲测可用)

这篇文章,主要介绍如何使用JCIFS依赖库,基于SMB协议下载Windows共享文件。 目录 一、搭建Windows共享文件服务 1.1、创建共享文件目录 1.2、添加文件...

【评分卡实现】应用Python中的toad.ScoreCard函数实现评分卡

逻辑回归已经在各大银行和公司都实际运用于业务。之前的文章已经阐述了逻辑回归三部曲——逻辑回归和sigmod函数的由来、...

【数据结构】双链表的相关操作(声明结构体成员、初始化、判空、增、删、查)

双链表 双链表的特点声明双链表的结构体成员双链表的初始化带头结点的双链表初始化不带头结点的双链表初始化调用双链表的初始化 双链表的判空带头结点的双链表判空不带头结点的双链表判空 双链表的插入&#xff08;按值插入&#xff09;头插法建立双链表带头结点的头插法每次调…...

解析找不到msvcp140.dll的5个解决方法,快速修复dll丢失问题

​在使用计算机过程中&#xff0c;我们也会遇到各种各样的问题。其中&#xff0c;找不到msvcp140.dll修复方法是一个非常普遍的问题。msvcp140.dll是一个动态链接库文件&#xff0c;它是Microsoft Visual C 2015 Redistributable的一部分。这个文件包含了许多用于运行C程序的函…...

代码管理工具 gitlab实战应用

系列文章目录 第一章 Java线程池技术应用 第二章 CountDownLatch和Semaphone的应用 第三章 Spring Cloud 简介 第四章 Spring Cloud Netflix 之 Eureka 第五章 Spring Cloud Netflix 之 Ribbon 第六章 Spring Cloud 之 OpenFeign 第七章 Spring Cloud 之 GateWay 第八章 Sprin…...

小谈设计模式(27)—享元模式

小谈设计模式&#xff08;27&#xff09;—享元模式 专栏介绍专栏地址专栏介绍 享元模式模式结构分析享元工厂&#xff08;FlyweightFactory&#xff09;享元接口&#xff08;Flyweight&#xff09;具体享元&#xff08;ConcreteFlyweight&#xff09;非共享具体享元&#xff0…...

网络代理技术:隐私保护与安全加固的利器

随着数字化时代的不断演进&#xff0c;网络安全和个人隐私保护变得愈发重要。在这个背景下&#xff0c;网络代理技术崭露头角&#xff0c;成为网络工程师和普通用户的得力助手。本文将深入探讨Socks5代理、IP代理&#xff0c;以及它们在网络安全、爬虫开发和HTTP协议中的关键应…...

orgChart.js组织架构图

OrgChart.js是什么&#xff1f; 基于ES6的组织结构图插件。 特征 支持本地数据和远程数据&#xff08;JSON&#xff09;。 基于CSS3过渡的平滑扩展/折叠效果。 将图表对齐为4个方向。 允许用户通过拖放节点更改组织结构。 允许用户动态编辑组织图并将最终层次结构保存为…...

华纳云:SQL Server怎么批量导入和导出数据

在SQL Server中&#xff0c;您可以使用不同的方法来批量导入和导出数据&#xff0c;具体取决于您的需求和数据源。以下是一些常见的方法&#xff1a; 批量导入数据&#xff1a; 使用SQL Server Management Studio (SSMS) 导入向导&#xff1a; 打开SQL Server Management Stud…...

深入了解桶排序:原理、性能分析与 Java 实现

桶排序&#xff08;Bucket Sort&#xff09;是一种排序算法&#xff0c;通常用于将一组数据分割成有限数量的桶&#xff08;或容器&#xff09;&#xff0c;然后对每个桶中的数据进行排序&#xff0c;最后将这些桶按顺序合并以得到排好序的数据集。 桶排序原理 确定桶的数量&am…...

微店店铺所有商品数据接口,微店整店商品数据接口,微店店铺商品数据接口,微店API接口

微店店铺所有商品数据接口是一种允许开发者在其应用程序中调用微店店铺所有商品数据的API接口。利用这一接口&#xff0c;开发者可以获取微店店铺的所有商品信息&#xff0c;包括商品名称、价格、介绍、图片等。 其主要用途是帮助开发者进行各种业务场景的构建&#xff0c;例如…...

SSL证书能选择免费的吗?

当涉及到保护您的网站和您的用户的数据时&#xff0c;SSL证书是必不可少的。SSL证书是一种安全协议&#xff0c;用于加密在Web浏览器和服务器之间传输的数据&#xff0c;例如信用卡信息、登录凭据和个人身份信息。 但是&#xff0c;许多SSL证书都是付费的&#xff0c;这可能会…...

苹果macOS电脑版 植物大战僵尸游戏

植物大战僵尸是一款极富策略性的小游戏&#xff0c;充满趣味性和策略性。主题是植物与僵尸之间的战斗。玩家通过武装多种不同的植物&#xff0c;切换不同的功能&#xff0c;快速有效地把僵尸阻挡在入侵的道路上。不同的敌人&#xff0c;不同的玩法构成五种不同的游戏模式&#…...

【每日一题】ABC311G - One More Grid Task | 单调栈 | 简单

题目内容 原题链接 给定一个 n n n 行 m m m 列的矩阵&#xff0c;问权值最大的子矩阵的权值是多少。 对于一个矩阵&#xff0c;其权值定义为矩阵中的最小值 m i n v minv minv 乘上矩阵中所有元素的和。 数据范围 1 ≤ n , m ≤ 300 1\leq n,m \leq 300 1≤n,m≤300 1 ≤…...

第五十六章 学习常用技能 - 执行 SQL 查询

文章目录 第五十六章 学习常用技能 - 执行 SQL 查询执行 SQL 查询检查对象属性 第五十六章 学习常用技能 - 执行 SQL 查询 执行 SQL 查询 要运行 SQL 查询&#xff0c;请在管理门户中执行以下操作&#xff1a; 选择系统资源管理器 > SQL。如果需要&#xff0c;请选择标题…...

2023年起重信号司索工(建筑特殊工种)证考试题库及起重信号司索工(建筑特殊工种)试题解析

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 2023年起重信号司索工(建筑特殊工种)证考试题库及起重信号司索工(建筑特殊工种)试题解析是安全生产模拟考试一点通结合&#xff08;安监局&#xff09;特种作业人员操作证考试大纲和&#xff08;质检局&#xff09;特…...

《华为战略管理法:DSTE实战体系》作者谢宁老师受邀为某电力上市集团提供两天的《成功的产品管理及产品经理》内训。

​​ 近日&#xff0c;《华为战略管理法&#xff1a;DSTE实战体系》作者谢宁老师受邀为某电力上市集团提供两天的《成功的产品管理及产品经理》内训。 谢宁老师作为华为培训管理部特聘资深讲师和顾问&#xff0c;也是畅销书《华为战略管理法&#xff1a;DSTE实战体系》、《智慧…...

finalshell连接虚拟机中的ubuntu

finalshell下载地址: https://www.finalshell.org/ubuntu设置root密码&#xff1a; sudo passwd rootubuntu关闭防火墙&#xff1a; sudo ufw disable安装ssh # sudo apt update #更新数据(可以不执行) # sudo apt upgrade #更新软件(可以不执行) sudo apt install open…...

django系列之事务操作

Django 默认的事务行为是自动提交&#xff0c;除非事务正在执行&#xff0c;否则每个查询将会马上自动提交到数据库。 1. 全局开启事务 在 Web 里&#xff0c;处理事务比较常用的方式是将每个请求封装在一个事务中。 在你想启用该行为的数据库中&#xff0c;把 settings 配置…...

stm32学习笔记:中断的应用:对射式红外传感器计次旋转编码器计次

相关API介绍 EXT配置API(stm32f10x exti.h&#xff09; NVIC 配置API (misc.h) 初始化的中断的步骤 第一步&#xff1a;配置RCC时钟&#xff0c;把涉及外设的时钟都打开 第二步&#xff1a;配置GPIO&#xff0c;设置为输入模式 第三步&#xff1a;配置AFIO&#xff0…...

one-hot是什么

“one-hot” 是一种编码技术&#xff0c;通常用于机器学习和数据处理中&#xff0c;用来表示分类数据或离散变量。它的目的是将一个分类变量转换成二进制向量&#xff0c;其中只有一个元素是 “hot”&#xff08;值为1&#xff09;&#xff0c;而其他元素都是 “cold”&#xf…...

基于阿基米德优化优化的BP神经网络(分类应用) - 附代码

基于阿基米德优化优化的BP神经网络&#xff08;分类应用&#xff09; - 附代码 文章目录 基于阿基米德优化优化的BP神经网络&#xff08;分类应用&#xff09; - 附代码1.鸢尾花iris数据介绍2.数据集整理3.阿基米德优化优化BP神经网络3.1 BP神经网络参数设置3.2 阿基米德优化算…...

ubuntu20.04配置阿里的kubernetes源

不仅适用于kubernetes软件源的配置&#xff0c;同样适用于其他软件源 1、安装依赖 sudo apt-get update # apt-transport-https may be a dummy package; if so, you can skip that package sudo apt-get install -y apt-transport-https ca-certificates curl 2、配置gpg签名…...

【运维】一些团队开发相关的软件安装。

gitlab 安装步骤 (1) 下载镜像&#xff0c;并且上传到服务器 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-16.2.8-ce.0.el7.x86_64.rpm &#xff08;2&#xff09;rpm -i gitlab-ce-16.2.8-ce.0.el7.x86_64.rpm &#xff08;3&#xff09;安装成功后…...

互联网Java工程师面试题·Java 并发编程篇·第七弹

目录 16、CAS 的问题 17、什么是 Future&#xff1f; 18、什么是 AQS 19、AQS 支持两种同步方式&#xff1a; 20、ReadWriteLock 是什么 21、FutureTask 是什么 22、synchronized 和 ReentrantLock 的区别 23、什么是乐观锁和悲观锁 24、线程 B 怎么知道线程 A 修改了…...

SQL语句常见分类

SQL是Structured Query Language&#xff08;结构化查询语言&#xff09;的简写。 Structured发音 SQL 是关系型数据库管理系统的标准语言&#xff0c;如Oracle、MySQL、Microsoft SQL Server。 DDL DDL是Data Definition Language&#xff08;数据定义语言&#xff09;的简…...