[最佳实践] Windows上构建一个和Linux类似的Terminal

news2024/11/24 18:50:35

感谢大佬批评指正,现已更新

preview

Target:致力打造最赏心悦目Window下的终端,同时能够很接近Linux的使用习惯
key word:windows终端美化 windows terminal windows powershell 类似Linux下的Window终端 Window也能用ll windows terminal一键直连ssh

目的是在Windows上构建一个和Linux类似的Terminal,让Windows炼丹和Linux一样舒适,同是让Terminal取代Xshell完成远程链接。
预览如下图。按照教程,你也可以实现下面的效果。

image.png

image.png
在Linux下我们使用zsh和oh-my-zsh结合,Windows下我们使用powershell7和oh-my-posh结合,并将结果显示在Window Terminal上。
前提是机器已经安装了ssh、sshd、conda、git

安装Window Terminal

如果已经安装好Window Terminal,或者本身就是win11系统_[系统自带Window Terminal]_,就请跳过本步骤。

这里是Window Terminal官网下载链接
或者Window Store中直接搜索terminal ,就会出现。个人建议安装预览版。
image.png

安装powershell7

从这里https://github.com/PowerShell/PowerShell/releases下载绿色版(避免重装系统消失),放置到D:\Program Files\PowerShell-7.4.1-win-x64目录下
image.png
并这个文件夹里面创建一个 Profile.ps1文件。pwsh启动会先执行这个文件。这里讲解了pwsh启动时,执行profile的顺序。内容后面会提及,先新建一个空白文件。
image.png

设置环境变量

PSHOME=D:\Program Files\PowerShell-7.4.1-win-x64\
# 将这些env加入path

这样才能命令行启动

参考命令
$PROFILE | Select-Object * # 查看PROFILE的位置
Test-Path -Path $PROFILE.AllUsersAllHosts # 测试脚本存在
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser # 解除严格模式
set-ExecutionPolicy RemoteSigned # 解除严格模式

Install-Module -Name PowerShellGet -Force # 安装get模块
Get-InstalledModule # 获取已经安装的模块

安装oh-my-posh

打开Window Terminal,将pwsh7添加到Window Terminal中,
image.png
然后打开一个pwsh窗口,执行以下命令,安装posh-git、oh-my-posh、ZLocation…

Install-Module posh-git -Scope CurrentUser # posh-git
Install-Module oh-my-posh -Scope CurrentUser -RequiredVersion 2.0.496 # oh-my-posh
Install-Module ZLocation -Scope CurrentUser # ZLocation (opens new window)和 autojump 差不多效果。快速 cd 到历史去过的目录。

安装字体

oh-my-posh font install # 需要管理员权限的终端)
# 如果总是有 各种字体问题。我建议直接使用JetBrainsMono Nerd Font

这里是把字体安装在操作系统中,如果发现Terminal中字体还是不正确,原因是Terminal中的字体没有调整,建议直接在这里https://www.nerdfonts.com/font-downloads下载。我推荐使用’JetBrainsMono Nerd Font’。原因是图形齐全,字体简洁。
image.png

编辑profile

这里类似于Linux上的.zshrc的文件。

Linux上的zsh和这里的powershell7一样,都是shell程序。所以这里的$PROFILE就是在shell启动时前运行的脚本配置文件。

还记的前面让你在程序工作目录下创建的Profile.ps1文件吗,他就会每一次pwsh图像展示前先运行的脚本。

在pwsh7运行

$PROFILE | Select-Object *

image.png
这里就是显示的所有的配置文件和默认的位置,当然他可以是不存在的。这个列表从上到下,显示pwsh运行前,脚本的执行顺序。当然看名字也能猜出来,它其实还有用户和实例区分的,这里就先不管那么多。红色框起来的就是我们今天需要编辑的profile

AllUsersAllHosts文件编辑

这个文件就程序工作目录下创建的Profile.ps1文件了。$PSHOME 就可以查看程序所在的绝对路径。
这里我们主要是来为所有用户激活一下conda环境,毕竟这个是炼丹刚需。

