AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-809273

a.t.'s questions

Martin Hope
a.t.
Asked: 2022-02-03 03:33:03 +0800 CST

按下“CTRL+F”后,Notepad++ 搜索窗口不再关注“查找内容:”

  • 7

问题描述

在 Wine Notepad++ 安装中,我注意到我的 Notepad++ 安装不会自动将插入符号/光标放在菜单Find what:内的文本框中。Find

预期行为

我希望如果:

  1. 我将光标放在记事本++文件中的任意位置,没有选择任何内容。
  2. 按Ctrl+f
  3. a 键入它放在a前面的文本框内的字母: Find what:。(这样当我按下时,它开始在打开的文件中enter搜索下一个出现的位置。a

观察到的行为

按下 后打开搜索框Ctrl+f,当我输入:a没有任何反应。但是,当我按下 时f,它会短暂(几分之一秒)切换(右侧的灰色按钮,而不是搜索窗口中的选项卡)到:Mark all,如下面的屏幕截图所示: 在此处输入图像描述

怀疑

在我看来,按钮的行为f就像我的键盘有一个悬挂ctrl或alt按钮或其他可能导致我认为我正在发送f信号的东西,而实际上我可能正在发送类似Alt+f. 为了排除这种情况,我使用 注册了我的击键screenkey,这表明我按下ctrl+f和a(没有任何额外的击键)。

问题

我不清楚这是否是一个错误,我是否做错了什么,或者这是否是一个(新)功能。我想问:如何确保插入符号Find what:在按下后自动放置在搜索选项卡旁边的文本框中,以便Ctrl+f在我开始输入时将我的打字/击键输入到该文本框中?

软件:

Ubuntu:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:    21.10
Codename:   impish

葡萄酒:

wine-5.0.3 (Ubuntu 5.0.3-3ubuntu2)

记事本加加:

Notepad++ v8.2.1 (64-bit)

注意,我在干净的 Ubuntu 安装上安装了 Notepad++。此外,我已将其删除并重新安装了两次,但没有看到观察到的行为发生变化。

notepad++ search
  • 1 个回答
  • 446 Views
Martin Hope
a.t.
Asked: 2021-05-08 03:56:44 +0800 CST

如何在本地正确测试本地 DNS 服务器?

  • 9

语境

我打算使用 Technitium 设置本地 DNS 服务器,并希望验证本地 DNS 服务器在查询域时返回正确的响应。它在使用时不起作用nslookup mydomain.com。我希望这是因为本地 dns 服务器无法从公共/互联网位置访问。

为了排除这是由于我的本地 DNS 服务器(本地)无法正常工作引起的,我想验证至少本地 DNS 服务器在查询我的域时返回正确的 IP 地址。

尝试

本地 DNS 服务器127.0.0.1在端口的本地 IP 地址上运行,5379因此我尝试了以下命令及其各自的输出:

nslookup 127.0.0.1 somedomain.com
;; connection timed out; no servers could be reached

nslookup 127.0.0.1:5379 somedomain.com
nslookup: couldn't get address for 'somedomain.com': failure

nslookup http://127.0.0.1:5379 somedomain.com
;; connection timed out; no servers could be reached

nslookup https://127.0.0.1:5379 somedomain.com
;; connection timed out; no servers could be reached

所以要么测试命令nslookup 127.0.0.1:5379 somedomain.com是一种可能的方式来测试本地DNS服务器在查询某个域时是否返回正确的IP地址,而我没有正确设置本地DNS服务器,或者我使用了不正确的测试命令。

问题

如何测试本地 DNS 服务器的响应在查询域时是否返回正确的 IP 地址(从托管 DNS 服务器的设备)?

networking dns
  • 4 个回答
  • 9566 Views
Martin Hope
a.t.
Asked: 2020-07-17 07:45:26 +0800 CST

从 powershell 安装无人值守的 WSL Ubuntu 18.04

  • 6

设想

为了使用 powershell 自动安装和初始化 WSL Ubuntu 18.04,我正在尝试自动初始化/设置第一个用户名和密码。但是,当我第一次从 powershell 命令运行 wsl 时,powershell 会转到 wsl 的 shell,等待用户手动输入密码。

MWE

在 wsl 初始化后,我进行了五次不同的尝试,将用户名、密码(和密码)通过管道传递到输入提示符,这些都包含在以下 MWE 中。

##############Required for MWE###################
# Enable wsl subsystems for linux (if powershell is ran in admin mode)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

# Set Tls12 protocol to be able to download the wsl application
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# check to see if ubuntu1804 installation file exists and download the app otherwise
$fileToCheck = "Ubuntu1804.appx"
if (Test-Path $fileToCheck -PathType leaf) 
{"File does Exist"}
else
{Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu1804.appx -UseBasicParsing}

# Actually install the wsl ubuntu 18.04 app
Add-AppxPackage .\Ubuntu1804.appx
Write-Output "Installed the ubuntu18.04"

# backup installation command if the first command did not function properly
invoke-expression -Command "Add-AppxPackage .\Ubuntu1804.appx"
Write-Output "Installed the ubuntu with backup attempt"


##############Actual attempts to initialize ubuntu without prompting for user input###################
Write-Host "Trying to initialize ubuntu"
# Attempt 0: makes it start installing the wsl but hangs prompting user name
#Write-Host "wsl whoami" 
# Attempt 0 conclusion: Starts installing the wsl but then waits on user input

# Attempt 0.1: So would like to pipe a "password | password | username | whoami" in there but that does not work.
#Write-Host "wsl 'somepassword | somepassword | someusername | whoami'"
#Write-Host "wsl somepassword | somepassword | someusername | whoami" 
# Attempt 0.1 conclusion: doesn't work, still dives into the wsl shell and waits on user input


# Attempt 1: does not make it start installing
#$output = bash -c "wsl whoami"
#$output = bash -c "wsl 'somepassword | somepassword | someusername | whoami'" 
# Attempt 1 conclusion: Does not work, requires a user input to start installing (e.g. arrow down) (and then waits on user input).


# Attempt 2: try to prevent the prompt for username by setting default user to root immediatly

# Attempt 2.1: First define path to the installed ubuntu1804.exe
$str1="/Users/"
$str2="/AppData/Local/Microsoft/WindowsApps/ubuntu1804"
$hdd_name=(Get-WmiObject Win32_OperatingSystem).SystemDrive
$username=$env:UserName
[String] $ubuntu1804_path=$hdd_name+$str1+$username+$str2

# Attempt 2.2: Create command to set root as default user
$str1=" config --default-user root"
$set_user=$ubuntu1804_path+$str1

# Attempt 2.3: Create command to set root as default user and execute it
#invoke-expression -Command $set_user 
# Attempt 2.3 conclusion: Doesn't work still asks for username and waits on user input


# Attempt 3: passing a username, password, and password again as one is prompted at the startup
$strA = "test | test | root"
#$output = bash "-c" $strA
# Attempt 3 conclusion: Doesn't work, requires user input to go to the next line (e.g. arrow down)

# Attempt 4: let root be default username
$str1=" install --root"
$set_user=$ubuntu1804_path+$str1
# Attempt 4 conclusion: Doesn't work, requires user input to go to the next line (e.g. arrow down)
invoke-expression -Command $set_user 
# Attempt 4 conclusion: Pending.

Write-Host "Done with setup."

在没有用户干预的情况下,尝试 0、1、2 和 3 均未成功自动初始化 WSL Ubuntu 18.04。尝试的问题写在评论的结论中。归根结底,wsl一旦激活就开始安装/初始化,然后在powershell窗口中等待用户输入,而无需在其中传递命令的其余部分。

问题:

如何从 powershell 执行 WSL Ubuntu 18.04 的无人值守安装和初始化?

假设

我事先知道 Powershell 中变量中的用户名和密码。

powershell ubuntu
  • 2 个回答
  • 1206 Views
Martin Hope
a.t.
Asked: 2019-12-08 03:34:13 +0800 CST

如何将新行从 libreoffice calc 复制到 txt?

  • 6

我在单元格'B2'一个 libreoffice calc 文档中具有以下功能:

=CONCAT(A1,CHAR(10),A2,CHAR(10),"end")

其中,在单元格中A1="function plotName = getPlotName(plotData)"并按A2=" plotName = obj.plotName;"预期显示:

function plotName = getPlotName(plotData)
    plotName = obj.plotName;
end

在一个单元格中。但是,当我复制该单元格时,通过单击它选择它,按 ctrl+c,打开 notepadd++ 并按 ctrl+v,不会复制换行符。

如果我复制文本,粘贴特殊>文本,然后在记事本++中复制粘贴,它确实复制了输入。因此我想制作一个额外的单元格,C2=TEXT(B2)但返回错误 511。

如何确保换行符实际上被复制到例如记事本++?

LibreOffice Calc 版本:6.3.2.2 (x64) Notepad++ V7.8.1 Windows 10

notepad++ libreoffice
  • 1 个回答
  • 252 Views
Martin Hope
a.t.
Asked: 2019-10-19 12:40:42 +0800 CST

在个人公共 DNS 服务器中使用公共主机名

  • 4

设想

我在 Windows 10 Pro N pc 上有一个带有(例如)公共 ip 的小型网站:123.456.78 如果我从网站打开的任何地方输入该 ip。

现在我还购买了 2 个域名,例如www.somewebsiteOne.com,www.somewebsiteTwo.org在 2 个不同的域名卖家处。并依赖于转发www.somewebsiteTwo.ddns.net到的 dns 服务123.456.78。在域名卖家中,我可以转发www.somewebsiteTwo.org到www.somewebsiteTwo.ddns.net. 我的目的是用我使用 Technitium 的自托管开源 DNS 服务器替换对 DNS 服务器的依赖。

为了验证我自己的 DNS 服务器是否正常工作,我:

  1. 在不同网络的不同计算机上打开 powershell。
  2. 输入:nslookup www.somewebsiteTwo.org 123.456.78
  3. 这确实返回了 ip 地址 123.456.78

问题

现在,如果我尝试在两个域名卖家中的任何一个中输入该 DNS 服务器的 IP 地址,我需要输入:

  • 主机名
  • IP地址

我可以在哪里输入主机名www.somewebsiteTwo.ddns.net(这是一个转发www.somewebsiteTwo.org到123.456.78 和用于 ip 地址的 dns 服务器123.456.78。在使用两者之一调用后,我被解释为他们使用主机名而不是 IP 地址来查找我的个人公共 DNS服务器,而不是 IP 地址。

这实质上意味着我需要一个 dns 服务器将我的个人公共 dns 服务器的一些主机名转发到我的 dns 服务器的 ip 地址。这违背了我的意图。因此我有以下内容:

问题

如何确定和使用指向我的个人公共 dns 服务器的有效主机名123.456.78?

尝试

  • 我试图输入我的电脑的主机名,例如在 cmd at command 中返回的内容hostname。但这不被视为有效的主机名。
  • 我尝试输入123.456.78,但这不被视为有效的主机名。
  • 我试图进入http://123.456.78/,但它不起作用。
  • ip 地址不能作为引用 DNS 服务器的主机名,因为:

用于 DNS 服务器以及注册和使用 DNS(子)域时的主机名必须是有效的完全限定的 DNS 主机名,例如 ns1.example.com。或 customer-5363.dsl-users.isp.example.net 。该协议不允许 IP 地址。如果您想使用 ns1.example.com 等 DNS 记录来注册域 example.com,您的注册商需要先设置正确的粘合记录

dns ip
  • 2 个回答
  • 786 Views
Martin Hope
a.t.
Asked: 2019-08-26 07:27:24 +0800 CST

如何在 Visual Studio Code for Powershell 中生成 setter 和 getter?

  • 6

(如何)在脚本中使用 IDE Visual Studio Code(版本 1.37.1+)时,在对象中创建字段/变量后,如何自动生成对象字段/getters变量?setters<filename>.ps1

powershell visual-studio-code
  • 1 个回答
  • 1708 Views
Martin Hope
a.t.
Asked: 2019-07-26 00:58:16 +0800 CST

如何从 Windows 10 设置 `WSL` 密码?

  • 8

设想

使用以下命令自动为 Linux Ubuntu 16.04 安装 Windows 子系统的全新安装后:

lxrun /install /y
lxrun /setdefaultuser exampleUsername /y

使用用户名安装新安装:exampleUsername。接下来,如果要执行具有sudo特权的命令,例如 yes | sudo apt update,将提示输入exampleUsername两次密码。

问题

如何使用具有密码的脚本从 Windows 10 设置该用户密码?

尝试

  1. 使用以下内容创建密码更改 powershell.ps1文件:
wsl passwd
wsl testPassword
wsl testPassword

但这在执行时仍然会手动提示输入密码:

PS C:\twInstall> ./pw.ps1 更改 exampleUser 的密码。(当前)UNIX 密码:

  1. 尝试将密码两次传递给 passwd 命令,pw.ps1内容如下:
wsl testPassword testPassword | passwd

返回错误:

passwd : 术语“passwd”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。在 C:\twInstall\pw.ps1:1 字符:25

  • wsl 测试测试测试测试 | 密码
  •                     ~~~~~~
    
    • 类别信息:ObjectNotFound:(密码:字符串)[],CommandNotFoundException
    • 完全限定错误 ID:CommandNotFoundException

评论反馈适配

目前,脚本在 Windows 10 Pro N 64 位(桌面)、版本 1709、内部版本 16299.192 和WSL Ubuntu 16.04.2 LTS.

  1. 根据@harrymc 建议的答案:

3.1 首先用命令设置默认用户为root:

lxrun /setdefaultuser root /y

3.2 然后使用命令创建另一个用户(通过将其设置为默认用户):

lxrun /setdefaultuser testuser /y

3.3 以该用户身份运行命令,以防需要在 wsl 中初始化任何内容以创建用户:

wsl echo "hello world"

3.4 使用命令切换回root用户:

lxrun /setdefaultuser root /y

3.5 然后设置passwd文件的路径(人工检查发现在:/etc/passwdhence:

wsl set path /etc/passwd

3.6 然后用命令修改非root用户的密码:

wsl echo 'testusername:newpasswd' | chpasswd

返回:

'chpasswd' 不是内部或外部命令,也不是可运行的程序或批处理文件。

3.7 重试 sudo 出现同样的错误:

wsl sudo echo 'testusername:newpasswd' | chpasswd

回报:

'chpasswd' 不是内部或外部命令,也不是可运行的程序或批处理文件。

3.8 由于有人担心 wsl Ubuntu 16.04.2 LTS 是否具有 chpassword 的功能,我后来在 wsl 中手动尝试了它,命令没有抛出任何错误:

echo 'testusername:newpasswd' | chpasswd

3.9 显然在转换时发生错误:

echo 'testusername:newpasswd' | chpasswd

至:

wsl echo 'testusername:newpasswd' | chpasswd

我怀疑这是由于从 cmd 或 powershell 运行 wsl 命令时管道工作方式出错所致。

windows-10 passwords
  • 2 个回答
  • 4695 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve