wayland(xdg_wm_base) + egl + opengles 最简实例

news2024/9/23 1:20:37

文章目录

  • 前言
  • 一、ubuntu 下相关环境准备
    • 1. 获取 xdg_wm_base 依赖的相关文件
    • 2. 查看 ubuntu 上安装的opengles 版本
    • 3. 查看 weston 所支持的 窗口shell 接口种类
  • 二、xdg_wm_base 介绍
  • 三、egl_wayland_demo
    • 1.egl_wayland_demo2_0.c
    • 2.egl_wayland_demo3_0.c
    • 3. xdg-shell-protocol.c和 xdg-shell-client-protocol.h
    • 4. 编译和运行
      • 4.1 编译
      • 4.2 运行
  • 总结
  • 参考资料


前言

`本文主要介绍如何在linux 下,基于xdg_wm_base 接口的 wayland client 中 使用 egl + opengles 渲染一个最基本的三角形
软硬件环境:
硬件:PC
软件:
ubuntu22.04
EGL1.4
openGL ES3.1
weston9.0


一、ubuntu 下相关环境准备

1. 获取 xdg_wm_base 依赖的相关文件

之前的文章 weston 源码下载及编译 介绍了如何在ubuntu 22.04 下面编译 weston9.0 ,在编译结束后,在build 目录下会生成 xdg-shell-protocol.cxdg-shell-client-protocol.h 这两个文件,如下图所示
在这里插入图片描述
xdg-shell-protocol.cxdg-shell-client-protocol.h 这两个文件就是使用 xdg_wm_base 时所依赖的,这里就直接从weston9.0的目录下获取了,当然也可以使用wayland 相关的命令(wayland-scanner)去操作对应的.xml 文件来生成它们。

(wayland-scanner)是一个用于生成Wayland协议代码的工具。它是Wayland项目的一部分,用于根据XML描述文件生成C语言代码,以便在应用程序中使用Wayland协议。
Wayland-Scanner工具的用途是将Wayland协议的XML描述文件转换为可供应用程序使用的C语言代码。这些代码包括客户端和服务器端的接口定义、消息处理函数、数据结构等。通过使用Wayland-Scanner,开发人员可以根据自定义的Wayland协议描述文件生成所需的代码,从而实现与Wayland服务器的通信

2. 查看 ubuntu 上安装的opengles 版本

使用 glxinfo | grep “OpenGL ES” 可以查看 ubuntu 上所安装的opengles 的版本,如下图所示,代表当前 ubuntu (ubuntu22.04)上安装的是opengles版本是 opengles3.1
在这里插入图片描述

3. 查看 weston 所支持的 窗口shell 接口种类

直接执行 weston-info(后面会被wayland-info 命令取代) 命令,如下图所示,可以看到,当前ubuntu(ubuntu22.04)上所支持的窗口 shell 接口种类,其中就有 xdg_wm_base, zxdg_shell_v6 等,但是没有 wl_shell , 所以从这可以看出,wl_shell 确实已经在ubuntu22.04 上废弃使用了。
在这里插入图片描述

二、xdg_wm_base 介绍

  • xdg_wm_base是由XDG组织定义的Wayland协议接口之一,它提供了一种标准化的方法,使得窗口管理器和应用程序能够进行互动;
  • xdg_wm_base定义了与窗口管理器交互的基本功能,如创建新窗口、设置窗口标题、最大化和最小化窗口等;
  • 它鼓励窗口管理器使用更加灵活和自由的方式来处理窗口管理任务;
  • xdg_wm_base和 wl_shell 都是Wayland协议的一部分,用于定义窗口管理器(Window Manager)与应用程序之间的通信接口。它们之间的区别在于设计理念和功能,xdg_wm_base提供了更加灵活和标准化的窗口管理器接口,窗口管理器可以根据需要实现更多的功能;

三、egl_wayland_demo

1.egl_wayland_demo2_0.c

使用 opengles2.x 接口的 egl_wayland_demo2_0.c 代码如下

#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-egl.h>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "xdg-shell-client-protocol.h"

#define WIDTH 640
#define HEIGHT 480

struct wl_display *display = NULL;
struct wl_compositor *compositor = NULL;
struct xdg_wm_base *wm_base = NULL;
struct wl_registry *registry = NULL;

struct window {
   
	struct wl_surface *surface;
    struct xdg_surface *xdg_surface;
	struct xdg_toplevel *xdg_toplevel;
	struct wl_egl_window *egl_window;
};

// Index to bind the attributes to vertex shaders
const unsigned int VertexArray = 0;

static void
xdg_wm_base_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
{
   
	xdg_wm_base_pong(shell, serial);
}

static const struct xdg_wm_base_listener wm_base_listener = {
   
	xdg_wm_base_ping,
};

/*for registry listener*/
static void registry_add_object(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) 
{
   
    if (!strcmp(interface, "wl_compositor")) {
   
        compositor = wl_registry_bind(registry, name, &wl_compositor_interface, 1);
    } else if (strcmp(interface, "xdg_wm_base") == 0) {
   
        wm_base = wl_registry_bind(registry, name,
            &xdg_wm_base_interface, 1);
        xdg_wm_base_add_listener(wm_base, &wm_base_listener, NULL);
    }
}

void registry_remove_object(void *data, struct wl_registry *registry, uint32_t name) 
{
   

}

static struct wl_registry_listener registry_listener = {
   registry_add_object, registry_remove_object};

static void
handle_surface_configure(void *data, struct xdg_surface *surface,
			 uint32_t serial)
{
   
	//struct window *window = data;

	xdg_surface_ack_configure(surface, serial);

	//window->wait_for_configure = false;
}

static const struct xdg_surface_listener xdg_surface_listener = {
   
	handle_surface_configure
};

static void
handle_toplevel_configure(void *data, struct xdg_toplevel *toplevel,
			  int32_t width, int32_t height,
			  struct wl_array *states)
{
   
}

static void
handle_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel)
{
   
}

static const struct xdg_toplevel_listener xdg_toplevel_listener = {
   
	handle_toplevel_configure,
	handle_toplevel_close,
};

bool initWaylandConnection()
{
   	
	if ((display = wl_display_connect(NULL)) == NULL)
	{
   
		printf("Failed to connect to Wayland display!\n");
		return false;
	}

	if ((registry = wl_display_get_registry(display)) == NULL)
	{
   
		printf("Faield to get Wayland registry!\n");
		return false;
	}

	wl_registry_add_listener(registry, &registry_listener, NULL);
	wl_display_dispatch(display);

	if (!compositor)
	{
   
		printf("Could not bind Wayland protocols!\n");
		return false;
	}

	return true;
}

bool initializeWindow(struct window *window)
{
   
	initWaylandConnection();
	window->surface = wl_compositor_create_surface (compositor);
	window->xdg_surface = xdg_wm_base_get_xdg_surface(wm_base, window->surface);
    if (window->xdg_surface == NULL)
    {
   
        printf("Failed to get Wayland xdg surface\n");
        return false;
    } else {
   
        xdg_surface_add_listener(window->xdg_surface, &xdg_surface_listener, window);
        window->xdg_toplevel =
            xdg_surface_get_toplevel(window->xdg_surface);
        xdg_toplevel_add_listener(window->xdg_toplevel,
            &xdg_toplevel_listener, window);
        xdg_toplevel_set_title(window->xdg_toplevel, "egl_wayland_demo");
    }
	return true;
}

void releaseWaylandConnection(struct window *window)
{
   
    if(window->xdg_toplevel)
        xdg_toplevel_destroy(window->xdg_toplevel);
    if(window->xdg_surface)
	    xdg_surface_destroy(window->xdg_surface);
	wl_surface_destroy(window->surface);
	xdg_wm_base_destroy(wm_base);
	wl_compositor_destroy(compositor);
	wl_registry_destroy(registry);
	wl_display_disconnect(display);
}

bool createEGLSurface(EGLDisplay eglDisplay, EGLConfig eglConfig, EGLSurface *eglSurface, struct window *window)
{
   

	window->egl_window = wl_egl_window_create(window->surface, WIDTH, HEIGHT);
	if (window->egl_window == EGL_NO_SURFACE) {
    
		printf("Can't create egl window\n"); 
		return false;
	} else {
   
		printf("Created wl egl window\n");
	}

	*eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, window->egl_window, NULL);
	
	return true;
}

bool opengles_init(GLuint *shaderProgram)
{
   
	GLuint fragmentShader = 0;
	GLuint vertexShader = 0;
	char msg[1000];
	GLsizei len;


	const char* const fragmentShaderSource = 
		"precision mediump float;\n"
		"void main()\n"
		"{\n"
		"   gl_FragColor = vec4 (1.0,0.0,0.0,1.0);\n"
		"}\n";


	// Create a fragment shader object
	fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);

	// Load the source code into it
	glShaderSource(fragmentShader, 1, (const char**)&fragmentShaderSource, NULL);
	
	// Compile the source code
	glCompileShader(fragmentShader);

	// Check that the shader compiled
	GLint isShaderCompiled;
	glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &isShaderCompiled);
	if (!isShaderCompiled)
	{
   
		// If an error happened, first retrieve the length of the log message

		glGetShaderInfoLog(fragmentShader, sizeof msg, &len, msg);
		//glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &infoLogLength);

		// Allocate enough space for the message and retrieve it
		//std::vector<char> infoLog;
		//infoLog.resize(infoLogLength);
		//glGetShaderInfoLog(fragmentShader, infoLogLength, &charactersWritten, infoLog.data());
		fprintf(stderr, "Error: compiling %s: %.*s\n", "fragment", len, msg);
		return false;
	}

	// Vertex shader code
	const char* const vertexShaderSource =		
		"attribute vec4 vPosition; \n"
		"void main()\n"
		"{\n"
		"   gl_Position = vPosition;\n"
		"}\n";

	// Create a vertex shader object
	vertexShader = glCreateShader(GL_VERTEX_SHADER);

	// Load the source code into the shader
	glShaderSource(vertexShader, 1, (const char**)&vertexShaderSource, NULL);

	// Compile the shader
	glCompileShader(vertexShader);

	// Check the shader has compiled
	glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &isShaderCompiled);
	if (!isShaderCompiled)
	{
   
		// If an error happened, first retrieve the length of the log message
		//int infoLogLength, charactersWritten;
		//glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &infoLogLength);

		glGetShaderInfoLog(vertexShader, sizeof msg, &len, msg);

		// Allocate enough space for the message and retrieve it
		//std::vector<char> infoLog;
		//infoLog.resize(infoLogLength);
		//glGetShaderInfoLog(vertexShader, infoLogLength, &charactersWritten, infoLog.data());
		fprintf(stderr, "Error: compiling %s: %.*s\n", "vertex", len, msg);
		return false;
	}

	// Create the shader program
	*shaderProgram = glCreateProgram();

	// Attach the fragment and vertex shaders to it
	glAttachShader(*shaderProgram, fragmentShader);
	glAttachShader(*shaderProgram, vertexShader);

	// Bind the vertex attribute "myVertex" to location VertexArray (0)
	glBindAttribLocation(*shaderProgram, VertexArray, "vPosition");

	// Link the program
	glLinkProgram(*shaderProgram);

	// After linking the program, shaders are no longer necessary
	glDeleteShader(vertexShader);
	glDeleteShader(fragmentShader);

	// Check if linking succeeded in the same way we checked for compilation success
	GLint isLinked;
	glGetProgramiv(*shaderProgram, GL_LINK_STATUS, &isLinked);

	if (!isLinked)
	{
   
		// If an error happened, first retrieve the length of the log message
		//nt infoLogLength, charactersWritten;
		//glGetProgramiv(*shaderProgram, GL_INFO_LOG_LENGTH, &infoLogLength);

		// Allocate enough space for the message and retrieve it
		//std::vector<char> infoLog;
		//infoLog.resize(infoLogLength);
		//glGetShaderInfoLog(shaderProgram, infoLogLength, &charactersWritten, infoLog.data());
		glGetProgramInfoLog(*shaderProgram, sizeof msg, &len, msg);
		fprintf(stderr, "Error: compiling %s: %.*s\n", "linkprogram", len, msg);

		return false;
	}

	//	Use the Program
	glUseProgram(*shaderProgram);

	return true;
}
bool renderScene(EGLDisplay eglDisplay, EGLSurface eglSurface)
{
   
	GLfloat vVertices[] = {
   0.0f,0.5f,0.0f,			//vertex pointer
		-0.5f,-0.5f,0.0f,
		0.5f,-0.5f,0.0f};

	glViewport(0, 0, WIDTH, HEIGHT);			//set the view port
	glClearColor(0.00f, 0.70f, 0.67f, 1.0f);		//set rgba value for backgroud 
	glClear(GL_COLOR_BUFFER_BIT);


	glEnableVertexAttribArray(VertexArray);
	glVertexAttribPointer(VertexArray, 3, GL_FLOAT, GL_FALSE, 0, vVertices);
	glDrawArrays(GL_TRIANGLES, 0, 3);			//draw a triangle

	
	if (!eglSwapBuffers(eglDisplay, eglSurface))
	{
   
		return false;
	}

	return true;

}

bool render(GLuint shaderProgram, EGLDisplay eglDisplay, EGLSurface eglSurface)
{
   
	// Renders a triangle for 800 frames using the state setup in the previous function
	for (int i = 0; i < 800; ++i)
	{
   
		wl_display_dispatch_pending(display);
		if (!renderScene(eglDisplay, eglSurface)) {
    return false; }
	}
	return true;
}

void deInitializeGLState(GLuint shaderProgram)
{
   
	// Frees the OpenGL handles for the program
	glDeleteProgram(shaderProgram);
}

void releaseEGLState(EGLDisplay eglDisplay)
{
   
	if (eglDisplay != NULL)
	{
   
		// To release the resources in the context, first the context has to be released from its binding with the current thread.
		eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

		// Terminate the display, and any resources associated with it (including the EGLContext)
		eglTerminate(eglDisplay);
	}
}



int main()
{
   
	/* EGL variables*/
	EGLDisplay eglDisplay;
	EGLConfig eglConfig;
	EGLSurface eglSurface;
	EGLContext context;
	struct window window;

	//wayland client init
	if(!initializeWindow(&window))
	{
   
		printf("initializeWindow failed\n");
		return -1;
	}

	//egl init	
	eglDisplay = eglGetDisplay(display);
	if (eglDisplay == EGL_NO_DISPLAY)
	{
   
		printf("Failed to get an EGLDisplay\n");
		return -1;
	}

	EGLint eglMajorVersion = 0;
	EGLint eglMinorVersion = 0;
    if (!eglInitialize(eglDisplay, &eglMajorVersion, &eglMinorVersion))
    {
   
        printf("Failed to initialize the EGLDisplay\n");
        return -1;
    } else {
   
        printf(" EGL%d.%d\n", eglMajorVersion, eglMinorVersion);
        printf(" EGL_CLIENT_APIS: %s\n", eglQueryString(eglDisplay, EGL_CLIENT_APIS));
        printf(" EGL_VENDOR: %s\n", eglQueryString(eglDisplay,  EGL_VENDOR));
        printf(" EGL_VERSION: %s\n", eglQueryString(eglDisplay,  EGL_VERSION));
        printf(" EGL_EXTENSIONS: %s\n", eglQueryString(eglDisplay,  EGL_EXTENSIONS));
    }

    int result = EGL_FALSE;
    result = eglBindAPI(EGL_OPENGL_ES_API);
    if (result != EGL_TRUE) {
    
        printf("eglBindAPI failed\n");
        return -1; 
    }
 
	const EGLint configurationAttributes[] = {
    EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE };
	EGLint configsReturned;
	if (!eglChooseConfig(eglDisplay, configurationAttributes, &eglConfig, 1, &configsReturned) || (configsReturned != 1))
	{
   
		printf("Failed to choose a suitable config\n");
		return -1;
	}

	EGLint contextAttributes[] = {
    EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
	context = eglCreateContext(eglDisplay, eglConfig, NULL, contextAttributes);

	if(!createEGLSurface(eglDisplay, eglConfig, &eglSurface, &window))
	{
   
		printf("Failed to create EGLSurface\n");
		return -1;
	}

	eglMakeCurrent(eglDisplay, eglSurface, eglSurface, context);
 
    const GLubyte* version = glGetString(GL_VERSION);
    if (version != NULL) {
   
        printf("OpenGL ES version: %s\n", version);
    } else {
   
        printf("Failed to get OpenGL ES version\n");
    }

	// opengles init
	GLuint shaderProgram = 0;
	opengles_init(&shaderProgram);

	//render
	if(!render(shaderProgram, eglDisplay, eglSurface)) {
   
		printf("=========render failed\n");
	}

	//clean up
	deInitializeGLState(shaderProgram);

	// Release the EGL State
	releaseEGLState(eglDisplay);

	// Release the Wayland connection
	releaseWaylandConnection(&window);

	return 0;
}

2.egl_wayland_demo3_0.c

使用 opengles3.x 接口的 egl_wayland_demo3_0.c 代码如下

#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-egl.h>
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "xdg-shell-client-protocol.h"

#define WIDTH 640
#define HEIGHT 480

struct wl_display *display = NULL;
struct wl_compositor *compositor = NULL;
struct xdg_wm_base *wm_base = NULL;
struct wl_registry *registry = NULL;

struct window {
   
	struct wl_surface *surface;
    struct xdg_surface *xdg_surface;
	struct xdg_toplevel *xdg_toplevel;
	struct wl_egl_window *egl_window;
};

// Index to bind the attributes to vertex shaders
const unsigned int VertexArray = 0;

static void
xdg_wm_base_ping(void *data, struct xdg_wm_base *shell, uint32_t serial)
{
   
	xdg_wm_base_pong(shell, serial);
}

static const struct xdg_wm_base_listener wm_base_listener = {
   
	xdg_wm_base_ping,
};

/*for registry listener*/
static void registry_add_object(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t

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

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

相关文章

springboot项目快速引入knife4j

引入依赖 <dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-spring-boot-starter</artifactId><version>3.0.3</version> </dependency>knife4j配置文件 basePackage改为自己存放接口的包名 /*** Kn…

Zookeeper3.5.7源码分析

文章目录 一、Zookeeper算法一致性1、Paxos 算法1.1 概述1.2 算法流程1.3 算法缺陷 2、ZAB 协议2.1 概述2.2 Zab 协议内容 3、CAP理论 二、源码详解1、辅助源码1.1 持久化源码(了解)1.2 序列化源码 2、ZK 服务端初始化源码解析2.1 启用脚本分析2.2 ZK 服务端启动入口2.3 解析参…

LLM Agent-指令微调方案

上一章我们介绍了基于Prompt范式的工具调用方案&#xff0c;这一章介绍基于模型微调&#xff0c;支持任意多工具组合调用&#xff0c;复杂调用的方案。多工具调用核心需要解决3个问题&#xff0c;在哪个位置进行工具调用(where), 从众多工具中选择哪一个(Which), 工具的输入是什…

Java-NIO篇章(5)——Reactor反应器模式

前面已经讲过了Java-NIO中的三大核心组件Selector、Channel、Buffer&#xff0c;现在组件我们回了&#xff0c;但是如何实现一个超级高并发的socket网络通信程序呢&#xff1f;假设&#xff0c;我们只有一台内存为32G的Intel-i710八核的机器&#xff0c;如何实现同时2万个客户端…

音频特效SDK,满足内容生产的音频处理需求

美摄科技&#xff0c;作为音频处理技术的佼佼者&#xff0c;推出的音频特效SDK&#xff0c;旨在满足企业内容生产中的音频处理需求。这款SDK内置多种常见音频处理功能&#xff0c;如音频变声、均衡器、淡入淡出、音频变调等&#xff0c;帮助企业轻松应对各种音频处理挑战。 一…

Vue3笔记(2024)

1. Vue3简介 2020年9月18日&#xff0c;Vue.js发布版3.0版本&#xff0c;代号&#xff1a;One Piece&#xff08;n 经历了&#xff1a;4800次提交、40个RFC、600次PR、300贡献者 官方发版地址&#xff1a;Release v3.0.0 One Piece vuejs/core 截止2023年10月&#xff0c;最…

CSS 实现 flex布局最后一行左对齐的方案「多场景、多方案」

目录 前言解决方案场景一、子项宽度固定&#xff0c;每一行列数固定方法一&#xff1a;模拟两端对齐方法二&#xff1a;根据元素个数最后一个元素动态margin 场景二、子项的宽度不确定方法一&#xff1a;直接设置最后一项 margin-right:auto方法二&#xff1a;使用:after(伪元素…

IDEA插件(MyBatis Log Free)

引言 在Java开发中&#xff0c;MyBatis 是一款广泛使用的持久层框架&#xff0c;它简化了SQL映射并提供了强大的数据访问能力。为了更好地调试和优化MyBatis应用中的SQL语句执行&#xff0c;一款名为 MyBatis Log Free 的 IntelliJ IDEA 插件应运而生。这款插件旨在帮助开发者…

P4769 [NOI2018] 冒泡排序 洛谷黑题题解附源码

[NOI2018] 冒泡排序 题目背景 请注意&#xff0c;题目中存在 n 0 n0 n0 的数据。 题目描述 最近&#xff0c;小 S 对冒泡排序产生了浓厚的兴趣。为了问题简单&#xff0c;小 S 只研究对 1 1 1 到 n n n 的排列的冒泡排序。 下面是对冒泡排序的算法描述。 输入&#x…

光环云与跨境智算云网实验室联合发布“数据全链路安全与合规解决方案”

1月19日&#xff0c;国际数据经济产业创新大会在上海临港新片区召开&#xff0c;光环云受邀出席。会上&#xff0c;光环云与“上海国际数据港创新实验室——跨境智算云网实验室”联合发布“数据全链路安全与合规解决方案”&#xff0c;助力企业数据跨境流动更加便捷、安全、高效…

数据结构之二叉树的遍历

数据结构是程序设计的重要基础&#xff0c;它所讨论的内容和技术对从事软件项目的开发有重要作用。学习数据结构要达到的目标是学会从问题出发&#xff0c;分析和研究计算机加工的数据的特性&#xff0c;以便为应用所涉及的数据选择适当的逻辑结构、存储结构及其相应的操作方法…

BPM、低代码和人工智能:实现灵活、创新与转型的关键结合

随着零售业格局的不断演变&#xff0c;零售商正被迫在一个日益活跃、竞争日益激烈的客户驱动型市场中展开竞争。随着互联网上产品信息和评论的出现&#xff0c;消费者的态度发生了巨大的变化——购物者不再依赖销售人员来获取信息。他们现在知道的和许多零售销售人员一样多&…

解决 BeanUtil.copyProperties 不同属性直接的复制

1、引入hutool <dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.8.16</version> </dependency> hutool官网 2、直接上例子 对象&#xff1a;User.java Data public class User {p…

一文了解Ceph原理以及常见ceph指令

一、Ceph介绍 什么是分布式存储&#xff1f; 与集中式存储相反&#xff0c;分布式存储通常采用存储单元集群的形式。并且具有在集群节点之间进行数据同步和协调的机制。其目的是为了通过服务器解决大规模&#xff0c;高并发情况下的Web访问问题。 Ceph是一个统一的、分布式的存…

2017年认证杯SPSSPRO杯数学建模D题(第二阶段)教室的合理设计全过程文档及程序

2017年认证杯SPSSPRO杯数学建模 D题 教室的合理设计 原题再现&#xff1a; 某培训机构租用了一块如图&#xff08;见附件&#xff09;所示的场地&#xff0c;由于该机构开设了多种门类的课程&#xff0c;所以需要将这块场地通过加入一些隔墙来分割为多个独立的教室和活动区。…

数据目录驱动测试——深入探讨Pytest插件 pytest-datadir

在软件测试中,有效管理测试数据对于编写全面的测试用例至关重要。Pytest插件 pytest-datadir 提供了一种优雅的解决方案,使得数据目录驱动测试变得更加简单而灵活。本文将深入介绍 pytest-datadir 插件的基本用法和实际案例,助你更好地组织和利用测试数据。 什么是pytest-da…

分布式锁实现(mysql,以及redis)以及分布式的概念(续)redsync包使用

道生一&#xff0c;一生二&#xff0c;二生三&#xff0c;三生万物 这张尽量结合上一章进行使用&#xff1a;上一章 这章主要是讲如何通过redis实现分布式锁的 redis实现 这里我用redis去实现&#xff1a; 技术&#xff1a;golang&#xff0c;redis&#xff0c;数据结构 …

github 推送报错 ssh: connect to host github.com port 22: Connection timed out 解决

&#x1f680; 作者主页&#xff1a; 有来技术 &#x1f525; 开源项目&#xff1a; youlai-mall &#x1f343; vue3-element-admin &#x1f343; youlai-boot &#x1f33a; 仓库主页&#xff1a; Gitee &#x1f4ab; Github &#x1f4ab; GitCode &#x1f496; 欢迎点赞…

未来已来:概念车展漫游可视化的震撼之旅

随着科技的飞速发展&#xff0c;汽车行业正经历着前所未有的变革。而在这场变革中&#xff0c;概念车展无疑是一个引领潮流、展望未来的重要舞台。 想象一下&#xff0c;你站在一个巨大的展厅中&#xff0c;四周陈列着各式各样的概念车。它们有的造型独特&#xff0c;有的功能先…

[BJDCTF2020]ZJCTF,不过如此(特详解)

php特性 1.先看代码&#xff0c;提示了next.php&#xff0c;绕过题目的要求去回显next.php 2.可以看到要求存在text内容而且text内容强等于后面的字符串&#xff0c;而且先通过这个if才能执行下面的file参数。 3.看到用的是file_get_contents()函数打开text。想到用data://协…