CMake使用gRPC(Protobuf) 的c++ demo

news2024/11/18 19:51:27

gRPC的命令参数里,

1. 如果要用pacakge,需要--proto_path的参数,
例如helloworld.proto的绝对路径是
/home/user/grpc_demo_ws/grpc_demo/hello_world/proto/helloworld.proto
在helloworld.proto里面的pacakge是
package grpc_demo.hello_world.proto;
那--proto_path的值就是/home/user/grpc_demo_ws
如果要生成带包名的DescriptorTable,--proto_path也是必须的


2. 如果pb.cc/pb.h/grpc.pb.cc/grpc.pb.h想要和proto放在同一个目录
--grpc_out 和 --cpp_out 也都是填入/home/user/grpc_demo_ws
最后实际生成的位置是加上package路径的/home/user/grpc_demo_ws/grpc_demo/hello_world/proto/

下载代码

https://download.csdn.net/download/howard789/87966195

client向server发送一条数据包含自己的名字(helloworld.proto),还有另外两个proto的数据结构(catInfo.proto和dogInfo.proto),server收到后,转成一条string发回给client

目录结构

CMakeLists.txt

cmake_minimum_required(VERSION 3.19)
project(grpc_demo)

set(CMAKE_CXX_STANDARD 17)
# 加载 gRPC ---------------------------------
include(cmake/common.cmake)
MESSAGE("LIB _REFLECTION :" ${_REFLECTION})
MESSAGE("LIB _GRPC_GRPCPP:" ${_GRPC_GRPCPP})
MESSAGE("LIB _PROTOBUF_LIBPROTOBUF:" ${_PROTOBUF_LIBPROTOBUF})
include_directories(/home/hao/.local/include)
# --------------------------------------------
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/grpc_demo)

#---------------------------------------------------------------------
set(PROTO_WS_DIR ${CMAKE_SOURCE_DIR})
MESSAGE("PROTO_WS_DIR:" ${PROTO_WS_DIR})




##  Cat_PROTO--------------------------------------------
set(PROTO_ABSOLUTE_PATH ${PROTO_WS_DIR}/grpc_demo/cat/proto/cat.proto)
set(Regenerate_Proto ON)
include(cmake/common_generate_files.cmake)

##  Dog_PROTO--------------------------------------------
set(PROTO_ABSOLUTE_PATH ${PROTO_WS_DIR}/grpc_demo/dog/proto/dog.proto)
set(Regenerate_Proto ON)
include(cmake/common_generate_files.cmake)

##  HelloWorld_PROTO--------------------------------------------
set(PROTO_ABSOLUTE_PATH ${PROTO_WS_DIR}/grpc_demo/hello_world/proto/helloworld.proto)
set(Regenerate_Proto ON)
include(cmake/common_generate_files.cmake)

find_package(Threads REQUIRED)

add_executable(greeter_client grpc_demo/hello_world/greeter_client.cc)
target_link_libraries(greeter_client
        helloworld_grpc_proto
        dog_grpc_proto
        cat_grpc_proto
        absl::flags
        absl::flags_parse
        ${_REFLECTION}
        ${_GRPC_GRPCPP}
        ${_PROTOBUF_LIBPROTOBUF})

add_executable(greeter_server grpc_demo/hello_world/greeter_server.cc)
target_link_libraries(greeter_server
        helloworld_grpc_proto
        dog_grpc_proto
        cat_grpc_proto
        absl::flags
        absl::flags_parse
        ${_REFLECTION}
        ${_GRPC_GRPCPP}
        ${_PROTOBUF_LIBPROTOBUF})

common.cmake

# Copyright 2018 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# cmake build file for C++ route_guide example.
# Assumes protobuf and gRPC have been installed using cmake.
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build
# that automatically builds all the dependencies before building route_guide.

cmake_minimum_required(VERSION 3.8)

if(MSVC)
  add_definitions(-D_WIN32_WINNT=0x600)
endif()

find_package(Threads REQUIRED)