$global:profiles = "$PSHOME\Profile.ps1"
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
(& "D:\ProgramData\Anaconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion
CurrentUserCurrentHost文件编辑

这个文件就是su、ll、vim等常见工具的设定、还有oh-my-posh的主题等设置

# sudo命令
function _sudo {
    $ss = "$args ; pause"
    Start-Process wt -Verb runAs -ArgumentList $ss
}

Function _su {
Start-Process -verb runas "wt"
}

# setup alias 设置命令的别名
set-alias -name sudo -value _sudo
Set-Alias ll ls
Set-Alias su _su
Set-Alias vi "D:\Program Files\vim\vim91\vim.exe"
Set-Alias vim "D:\Program Files\vim\vim91\vim.exe"

#oh-my-posh init
Import-Module posh-git # 引入 posh-git
Import-Module oh-my-posh # 引入 oh-my-posh

Set-Theme PowerlinePlus # 设置主题为 Paradox, Emodipt, Honukai ,PowerlinePlus ,qwerty ,Sorin ,Zash 
Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录 
Set-PSReadlineKeyHandler -Key Tab -Function Complete # 设置 Tab 键补全
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录

快捷美化

Window Terminal的json文件

这里的json可以直接控制Windows Terminal的显示,还是十分友好的。
就在这里image.png

"backgroundImage": "E:\\VSWallPaper\\VS\u80cc\u666f\u4f7f\u7528.png",
"backgroundImageAlignment": "bottomRight",
"backgroundImageOpacity": 0.73,
"backgroundImageStretchMode": "none",

这里就是背景图显示的设置,请自行修改。背景我放在下文中,请自行获取到本地,以便于让自己每天有个好心情。**[**都看到这里了,**别忘了点赞啊] **……
这里是我个人的Window Terminal的json文件,其中很多是绝对路径,如果要使用请先修改。如背景图,pwsh的启动路径等等…

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema-preview",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": false,
    "defaultProfile": "{51a1d3c2-4ee8-4a49-b09b-0e4f8c4cf2bd}",
    "newTabMenu": 
    [
        {
            "type": "remainingProfiles"
        }
    ],
    "profiles": 
    {
        "defaults": 
        {
            "backgroundImage": "E:\\VSWallPaper\\VS\u80cc\u666f\u4f7f\u7528.png",
            "backgroundImageAlignment": "bottomRight",
            "backgroundImageOpacity": 0.73,
            "backgroundImageStretchMode": "none",
            "colorScheme": "Solarized Dark",
            "elevate": false,
            "font": 
            {
                "face": "JetBrainsMono Nerd Font"
            },
            "suppressApplicationTitle": true
        },
        "list": 
        [
            {
                "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "hidden": false,
                "name": "Windows PowerShell"
            },
            {
                "commandline": "%SystemRoot%\\System32\\cmd.exe",
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "\u547d\u4ee4\u63d0\u793a\u7b26"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "automatic",
                "colorScheme": "Solarized Dark",
                "commandline": "%pwsh7%\\pwsh.exe",
                "cursorShape": "bar",
                "font": 
                {
                    "face": "JetBrainsMonoNL Nerd Font Propo",
                    "size": 12.0
                },
                "guid": "{51a1d3c2-4ee8-4a49-b09b-0e4f8c4cf2bd}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "pwsh7",
                "padding": "8, 8, 8, 8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "tabTitle": "pwsh",
                "useAcrylic": false
            },
            {
                "guid": "{2a9350cf-37b9-5bfa-b5b3-564b3864eb96}",
                "hidden": false,
                "name": "Developer Command Prompt for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "guid": "{19d39df3-1eed-58d6-a707-099b09917476}",
                "hidden": false,
                "name": "Developer PowerShell for VS 2019",
                "source": "Windows.Terminal.VisualStudio"
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "automatic",
                "colorScheme": "Solarized Dark",
                "commandline": "%pwsh7%\\pwsh.exe -ExecutionPolicy ByPass -NoExit -Command \"ssh icml@fr1p -p 36166\"",
                "cursorShape": "bar",
                "font": 
                {
                    "face": "Cascadia Code",
                    "size": 12.0
                },
                "guid": "{f92f3e12-e2ac-4cd9-b054-8a5e56b1446b}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "online_DELL_FrpcSakura",
                "padding": "8, 8, 8, 8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "tabTitle": "online_DELL_FrpcSakura",
                "useAcrylic": false
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "automatic",
                "colorScheme": "Solarized Dark",
                "commandline": "%pwsh7%\\pwsh.exe -ExecutionPolicy ByPass -NoExit -Command \"ssh icml@ganzhou-eb7c5293c01.shop -p 53919\"",
                "cursorShape": "bar",
                "font": 
                {
                    "face": "Cascadia Code",
                    "size": 12.0
                },
                "guid": "{d2e40cc6-4b49-48dd-851c-29a6917059bc}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "online_DELL_FrpcOpen",
                "padding": "8, 8, 8, 8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "tabTitle": "online_DELL_FrpcOpen",
                "useAcrylic": false
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "automatic",
                "colorScheme": "Solarized Dark",
                "commandline": "%pwsh7%\\pwsh.exe -ExecutionPolicy ByPass -NoExit -Command \"ssh grozta@fr1bus.top -p 36777\"",
                "cursorShape": "bar",
                "font": 
                {
                    "face": "Cascadia Code",
                    "size": 12.0
                },
                "guid": "{ba0d2d74-61aa-4754-9097-a483ad39c491}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "online_ONDA_FrpcSakura",
                "padding": "8, 8, 8, 8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "tabTitle": "online_ONDA_FrpcSakura",
                "useAcrylic": false
            },
            {
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "automatic",
                "colorScheme": "Solarized Dark",
                "commandline": "%pwsh7%\\pwsh.exe -ExecutionPolicy ByPass -NoExit -Command \"ssh grozta@ga17c59a5.of-7af93c01.shop -p 53215\"",
                "cursorShape": "bar",
                "font": 
                {
                    "face": "Cascadia Code",
                    "size": 12.0
                },
                "guid": "{42e91b42-dcb1-466c-b6e6-8e8276c437b2}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "online_ONDA_FrpcOpen",
                "padding": "8, 8, 8, 8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "tabTitle": "online_ONDA_FrpcOpen",
                "useAcrylic": false
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#4F525D",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#073642",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#555753",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ],
    "themes": [],
    "windowingBehavior": "useAnyExisting"
}

Window Terminal上的背景图
VS背景使用.png
**[**都看到这里了,**别忘了点赞啊] **

最终预览

image.png

Terminal中进行ssh快捷登录,从而代替Xshell

思路

想要在Terminal中实现ssh快捷链接,就是需要再pwsh中引导ssh工作,也就是说只要把启动命令中加入ssh登录语句就可以实现在Terminal中进行ssh,从而代替Xshell

ssh grozta@192.168.199.128 就是我们通常使用的ssh登录语句

在conda的启动快捷方式中,它的启动命令是

pwsh.exe -ExecutionPolicy ByPass -NoExit -Command "&'D:\code\miniconda\shell\condabin\conda-hook'"

所以我们想要快速启动ssh进行远程链接,只需要把-Command 后的参数替换成ssh登录语句就可以了

方法

因此我们只需要新建一个配置文件,要从前面的我们pwsh配置中复制一份,命令行修改为
%PSHOME%\pwsh.exe -ExecutionPolicy ByPass -NoExit -Command "ssh grozta@192.168.199.128"
image.png
这里的配置,在上述的Windows Terminal的json文件中有具体的写入,保证一定能用。

预览

然后我们开启新的标签,输入密码
image.png

参考

打造好用的PowerShell媲美oh-my-zsh | Exploring
给 PowerShell 带来 zsh 的体验
Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher 单独的字体下载给Terminal
Windows Terminal 终端个性化设置指南_windows terminal配色-CSDN博客

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

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

相关文章

让Excel 365 Excel 2021快速转化为生产力,创造价值!

文章目录 每日一句正能量前言关键点内容简介作者简介读者赞誉后记购买链接赠书活动 每日一句正能量 人的一生,好不好只有自己知道,乐不乐只有自己明白。快乐是一种心情,一种自然、积极向上的心态。在平凡之中寻求快乐,在磨难之中寻…

AI智能伪原创工具:原创文章自动生成的革新

随着人工智能技术的迅猛发展,AI智能伪原创工具正逐渐改变着我们的日常生活和工作方式。其中,原创文章自动生成技术的出现,为内容创作者、企业和学术界带来了全新的可能性和便利。这项技术的引入不仅提高了内容创作的效率,还为用户…

【查找算法】插值查找

一:插值查找 代码公式:int mid left (right - left) * (findVal - arr[left]) / (arr[right] - arr[left]); 1.1 基本概念 插值查找,有序表的一种查找方式。插值查找是根据查找关键字与查找表中最大最小记录关键字比较后的查找方法。插值…

什么样的跨网数据交换产品 能实现数据摆渡和数据同步?

首先,为什么会产生跨网数据摆渡的需求和场景呢?那是因为做了网络隔离,企业进行网络隔离的原因主要包括以下几点: 1、提高安全性:网络隔离是防止未授权访问和网络攻击的有效手段。通过将网络划分为多个独立的子网&…

Docker 快速入门实操教程(完结)

Docker 快速入门实操教程(完结) Docker,启动! 如果安装好Docker不知道怎么使用,不理解各个名词的概念,不太了解各个功能的用途,这篇文章应该会对你有帮助。 前置条件:已经安装Doc…

flutter 使用webview

背景: 一般都有使用webview加载网页的需求,比如加载隐私协议、用户协议等。 如何做: 当然,我们自己不用封装轮子,在pub.dev上有成熟的轮子:webview_flutter 首先,将依赖导入,在pub…

Appium系列(1)安装启动Appium

Appium环境准备 Mac电脑jdk环境AndroidSDK环境node>8.1.0(最好用最新版本) 安装命令 npm i -g appium安装不成功请检查node 版本是否正确 安装成功命令行输入appium回车查看 安装驱动程序 1、先检查当前驱动情况 通过 appium driver list 进行…

鸿蒙Harmony应用开发—ArkTS声明式开发(基础手势:PinchGesture)

用于触发捏合手势,触发捏合手势的最少手指为2指,最大为5指,最小识别距离为5vp。 说明: 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 接口 PinchGesture(value?: { finge…

刷题笔记day27-回溯算法3

39. 组合总和 var path []int var tmp []int var result [][]int// 还是需要去重复,题目中要求的是至少一个数字备选的数量不同。 // 所以需要剪枝操作,右边的要比左边的> func combinationSum(candidates []int, target int) [][]int {// 组合问题pa…

淘宝下单接口的解析|跨境电商中淘宝代购功能实现的API接口接入详解【附代码实例】

淘宝接口解析是指通过淘宝提供的API(Application Programming Interface)来实现程序与淘宝平台的数据交互和功能调用。通过淘宝接口,用户可以实现商品信息获取、订单管理、物流跟踪等功能。 在使用淘宝接口前,首先需要注册成为阿…

在 SpringBoot3 中使用 Mybatis-Plus 报错

在 SpringBoot3 中使用 Mybatis-Plus 报错 Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required Caused by: java.lang.IllegalArgumentException: Property sqlSessionFactory or sqlSessionTemplate are requiredat org.springframework.util.Assert.no…

Sora:AI视频模型的无限可能与挑战

随着人工智能技术的突飞猛进,AI视频模型已成为科技领域的新焦点。OpenAI推出的AI视频模型Sora,凭借其卓越的技术性能和前瞻性,为AI视频领域的发展揭开了新的篇章。本文将从技术解析、应用场景、未来展望、伦理与创意以及用户体验与互动五个方…

内存溢出(OOM)-汇总指南

目录 java.lang.OutOfMemoryError:Java heap space 原因分析 示例 解决方案 java.lang.OutOfMemoryError:GC overhead limit exceeded 原因分析 示例 解决方案 java.lang.OutOfMemoryError:Permgen space 原因分析 示例 解决方案 java.lang.OutOfMemoryError:Metas…

【Apple Vision Pro应用源码】Vision Pro吸尘器项目源代码

超级有趣Vision Pro 应用 吸尘器项目 这是一个非常有趣的 Vision Pro项目,会让孩子们爱上打扫卫生。 在这里我展示了如何使用 ARKit:头部跟踪、手部跟踪、场景理解加载和播放声音进程冲突使用 MTLBuffers 处理底层网格数据 项目源代码:Git…

vue3中的生命周期有哪些和怎么使用?

目录 前言: 正文: 总结: 前言: Vue.js 3是Vue.js框架的最新主要版本,引入了一些重大的改变和增强。在Vue 3中,由于Composition API的引入,生命周期钩子被替换为生命周期函数。 正文: 以下是…

Claude3 AI系列重磅推出:引领多模态智能时代的前沿技术,超越GPT-4

Claude3正式发布:号称性能超 GPT-4,免费使用、支持中文 划重点: 🚀 Claude3系列发布,包括Haiku、Sonnet和Opus版本,Opus在多个领域超越GPT-4。 🌐 用户可免费使用Claude3Sonnet模型,支持中文&am…

PostgreSQL开发与实战(6)体系结构1

作者:太阳 一、进程结构 PG数据库启动时会先启动一个主进程(9.3之前称为postmaster,9.3以后称为postgres server process),然后fork出一些辅助子进程(backend、backgroud相关进程),…

Go-知识简短变量声明

Go-知识简短变量声明 1. 简短变量声明符2. 简短变量赋值可能会重新声明3. 简短变量赋值不能用于函数外部4. 简短变量赋值作用域问题5. 总结 githuio地址:https://a18792721831.github.io/ 1. 简短变量声明符 在Go语言中,可以使用关键字var或直接使用简短…

2024新鲜出炉阿里巴巴面试真题,如果不想35岁被淘汰这篇文章必看

最近看到群里看到一个女生,讲述了她从开始选择Android,经过非常努力的学习和挣扎,然而最后面对当前的环境却不得不放弃。看完以后真的非常替她感觉惋惜,如果早几年入行可能结果会比现在好很多,但可惜,这就是…

Thinkphp5.1中,将数组赋值给js使用

一、例如Thinkphp5.1中的的代码是这样的 $data [status > 1,msg > 加载成功,data > [id > 1,username > 小洪帽,] ];$this->assign(data,$data);二、JS代码接收PHP中的数组 注意 <> 符号是不需要放引号的。 let arr <?json_encode($data)?>…