AutoWare.auto 與ROS2 親測安裝成功

来源:https://www.cnblogs.com/helong-123/archive/2022/05/20/16292446.html
-Advertisement-
Play Games

鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站 AutoWare.auto 安裝實踐 1. 相關程式版本說明 ubuntu版本:20.04 ADE:4.4.0 Autoware.auto版本(基於ROS2):autoware.auto foxy, ros foxy 2. Docker安裝 以下 ...


鏡像下載、功能變數名稱解析、時間同步請點擊 阿裡雲開源鏡像站

AutoWare.auto 安裝實踐

1. 相關程式版本說明

ubuntu版本:20.04 ADE:4.4.0

Autoware.auto版本(基於ROS2):autoware.auto foxy, ros foxy

2. Docker安裝

以下操作,請確定自己已經換源了,不然下載很慢的,參考Ubuntu20.04軟體源更換 - 知乎

Ubuntu系統中,軟體源文件地址為:/etc/apt/sources.list

1.備份原來的源,將以前的源備份一下,以防以後可以用的。

$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2.打開/etc/apt/sources.list文件,在前面添加如下條目,並保存。

$ sudo vim /etc/apt/sources.list(可將vim更換為自己熟悉的編輯器)

添加阿裡源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

3.更新

更新源

$ sudo apt-get update

如出現依賴問題,解決方式如下:

$ sudo apt-get -f install

更新軟體:

$ sudo apt-get upgrade

官方安裝教程:Install Docker Engine on Ubuntu | Docker Documentation

// 卸載舊版本docker

#Uninstall old versions
$ sudo apt-get remove docker docker-engine docker.io containerd runc

#Uninstall Docker Engine
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io
$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /var/lib/containerd

// 使用docker repository安裝docker engine

#step1:在新主機上首次安裝Docker Engine之前,需要設置Docker存儲庫。之後,您可以從存儲庫安裝和更新Docker
#更新apt軟體包索引並安裝軟體包,以允許apt通過HTTPS使用存儲庫
$ sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

#Step2:Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

#Step3:Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below. Learn about nightly and test channels.
$ echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  
#Step4:Install Docker Engine
$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io //如果沒有指定版本,預設安裝最高版本

#Step5:Verify that Docker Engine is installed correctly by running the hello-world image.
$ sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

Manage Docker as a non-root user

# 創建docker用戶組
$ sudo groupadd docker
#將當前用戶加入docker用戶組
$ sudo usermod -aG docker $USER
#Log out and log back in so that your group membership is re-evaluated.
$ newgrp docker 
#Verify that you can run docker commands without sudo.
$ docker run hello-world

$ sudo chmod 666 /var/run/docker.sock
#重啟電腦或者重啟docker服務
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ sudo docker login registry.gitlab.com # Use token from Gitlab

3. Autoware.auto容器安裝

3.1 程式說明

基於Docker封裝的開發容器,包含以下內容:

file

3.2 ADE安裝

ADE 是模塊化的 Docker-based 工具,它確保所有的開發者構建項目時有一個共同的、一致的開發環境

官網安裝文檔:Installation — ADE 4.4.0dev documentation

#install it in “/usr/local/bin” PATH
$ cd  /usr/local/bin 
$ sudo wget https://gitlab.com/ApexAI/ade-cli/-/jobs/1859684348/artifacts/raw/dist/ade+x86_64
$ sudo mv ade+x86_64 ade
$ sudo chmod +x ade
$ which ade
/path/to/ade
# 查看ade版本號
$ ade --version
<version>
# Update ade
$ sudo ./ade update-cli     #這個地方需要一段時間
Newer version available:
  4.4.0
  4.3.0
  4.2.0
Do you want to update to version 4.4.0 [y/N]: y
​
<!-- '註意:升級ade版本可能會報錯 “PermissionError: [Errno 13] Permission denied: '/usr/local/bin/ade'”,切換root用戶再次執行,問題解決'->

3.3 Autoware容器安裝

官網安裝文檔:Installation with ADE

  1. 使用ADE安裝Autoware.auto環境,ROS2和Autoware.auto已經預編譯,安裝了二進位版本,預設安裝在/opt目錄下
$ mkdir -p ~/adehome
$ cd ~/adehome
$ touch .adehome
$ git clone https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto.git
'註意:不要使用官網視頻課程裡面的遞歸迴圈安裝,編譯會報錯' 
'git clone --recurse-submodules https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto.git'

$ cd AutowareAuto

#拉取一些其他分支到master
$ vcs import < autoware.auto.$ROS_DISTRO.repos

#切換到發佈分支,如果不切換,預設使用master 分支代碼,可能包含一些正在開發的功能,建議切換穩定發佈版本
$ git checkout tags/1.0.0 -b release-1.0.0

#共用環境變數
$ cd ~
$ mv ~/.bashrc ~/adehome/.bashrc
$ ln -s ~/adehome/.bashrc

$ cd ~/adehome/AutowareAuto
#其實,有很多預先配置好的ADE環境供我們選擇,官網提供了三個ADE配置文件:AMD64/ARM64/AMD64+LGSVL
$ ls -l .aderc*

lrwxrwxrwx 1 wtcl wtcl  17 12月 23 12:14 .aderc -> .aderc-amd64-foxy
-rw-rw-r-- 1 wtcl wtcl 407 12月 23 12:25 .aderc-amd64-dashing
-rw-rw-r-- 1 wtcl wtcl 499 12月 23 12:25 .aderc-amd64-dashing-lgsvl
-rw-rw-r-- 1 wtcl wtcl 401 12月 23 12:25 .aderc-amd64-foxy
-rw-rw-r-- 1 wtcl wtcl 490 12月 23 12:25 .aderc-amd64-foxy-lgsvl
lrwxrwxrwx 1 wtcl wtcl  17 12月 23 12:14 .aderc-arm64 -> .aderc-arm64-foxy
-rw-rw-r-- 1 wtcl wtcl 407 12月 23 12:25 .aderc-arm64-dashing
-rw-rw-r-- 1 wtcl wtcl 401 12月 23 12:25 .aderc-arm64-foxy
lrwxrwxrwx 1 wtcl wtcl  23 12月 23 12:14 .aderc-lgsvl -> .aderc-amd64-foxy-lgsvl

#可以看到有好幾種可選的環境,其中.aderc-lgsvl對應的環境中包含LGSVL模擬器。然後,可以通過如下命令,切換併進入相應的ADE環境:
#二選一安裝,這個地方安裝有點慢,需要等待一會,ade --rc 命令可以載入並啟動相關的鏡像容器
$ ade --rc .aderc-amd64-foxy  start --update --enter

<!-- '註意:啟動ade報錯 
“Starting ade with the following images:
ade-foxy    | ec7293d289ad | master | registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/ade-foxy:master   
binary-foxy | 9ffc6c658b7a | master | registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/binary-foxy:master
ade_registry.gitlab.com_autowarefoundation_autoware.auto_autowareauto_amd64_binary-foxy_master
xhost:  unable to open display "localhost:10.0"
WARNING: Could not find xhost, you won't be able to launch X applications"
解決辦法:設置本地顯示命令-- $ export DISPLAY=localhost:10.0 $ xhost +>

#What is where inside ADE?
ade$ls /opt
AutowareAuto # image: binary-foxy:master
lgsvl        # image: ade-lgsvl/foxy:2020.06
ros          # image: ade-foxy:master

ade安裝過程中可能需要訪問gitlab的令牌,需要登錄gitlab申請

In one terminal, source the setup file and then run a C++ talker:

ade$ ade enter
ade$ source ~/AutowareAuto/install/setup.bash
ade$ ros2 run demo_nodes_cpp talker
In another terminal source the setup file and then run a Python listener:

ade$ cd ~/AutowareAuto
ade$ source ~/AutowareAuto/install/setup.bash
ade$ ros2 run demo_nodes_py listener
You should see the talker saying that it’s Publishing messages and the listener saying I heard those messages. This verifies both the C++ and Python APIs are working properly. Hooray!

#docker容器 清理無用鏡像,捲
$ cd ~/adehome/AutowareAuto
$ ade start

#To assess the disk usage situation, run the following command:
$ docker system df

#Use docker system prune to remove any Docker items not used for currently running containers:
$ docker system prune -a --volumes

#Restart your system after installing the new NVIDIA driver.
ade$ exit
$ ade stop
$ ade start --update --enter

安裝完成後運行

ade $ros2 run demo_nodes_cpp talker 不工作,沒辦法,繼續使用源碼進行編譯安裝

issue回覆:colcon build failed on trajectory.hpp file not found (#67) · Issues · ApexAI / AutowareClass2020 · GitLab

  1. 使用源碼編譯安裝Autoware.auto 和 ROS2

Autoware.auto官網安裝文檔:Installation w/o ADE

ROS2官網安裝文檔:Building ROS 2 on Ubuntu Linux — ROS 2 Documentation: Foxy documentation

#如果安裝了舊版本,先卸載
$ sudo apt-get purge ros-foxy*
$ sudo rm -rf /etc/ros
$ sudo gedit ~/.bashrc
刪除那個東西bash
$ source ~/.bashrc
​
#安裝編譯工具包
#Apt packages
$ sudo apt install -y git cmake python3-pip
​
#Python modules
$ pip3 install -U colcon-common-extensions vcstool
​
#First, the ROS 2 core components and tools must be installed
​
#安裝ROS2核心包
​
#設置語言環境,確保語言環境支持UTF-8
$ locale  # check for UTF-8
​
#只檢查是否有可用更新,給出彙總報告和提示信息
$ sudo apt update
​
#查看可升級的軟體的全部版本信息
$ sudo apt list --upgradable -a
$ sudo apt install locales
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ locale  # verify settings
​
#確保ros2倉庫可用
$ apt-cache policy | grep universe
​
#如果不可用,執行下麵命令
$ sudo apt install software-properties-common
$ sudo add-apt-repository universe
​
#需要在系統中添加ROS 2 apt存儲庫。為此,請首先使用如下所示的apt授權GPG密鑰:
#Now add the ROS 2 apt repository to your system. First authorize our GPG key with apt.
$ sudo apt update
$ sudo apt install curl gnupg lsb-release
$ sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
​
#然後將存儲庫添加到源列表中 
#Then add the repository to your sources list.
$  echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
​
#Install development tools and ROS tools
sudo apt update && sudo apt install -y \
  build-essential \
  cmake \
  git \
  python3-colcon-common-extensions \
  python3-flake8 \
  python3-pip \
  python3-pytest-cov \
  python3-rosdep \
  python3-setuptools \
  python3-vcstool \
  wget
# install some pip packages needed for testing
python3 -m pip install -U \
  flake8-blind-except \
  flake8-builtins \
  flake8-class-newline \
  flake8-comprehensions \
  flake8-deprecated \
  flake8-docstrings \
  flake8-import-order \
  flake8-quotes \
  pytest-repeat \
  pytest-rerunfailures \
  pytest
  
# install Fast-RTPS dependencies
sudo apt install --no-install-recommends -y \
  libasio-dev \
  libtinyxml2-dev
# install Cyclone DDS dependencies
sudo apt install --no-install-recommends -y \
  libcunit1-dev
​
# Get ROS 2 code 
# ROS2源碼下載,Install ROS 2 packages 
$ mkdir -p ~/ros2_foxy/src
$ cd ~/ros2_foxy
$ wget https://raw.githubusercontent.com/ros2/ros2/foxy/ros2.repos
$ vcs import src < ros2.repos
​
#Install dependencies using rosdep
$ sudo apt update
$ sudo rm -rf /etc/ros/rosdep/sources.list.d/20-default.list
$ sudo rosdep init
$ rosdep update
$ rosdep install --from-paths src --reinstall --ignore-src -y --rosdistro=foxy --skip-keys "fastcdr rti-connext-dds-5.3.1 urdfdom_headers"
$ rosdep check --from-paths src --ignore-src -y --skip-keys "fastcdr  rti-connext-dds-5.3.1 urdfdom_headers"
​
'Note: If you’re using a distribution that is based on Ubuntu (like Linux Mint) but does not identify itself as such, you’ll get an error message like Unsupported OS [mint]. In this case append --os=ubuntu:focal to the above command.'
#rti-dds可以單獨安裝
#https://docs.ros.org/en/foxy/Installation/DDS-Implementations.html
​
#工作空間編譯源碼安裝
#檢查ROS環境變數,確保沒有使用“source /opt/ros/${ROS_DISTRO}/setup.bash”設置過環境變數
$ printenv | grep -i ROS  #如果顯示空,後面編譯會有問題
PWD=/pathto/ros2_foxy
$ cd ~/ros2_foxy/
$ colcon build --symlink-install
$ colcon test
$ colcon test-result --verbose
​
​
#Demo test,In one terminal, source the setup file and then run a C++ talker:
$ source ~/ros2_foxy/install/setup.bash
$ ros2 run demo_nodes_cpp talker
​
#In another terminal source the setup file and then run a Python listener:
$ source ~/ros2_foxy/install/setup.bash
$ ros2 run demo_nodes_py listener
​
=================================================以上是ROS2 源碼安裝,下麵是安裝Autoware.auto源碼安裝  =============================
​
$ export ROS_DISTRO = foxy
$ echo $ROS_DISTRO
​
#ROS2安裝完成後, 設置環境變數
$ source ~/ros2_foxy/install/setup.bash
​
#將ROS環境變數添加到bashrc文件裡面
$ echo "source ~/ros2_foxy/install/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
​
# Autoware.Auto project requires some ROS 2 packages in addition to the core components. The tool rosdep allows an automatic search and installation of such dependencies.
$ sudo apt update
$ sudo apt install -y python3-rosdep
$ sudo rosdep init
$ rosdep update
​
#安裝Autoware.Auto依賴的ROS2的其它包,rosdep會自動搜索安裝
$ mkdir -p ~/adehome
$ cd ~/adehome
$ touch .adehome
$ git clone https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto.git
$ cd AutowareAuto
$ vcs import < autoware.auto.$ROS_DISTRO.repos
$ export ROS_VERSION=2
​
#rosdep 一次安裝src下所有依賴
$ rosdep install --reinstall -y -i --from-paths src
​
// 這一步可有可不有。
//目的是切換想要安裝的autoware版本,如果不切換master將使用最新分支
#Checkout the latest release by checking out the corresponding tag or release branch.
$ git checkout tags/1.0.0 -b release-1.0.0
​
# If running tests or demos, also pull binary files with
$ git lfs pull --exclude="" --include="*"
​
#共用環境變數
$ cd ~
$ mv ~/.bashrc ~/adehome/.bashrc
$ ln -s ~/adehome/.bashrc
​
#打開一個乾凈的ade容器進行編譯
$ ade stop
$ sudo ade update-cli
$ ade --rc .aderc-amd64-foxy-lgsvl start --update --enter
ade$ cd AutowareAuto
ade$ rm -rf build/ install/ log/
​
#To build all packages in Autoware.Auto, navigate into the AutowareAuto directory and run
ade$ colcon build
ade$ colcon test
ade$ colcon test-result --verbose
上述步驟中,第二步命令可以拉取一些其他分支到master,補充一些文件。我開始沒有執行這個命令,

導致在執行colcon build,出現無法找到文件

autoware_auto_msgs/msg/trajectory.hpp的錯誤。

如果colcon 不起作用,配置colcon 環境變數

Take the defaults file that comes with the Autoware.Auto source checkout and add it to your shell startup;

echo COLCON_DEFAULTS_FILE

$ echo "export COLCON_DEFAULTS_FILE=/path/to/AutowareAuto/tools/ade_image/colcon-defaults.yaml" >> .bashrc

或者手工導入

$ export COLCON_DEFAULTS_FILE=/path/to/AutowareAuto/tools/ade_image/colcon-defaults.yaml

編譯完一定要source:

$ source /opt/AutowareAuto/setup.bash
或

$ source ~/AutowareAuto/install/setup.bash

------使用一個乾凈的ADE環境------

我們可能遇到的很多問題都是由於代碼版本、舊的編譯文件存在等導致,所以需要更新ade和docker容器,以及清理一些舊的build等文件,可以通過以下操作完成:

$ ade stop
$ sudo ade update-cli
$ ade start --update --enter
ade$ cd AutowareAuto
ade$ rm -rf build/ install/ log/ src/external/
ade$ git pull
ade$ vcs import < autoware.auto.$ROS_DISTRO.repos

------ADE環境的使用------

  • 執行ade命令(如ade start、ade enter等)時,要確保當前命令行在路徑

~/adehome/AutowareAuto 中;

  • 開啟ADE環境:

$ ade start

  • 進入ADE環境(此時,會輸出一些鏡像信息):

$ ade enter

  • 所有的鏡像掛在在/opt下麵,可以查看:

ade$ ls /opt

  • 退出並停止ADE環境(使用完最好手動停止ADE環境,以關閉Docker):

ade$ exit

$ ade stop

------安裝過程中可能會出現少包,版本不相容問題,可以使用下麵命令排查------

#查找所有已安裝的軟體包
$dpkg -l——查看所有已安裝的軟體包
​
#清除所以刪除包的殘餘配置文件
$dpkg -l |grep ^rc|awk ‘{print $2}’ |tr [”"n”] [” “]|sudo xargs dpkg -P -
​
#查看需卸載的軟體包
$dpkg -l |grep 軟體名
​
#clean 命令刪除所有的軟體安裝包。
$ sudo apt-get clean
​
#autoclean 命令刪除不再可用的軟體安裝包。
$ sudo apt-get autoclean
​
#remove 命令移除 以及任何依賴這個包的其它包
$sudo apt-get remove 軟體名
​
#用purge 命令清除式卸載
$apt-get purge  <pakage_name>
​
#autoremove 命令刪除不再需要的依賴軟體包。
$ sudo apt-get autoremove
​
#install 命令下載軟體包,以及所有依賴的包,同時進行包的安裝或升級
$ apt-get install 軟體名  
#libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.4 is to be installed
$ sudo apt install libc6=2.31-0ubuntu9.2 libc-bin=2.31-0ubuntu9.2
​
#reinstall 命令重新安裝軟體包。
$ apt-get --reinstall install softname1
​
#升級來自 Debian 鏡像的包列表,如果你想安裝當天的任何軟體,至少每天運行一次,而且每次修改了
$ sudo apt-get update
​
#升級所有已經安裝的包為最新可用版本。不會安裝新的或移除老的包。建議同時使用 '-u' 選項,因為這樣你就能看到哪些包將會被升級
$ apt-get upgrade -u
​
#apt-get upgrade 類似,除了 dist-upgrade 會安裝和移除包來滿足依賴關係。因此具有一定的危險性
$ apt-get dist-upgrade -u
​
#在軟體包名稱和描述中,搜索包含xxx的軟體包
$ apt-cache search
​
#顯示某個軟體包的完整的描述
$apt-cache show
​
#Dpkg方式安裝軟體源
$ dpkg -i package_name.deb
​
#移除式卸載:
$dpkg -r pkg1 pkg2 ...
​
#清除式卸載:
$dpkg -P pkg1 pkg2..
​
#將刪除相關軟體,同時刪除該軟體的配置文件
$ dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -p
​
#重新安裝已安裝的包
$ dpkg -l | grep ^ii | awk '{print $2}' | xargs sudo apt-get reinstall

3.4 Autoware.auto 相機車道線檢測demo 展示

1. 代碼及錄製視頻下載

代碼下載

$ cd ~/adehome/AutowareAuto/
$ ade start
$ ade enter
$ git clone https://gitee.com/knowmefly/camera-hands-on-ws.git

視頻下載:https://download.csdn.net/download/jiluonian/22771297 下載 laneVideo.h264 視頻文件放置在 ~/adehome/camera-hands-on-ws/src/lane_detection_data_loader/resources/ 目錄下

2. 編譯安裝

$ ade enter
$ cd camera-hands-on-ws/
$ rm -rf build/ install/ log/
$ colcon build
'可能找不到opencv,安裝opencv庫'
$sudo apt install libopencv-dev python3-opencv

3.運行視頻載入、圖像處理、可視化節點

  • 運行視頻載入節點
# terminal 1
$ ade enter
$ cd  camera-hands-on-ws/
$ source install/setup.bash
$ ros2 run lane_detection_data_loader lane_detection_data_loader_node
  • 運行圖像處理節點
# terminal 2
$ ade enter
$ cd  camera-hands-on-ws/
$ source install/setup.bash
$ ros2 run lane_detection_projection lane_detection_projection_node
  • 運行可視化節點
# terminal 3
$ ade enter
$ cd  camera-hands-on-ws/
$ source install/setup.bash
$ ros2 run lane_detection_visualization lane_detection_visualization_node
# terminal 4
$ ade enter
$ export QT_DEBUG_PLUGINS=1
$ export DISPLAY=:0.0
$ rviz2
  • 運行rviz2報錯
'qt.qpa.xcb: could not connect to display localhost:10.0
'qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
'This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

'Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

'Aborted (core dumped)''

解決辦法:

載入插件跟蹤

$ export QT_DEBUG_PLUGINS=1

$ export DISPLAY=:0.0

在vi /etc/profile內添加export DISPLAY=xserverip:0.0 執行source /etc/profile 第二步:然後ssh終端安裝xorg並使用xclock測試能否回傳圖像:

apt-get install xorg

xclock

執行後桌面會跳出一個時鐘的圖案

file

本文轉自:https://blog.csdn.net/baiyefenglin/article/details/122921360


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 來源:zhihu.com/question/23084473 今天我們聊一個不常見的 Java 面試題:為什麼資料庫連接池不採用 IO 多路復用? 這是一個非常好的問題。IO多路復用被視為是非常好的性能助力器。但是一般我們在使用 DB 時,還是經常性採用c3p0,tomcat connection ...
  • 二刷jdbc 作者小結:從第一次大概幾天快速刷完jdbc,到如今的二刷,才發現自己對jdbc的理解有點太淺。到學習javaweb是創建資料庫層時的迷茫,到現在對這種設計模式的理解。我深有體會到了:實打實走好每一步的必要性!這篇筆記較為完整的展示了jdbc的發展脈絡,從原理到手動封裝,再到第三方庫,循 ...
  • #Redis簡介 Redis(Remote Dictionary Server)是完全開源的、遵守BSD協議的、高性能的Key-Value資料庫。 Redis與其他Key-Value緩存產品有一下三個特點: Redis支持數據的持久化,可以將記憶體中的數據保存在磁碟中,重啟的時候可以再次載入進行使用。 ...
  • 前言 很多人一談到 MSBuild,腦子裡就會出現 “XML”、“只能用 VS 的屬性框圖形界面操作”、“可定製性和擴展性差” 和 “性能低” 等印象,但實際上這些除了 “XML” 之外完全都是刻板印象:這些人用著 Visual Studio 提供的圖形界面,就完全不願意花個幾分鐘時間翻翻文檔去理解 ...
  • 在Word中添加著重號,即強調符號,可以在選中字元後,滑鼠右鍵點擊,選擇“字體”,在視窗中可直接選擇“著重號”添加到文字,用以對重要文字內容起加強提醒的目的,如下圖: 通過C#,我們可以查找到需要添加著重號的字元串,然後通過字元串格式的屬性值來添加符號。下麵,將對此做詳細介紹。 【引入dll】 方法 ...
  • 新創建的 asp.net mvc web api 項目後直接部署到 IIS 中,然後通過另外功能變數名稱 Ajax 跨功能變數名稱調用一個POST介面,並且請求頭headers中增加 Content-Type:application/json,根據阮一峰的文章《跨域資源共用 CORS 詳解》可知道這個非簡單請求會先... ...
  • tmux在連接遠程伺服器做實驗時很有幫助,可以為每一個項目設置一個Session,在Session中設置不同的Window同時跑多個實驗,Window本身還可以分割為多個Pane,在一個視野內利用多個Pane可以更方便地地做對比實驗,或者一邊實驗同時能監視系統的顯存占用,進程信息等狀態。 tmux採 ...
  • 1、修改主機名 方法一# hostname 主機名 ##臨時修改主機名 方法二#vim /etc/hostname ##修改hostname文件重啟系統生效 將localhost.localdomain改為自定的主機名 2、設置sudo給用戶 # vim /etc/sudoers ##編輯sudoe ...
一周排行
    -Advertisement-
    Play Games
  • Dapr Outbox 是1.12中的功能。 本文只介紹Dapr Outbox 執行流程,Dapr Outbox基本用法請閱讀官方文檔 。本文中appID=order-processor,topic=orders 本文前提知識:熟悉Dapr狀態管理、Dapr發佈訂閱和Outbox 模式。 Outbo ...
  • 引言 在前幾章我們深度講解了單元測試和集成測試的基礎知識,這一章我們來講解一下代碼覆蓋率,代碼覆蓋率是單元測試運行的度量值,覆蓋率通常以百分比表示,用於衡量代碼被測試覆蓋的程度,幫助開發人員評估測試用例的質量和代碼的健壯性。常見的覆蓋率包括語句覆蓋率(Line Coverage)、分支覆蓋率(Bra ...
  • 前言 本文介紹瞭如何使用S7.NET庫實現對西門子PLC DB塊數據的讀寫,記錄了使用電腦模擬,模擬PLC,自至完成測試的詳細流程,並重點介紹了在這個過程中的易錯點,供參考。 用到的軟體: 1.Windows環境下鏈路層網路訪問的行業標準工具(WinPcap_4_1_3.exe)下載鏈接:http ...
  • 從依賴倒置原則(Dependency Inversion Principle, DIP)到控制反轉(Inversion of Control, IoC)再到依賴註入(Dependency Injection, DI)的演進過程,我們可以理解為一種逐步抽象和解耦的設計思想。這種思想在C#等面向對象的編 ...
  • 關於Python中的私有屬性和私有方法 Python對於類的成員沒有嚴格的訪問控制限制,這與其他面相對對象語言有區別。關於私有屬性和私有方法,有如下要點: 1、通常我們約定,兩個下劃線開頭的屬性是私有的(private)。其他為公共的(public); 2、類內部可以訪問私有屬性(方法); 3、類外 ...
  • C++ 訪問說明符 訪問說明符是 C++ 中控制類成員(屬性和方法)可訪問性的關鍵字。它們用於封裝類數據並保護其免受意外修改或濫用。 三種訪問說明符: public:允許從類外部的任何地方訪問成員。 private:僅允許在類內部訪問成員。 protected:允許在類內部及其派生類中訪問成員。 示 ...
  • 寫這個隨筆說一下C++的static_cast和dynamic_cast用在子類與父類的指針轉換時的一些事宜。首先,【static_cast,dynamic_cast】【父類指針,子類指針】,兩兩一組,共有4種組合:用 static_cast 父類轉子類、用 static_cast 子類轉父類、使用 ...
  • /******************************************************************************************************** * * * 設計雙向鏈表的介面 * * * * Copyright (c) 2023-2 ...
  • 相信接觸過spring做開發的小伙伴們一定使用過@ComponentScan註解 @ComponentScan("com.wangm.lifecycle") public class AppConfig { } @ComponentScan指定basePackage,將包下的類按照一定規則註冊成Be ...
  • 操作系統 :CentOS 7.6_x64 opensips版本: 2.4.9 python版本:2.7.5 python作為腳本語言,使用起來很方便,查了下opensips的文檔,支持使用python腳本寫邏輯代碼。今天整理下CentOS7環境下opensips2.4.9的python模塊筆記及使用 ...