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
  • 1. 說明 /* Performs operations on System.String instances that contain file or directory path information. These operations are performed in a cross-pla ...
  • 視頻地址:【WebApi+Vue3從0到1搭建《許可權管理系統》系列視頻:搭建JWT系統鑒權-嗶哩嗶哩】 https://b23.tv/R6cOcDO qq群:801913255 一、在appsettings.json中設置鑒權屬性 /*jwt鑒權*/ "JwtSetting": { "Issuer" ...
  • 引言 集成測試可在包含應用支持基礎結構(如資料庫、文件系統和網路)的級別上確保應用組件功能正常。 ASP.NET Core 通過將單元測試框架與測試 Web 主機和記憶體中測試伺服器結合使用來支持集成測試。 簡介 集成測試與單元測試相比,能夠在更廣泛的級別上評估應用的組件,確認多個組件一起工作以生成預 ...
  • 在.NET Emit編程中,我們探討了運算操作指令的重要性和應用。這些指令包括各種數學運算、位操作和比較操作,能夠在動態生成的代碼中實現對數據的處理和操作。通過這些指令,開發人員可以靈活地進行算術運算、邏輯運算和比較操作,從而實現各種複雜的演算法和邏輯......本篇之後,將進入第七部分:實戰項目 ...
  • 前言 多表頭表格是一個常見的業務需求,然而WPF中卻沒有預設實現這個功能,得益於WPF強大的控制項模板設計,我們可以通過修改控制項模板的方式自己實現它。 一、需求分析 下圖為一個典型的統計表格,統計1-12月的數據。 此時我們有一個需求,需要將月份按季度劃分,以便能夠直觀地看到季度統計數據,以下為該需求 ...
  • 如何將 ASP.NET Core MVC 項目的視圖分離到另一個項目 在當下這個年代 SPA 已是主流,人們早已忘記了 MVC 以及 Razor 的故事。但是在某些場景下 SSR 還是有意想不到效果。比如某些靜態頁面,比如追求首屏載入速度的時候。最近在項目中回歸傳統效果還是不錯。 有的時候我們希望將 ...
  • System.AggregateException: 發生一個或多個錯誤。 > Microsoft.WebTools.Shared.Exceptions.WebToolsException: 生成失敗。檢查輸出視窗瞭解更多詳細信息。 內部異常堆棧跟蹤的結尾 > (內部異常 #0) Microsoft ...
  • 引言 在上一章節我們實戰了在Asp.Net Core中的項目實戰,這一章節講解一下如何測試Asp.Net Core的中間件。 TestServer 還記得我們在集成測試中提供的TestServer嗎? TestServer 是由 Microsoft.AspNetCore.TestHost 包提供的。 ...
  • 在發現結果為真的WHEN子句時,CASE表達式的真假值判斷會終止,剩餘的WHEN子句會被忽略: CASE WHEN col_1 IN ('a', 'b') THEN '第一' WHEN col_1 IN ('a') THEN '第二' ELSE '其他' END 註意: 統一各分支返回的數據類型. ...
  • 在C#編程世界中,語法的精妙之處往往體現在那些看似微小卻極具影響力的符號與結構之中。其中,“_ =” 這一組合突然出現還真不知道什麼意思。本文將深入剖析“_ =” 的含義、工作原理及其在實際編程中的廣泛應用,揭示其作為C#語法奇兵的重要角色。 一、下劃線 _:神秘的棄元符號 下劃線 _ 在C#中並非 ...