if(GRPC_AS_SUBMODULE)
  # One way to build a projects that uses gRPC is to just include the
  # entire gRPC project tree via "add_subdirectory".
  # This approach is very simple to use, but the are some potential
  # disadvantages:
  # * it includes gRPC's CMakeLists.txt directly into your build script
  #   without and that can make gRPC's internal setting interfere with your
  #   own build.
  # * depending on what's installed on your system, the contents of submodules
  #   in gRPC's third_party/* might need to be available (and there might be
  #   additional prerequisites required to build them). Consider using
  #   the gRPC_*_PROVIDER options to fine-tune the expected behavior.
  #
  # A more robust approach to add dependency on gRPC is using
  # cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt).

  # Include the gRPC's cmake build (normally grpc source code would live
  # in a git submodule called "third_party/grpc", but this example lives in
  # the same repository as gRPC sources, so we just look a few directories up)
  add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL)
  message(STATUS "Using gRPC via add_subdirectory.")

  # After using add_subdirectory, we can now use the grpc targets directly from
  # this build.
  set(_PROTOBUF_LIBPROTOBUF libprotobuf)
  set(_REFLECTION grpc++_reflection)
  if(CMAKE_CROSSCOMPILING)
    find_program(_PROTOBUF_PROTOC protoc)
  else()
    set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
  endif()
  set(_GRPC_GRPCPP grpc++)
  if(CMAKE_CROSSCOMPILING)
    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
  else()
    set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>)
  endif()
elseif(GRPC_FETCHCONTENT)
  # Another way is to use CMake's FetchContent module to clone gRPC at
  # configure time. This makes gRPC's source code available to your project,
  # similar to a git submodule.
  message(STATUS "Using gRPC via add_subdirectory (FetchContent).")
  include(FetchContent)
  FetchContent_Declare(
    grpc
    GIT_REPOSITORY https://github.com/grpc/grpc.git
    # when using gRPC, you will actually set this to an existing tag, such as
    # v1.25.0, v1.26.0 etc..
    # For the purpose of testing, we override the tag used to the commit
    # that's currently under test.
    GIT_TAG        vGRPC_TAG_VERSION_OF_YOUR_CHOICE)
  FetchContent_MakeAvailable(grpc)

  # Since FetchContent uses add_subdirectory under the hood, we can use
  # the grpc targets directly from this build.
  set(_PROTOBUF_LIBPROTOBUF libprotobuf)
  set(_REFLECTION grpc++_reflection)
  set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>)
  set(_GRPC_GRPCPP grpc++)
  if(CMAKE_CROSSCOMPILING)
    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
  else()
    set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>)
  endif()
else()
  # This branch assumes that gRPC and all its dependencies are already installed
  # on this system, so they can be located by find_package().
  message(STATUS "gRPC and all its dependencies should  be able to located by find_package().")

  # Find Protobuf installation
  # Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
  option(protobuf_MODULE_COMPATIBLE TRUE)
  find_package(Protobuf CONFIG REQUIRED)
  message(STATUS "Using protobuf ${Protobuf_VERSION}")

  set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
  set(_REFLECTION gRPC::grpc++_reflection)

  message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}")

  if(CMAKE_CROSSCOMPILING)
    find_program(_PROTOBUF_PROTOC protoc)
  else()
    set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
  endif()

  # Find gRPC installation
  # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
  find_package(gRPC CONFIG REQUIRED)
  message(STATUS "Using gRPC ${gRPC_VERSION}")

  set(_GRPC_GRPCPP gRPC::grpc++)
  if(CMAKE_CROSSCOMPILING)
    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
  else()
    set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
  endif()





endif()

common_generate_files.cmake

#需要的参数
#PROTO_WS_DIR #工作目录的路径,就是proto档案的package上一级目录。这里是/home/user/grpc_demo_ws
#PROTO_ABSOLUTE_PATH #proto档案的绝对路径 例如/home/user/grpc_demo_ws/grpc_demo/hello_world/proto/helloworld.proto
#Regenerate_Proto #是否重新生成档案 pb.cc pb.h


get_filename_component(PROTO_NAME "${PROTO_ABSOLUTE_PATH}" NAME_WE)
get_filename_component(PROTO_SOURCE_DIR "${PROTO_ABSOLUTE_PATH}" PATH)
file(RELATIVE_PATH PROTO_PKG_DIR ${PROTO_WS_DIR} ${PROTO_SOURCE_DIR})

# Proto file
MESSAGE("PROTO_ABSOLUTE_PATH:" ${PROTO_ABSOLUTE_PATH})
MESSAGE("PROTO_WS_DIR:" ${PROTO_WS_DIR})
MESSAGE("PROTO_PKG_DIR:" ${PROTO_PKG_DIR})
MESSAGE("PROTO_NAME:" ${PROTO_NAME})



# Generated sources
set(_proto_srcs "${PROTO_WS_DIR}/${PROTO_PKG_DIR}/${PROTO_NAME}.pb.cc") #输出档案的绝对路径
set(_proto_hdrs "${PROTO_WS_DIR}/${PROTO_PKG_DIR}/${PROTO_NAME}.pb.h")
set(_grpc_srcs "${PROTO_WS_DIR}/${PROTO_PKG_DIR}/${PROTO_NAME}.grpc.pb.cc")
set(_grpc_hdrs "${PROTO_WS_DIR}/${PROTO_PKG_DIR}/${PROTO_NAME}.grpc.pb.h")


if(Regenerate_Proto)
    MESSAGE("Regenerate_Proto" ${PROTO_NAME}  " = ON")
    add_custom_command(
            OUTPUT "${_proto_srcs}" "${_proto_hdrs}" "${_grpc_srcs}" "${_grpc_hdrs}"   #输出档案的绝对路径
            COMMAND ${_PROTOBUF_PROTOC}
            ARGS
            --proto_path "${PROTO_WS_DIR}"
            --grpc_out "${PROTO_WS_DIR}"
            --cpp_out "${PROTO_WS_DIR}"
            -I "${PROTO_WS_DIR}/${PROTO_PKG_DIR}"
            --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
            "${PROTO_ABSOLUTE_PATH}"
            DEPENDS "${PROTO_ABSOLUTE_PATH}")
endif()


# Include generated *.pb.h files
include_directories("${PROTO_WS_DIR}/${PROTO_PKG_DIR}")


set(LIB_NAME ${PROTO_NAME}_grpc_proto)
MESSAGE(" ********************************* ${PROTO_NAME} 生成的 LIB_NAME名称 = ${LIB_NAME}")
# hw_grpc_proto
add_library(${LIB_NAME}
        ${_grpc_srcs}
        ${_grpc_hdrs}
        ${_proto_srcs}
        ${_proto_hdrs})
target_link_libraries(${LIB_NAME}
        ${_REFLECTION}
        ${_GRPC_GRPCPP}
        ${_PROTOBUF_LIBPROTOBUF})

cat.proto

syntax = "proto3";

package grpc_demo.cat.proto;

message CatInfo{
  string name = 1;
  bool isMale = 2;
}

dog.proto


syntax = "proto3";

package grpc_demo.dog.proto;

message DogInfo{
  string name = 1;
  int32 age = 2;
}

helloworld.proto

// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";

package grpc_demo.hello_world.proto;

import "grpc_demo/cat/proto/cat.proto";
import "grpc_demo/dog/proto/dog.proto";



// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}

  rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
  grpc_demo.cat.proto.CatInfo catInfo=2;
  grpc_demo.dog.proto.DogInfo dogInfo=3;

}

// The response message containing the greetings
message HelloReply {
  string message = 1;

}

greeter_client.cc


#include <iostream>
#include <memory>
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include <grpcpp/grpcpp.h>
#include "helloworld.grpc.pb.h"


ABSL_FLAG(std::string, target, "localhost:50051", "Server address");

using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using grpc_demo::hello_world::proto::Greeter;
using grpc_demo::hello_world::proto::HelloReply;
using grpc_demo::hello_world::proto::HelloRequest;

class GreeterClient {
 public:
  GreeterClient(std::shared_ptr<Channel> channel)
      : stub_(Greeter::NewStub(channel)) {}

  // Assembles the client's payload, sends it and presents the response back
  // from the server.
  std::string SayHello(const std::string& user,grpc_demo::cat::proto::CatInfo* catinfo,grpc_demo::dog::proto::DogInfo* doginfo) {
    // Data we are sending to the server.
    HelloRequest request;
    request.set_name(user);



    request.set_allocated_catinfo(catinfo);
    request.set_allocated_doginfo(doginfo);



    // Container for the data we expect from the server.
    HelloReply reply;

    // Context for the client. It could be used to convey extra information to
    // the server and/or tweak certain RPC behaviors.
    ClientContext context;

    // The actual RPC.
    Status status = stub_->SayHello(&context, request, &reply);

    // Act upon its status.
    if (status.ok()) {
      return reply.message();
    } else {
      std::cout << status.error_code() << ": " << status.error_message()
                << std::endl;
      return "RPC failed";
    }
  }

 private:
  std::unique_ptr<Greeter::Stub> stub_;
};

int main(int argc, char** argv) {
  absl::ParseCommandLine(argc, argv);
  // Instantiate the client. It requires a channel, out of which the actual RPCs
  // are created. This channel models a connection to an endpoint specified by
  // the argument "--target=" which is the only expected argument.
  std::string target_str = absl::GetFlag(FLAGS_target);
  // We indicate that the channel isn't authenticated (use of
  // InsecureChannelCredentials()).
  GreeterClient greeter(
      grpc::CreateChannel(target_str, grpc::InsecureChannelCredentials()));
  std::string user("铲屎官John");
    grpc_demo::cat::proto::CatInfo* catinfo=new grpc_demo::cat::proto::CatInfo();
    catinfo->set_ismale(false);
    catinfo->set_name("mimi");

    grpc_demo::dog::proto::DogInfo* doginfo=new grpc_demo::dog::proto::DogInfo();
    doginfo->set_name("happy");
    doginfo->set_age(12);
  std::string reply = greeter.SayHello(user,catinfo,doginfo);
  std::cout << "client收到server回复: " << reply << std::endl;

  return 0;
}

greeter_server.cc

/*
 *
 * Copyright 2015 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <iostream>
#include <memory>
#include <string>

#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/strings/str_format.h"

#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>

#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#else
#include "helloworld.grpc.pb.h"
#endif

using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
using grpc_demo::hello_world::proto::Greeter;
using grpc_demo::hello_world::proto::HelloReply;
using grpc_demo::hello_world::proto::HelloRequest;

ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");

// Logic and data behind the server's behavior.
class GreeterServiceImpl final : public Greeter::Service {
  Status SayHello(ServerContext* context, const HelloRequest* request,
                  HelloReply* reply) override {

      std::cout << "收到client的消息 "<< std::endl;


      std::string prefix("你好 ");

    reply->set_message(prefix + request->name()
    +",Server收到 CatInfo:"+ request->catinfo().name()
    +"," + std::to_string(request->catinfo().ismale())
    +",DogInfo:"+ request->doginfo().name()
    +"," + std::to_string(request->doginfo().age())
    );
    return Status::OK;
  }
};

void RunServer(uint16_t port) {
  std::string server_address = absl::StrFormat("0.0.0.0:%d", port);
  GreeterServiceImpl service;

  grpc::EnableDefaultHealthCheckService(true);
  grpc::reflection::InitProtoReflectionServerBuilderPlugin();
  ServerBuilder builder;
  // Listen on the given address without any authentication mechanism.
  builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
  // Register "service" as the instance through which we'll communicate with
  // clients. In this case it corresponds to an *synchronous* service.
  builder.RegisterService(&service);
  // Finally assemble the server.
  std::unique_ptr<Server> server(builder.BuildAndStart());
  std::cout << "Server listening on " << server_address << std::endl;

  // Wait for the server to shutdown. Note that some other thread must be
  // responsible for shutting down the server for this call to ever return.
  server->Wait();
}

int main(int argc, char** argv) {
  absl::ParseCommandLine(argc, argv);
  RunServer(absl::GetFlag(FLAGS_port));
  return 0;
}

其余*.pb.cc *.pb.h 是用cmake生成的

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

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

相关文章

同步(通信原理)

同步原理&#xff1a; 在通信系统中&#xff0c;同步是指发送端和接收端在时间上保持一致&#xff0c;使得接收端能够正确地解析和还原发送端发送的信号。同步的原理可以根据具体的通信系统和协议来区分&#xff0c;下面是几种常见的同步原理&#xff1a; 1. 时钟同步&#x…

uniapp 配置chooseLocation微信小程序腾讯地图选点

uniapp 配置chooseLocation微信小程序腾讯地图选点 场景 在uniapp中使用地图选点 搜索功能&#xff0c;回显功能&#xff0c;移动选点功能 使用到的API是uni.chooseLocation 详细看一下都有哪些属性 latitude &#xff1a;目标地纬度 Number longitude &#xff1a;目标地经度…

论文阅读: (CVPR2023 SDT )基于书写者风格和字符风格解耦的手写文字生成及源码对应

目录 引言SDT整体结构介绍代码与论文对应搭建模型部分数据集部分 总结 引言 许久不认真看论文了&#xff0c;这不赶紧捡起来。这也是自己看的第一篇用到Transformer结构的CV论文。之所以选择这篇文章来看&#xff0c;是考虑到之前做过手写字体生成的项目。这个工作可以用来合成…

浅析基于物联网技术的校园能耗智慧监控平台的设计及应用

摘 要&#xff1a;为打造低碳绿色校园&#xff0c;营造良好的学习环境&#xff0c;针对目前校园建筑能耗大&#xff0c;特别是空调节能困难等问题&#xff0c;特采用物联网技术构建校园建筑能耗智慧监控平台。通过设计空调监控子系统&#xff0c;搭建空调监控模型实现了空调等智…

在 Jetpack Compose 中使用 Snackbar

Jetpack Compose 是 Android 的现代 UI 工具库&#xff0c;提供了丰富的组件和功能来构建漂亮、交互丰富的用户界面。在本文中&#xff0c;我们将学习如何在 Jetpack Compose 中使用 Snackbar 组件来显示临时消息或操作反馈。 什么是 Snackbar&#xff1f; Snackbar 是一种用于…

基于Layui实现管理页面

基于Layui实现的后台管理页面&#xff08;仅前端&#xff09; 注&#xff1a;这是博主在帮朋友实现的一个简单的系统前端框架&#xff08;无后端&#xff09;&#xff0c;跟大家分享出来&#xff0c;可以直接将对应菜单跟html文件链接起来&#xff0c;页面使用标签页方式存在&…

面试了一个前阿里P7,Java八股文与架构核心知识简直背得炉火纯青

前几天&#xff0c;跟个老朋友吃饭&#xff0c;他最近想跳槽去大厂&#xff0c;觉得压力很大&#xff0c;问我能不能分享些所谓的经验套路。 每次有这类请求&#xff0c;都觉得有些有趣&#xff0c;不知道你发现没有大家身边真的有很多人不知道怎么面试&#xff0c;也不知道怎…

赛效:如何将PDF文件免费转换成Word文档

1&#xff1a;在网页上打开wdashi&#xff0c;默认进入PDF转Word页面&#xff0c;点击中间的上传文件图标。 2&#xff1a;将PDF文件添加上去之后&#xff0c;点击右下角的“开始转换”。 3&#xff1a;稍等片刻转换成功后&#xff0c;点击绿色的“立即下载”按钮&#xff0c;将…

win10修改IP地址报错:出现一个意外情况,不能完成所有你在......

问题描述 在修改网卡适配器的时候出现一下报错&#xff1a;出现一个意外情况&#xff0c;不能完成你在设置中所要求的更改 问题原因 该问题是由于我之前卸载VMware导致注册表出现问题。 解决方法 解决办法为:修复注册表(下载一个CCleaner下载试用版即可&#xff08;https…

2. 查询至少连续三天下单的用户

文章目录 题目需求思路一实现一思路二实现二 题目需求 查询订单信息表(order_info)中 最少连续3天 下单的用户id&#xff0c;期望结果如下&#xff1a; user_id101 订单信息表&#xff1a;order_info order_id(订单id)user_id(用户id)create_date (下单日期)total_amount(订…

MySQL 数据表修复方法

MySQL表检查与修复 — check/repair指令 目录 MySQL表检查与修复 --- check/repair指令1. 指令详解2. 操作方法&#xff1a;命令提示符(cmd指令)操作方法SQLyog 操作方法&#xff08;推荐&#xff09; 本文主要讲check table和repair table指令&#xff1b; 1. 指令详解 在检…

如何把图片转文字?图片转文字方法分享!​

如何把图片转文字呢&#xff1f;在我们日常的工作或者生活当中&#xff0c;总会遇到需要将图片中的文字提取出来整理出文档&#xff0c;比如同事领导给你发的文件&#xff0c;或者在自己看到了喜欢书的段落句子&#xff0c;想要摘抄下来&#xff0c;这些都是可以用图片转文字来…

C++ Vector容器使用方法详解

Vector概述 C 标准库向量类是序列容器的类模板。 向量以线性排列方式存储给定类型的元素&#xff0c;并允许快速随机访问任何元素。 向量是需要力求保证访问性能时的首选序列容器。vector是种容器&#xff0c;类似数组一样&#xff0c;但它的size可以动态改变。vector的元素在内…

【GESP】2023年06月图形化二级 -- 时间规划

文章目录 时间规划【题目描述】【输入描述】【输出描述】【参考答案】其他测试用例 时间规划 【题目描述】 默认小猫角色和白色背景&#xff0c;小明在为自己规划学习时间。现在他想知道两个时刻之间有多少分钟。你能通过编程帮他做到吗&#xff1f; 【输入描述】 新建变量“…

餐饮市场分析(上)

阅读原文 研究某一类餐饮产品的市场概况&#xff0c;并在不同地区和品牌之间进行对比 一、数据需求 使用美团搜索商品返回的数据。 首先进入美团首页&#xff0c;切换到对应城市&#xff0c;并搜索感兴趣的关键词。接下来尝试翻页获取更多数据&#xff0c;点击下一页时发现页…

跨越时空限制,酷暑天气用VR看房是一种什么体验?

近年来&#xff0c;全球厄尔尼诺现象越来越频繁&#xff0c;夏季温度不断创下新高&#xff0c;持续大范围的高温天气让人们对出门“望而生畏”。很多购房者也不愿意在如此酷暑期间&#xff0c;四处奔波看房&#xff0c;酷暑天气让带看房效率大大降低&#xff0c;更有新闻报道&a…

Linux:LAMP-phpmyadmin

LAMP环境 (1条消息) Linux&#xff1a;LAMP搭建(全源码包安装)_鲍海超-GNUBHCkalitarro的博客-CSDN博客 phpmyadminphpMyAdminhttps://www.phpmyadmin.net/ 传进Linux tar xfz phpMyAdmin-5.2.1-all-languages.tar.gz 这个是解出来的包 mv phpMyAdmin-5.2.1-all-languages /…

【NOSQL数据库】Redis数据库的配置与优化一

目录 一、关系型数据库与非关系型数据库1.1关系型数据库1.2非关系型数据库1.3关系型数据库与非关系型数据库的区别1.3.1数据存储方式不同1.3.2扩展方式不同1.3.3对事务性的支持不同 1.4非关系型数据库产生的背景1.5总结 二、Redis简介2.1Redis的优点2.2使用场景2.3哪些数据适合…

大二网页设计实训-豆瓣首页(html+css)

免费开源一个前端网页&#xff0c;豆瓣首页&#xff0c;可以用来当实训等

探索神奇的甲方需求:提出异常要求的背后逻辑

在IT行业&#xff0c;每个人都可能遇到“神奇的甲方”和他们提出的匪夷所思甚至无厘头的需求。虽然这些要求可能让人摸不着头脑&#xff0c;但背后通常隐藏着某种逻辑和需求。让我们来探索一下这些“无理需求”背后的心理和可能的应对策略。 首先&#xff0c;为什么会出现这些…