根据微软文档,[BigInt]
数据类型似乎没有定义的最大值,理论上可以容纳无限大的数字,但我发现在第 28 位之后,一些奇怪的事情开始发生:
PS C:\Users\Neko> [BigInt]9999999999999999999999999999
9999999999999999999999999999
PS C:\Users\Neko> [BigInt]99999999999999999999999999999
99999999999999991433150857216
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,在第一个命令1 上,BigInt
按预期工作,但是还有一个数字,它转换99999999999999999999999999999
为的地方似乎发生了一些衰减,99999999999999991433150857216
但是,提示不会引发任何错误,您可以继续添加更多数字,直到第 310 个数字
PS C:\Users\Neko> [BigInt]99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
100000000000000001097906362944045541740492309677311846336810682903157585404911491537163328978494688899061249669721172515611590283743140088328307009198146046031271664502933027185697489699588559043338384466165001178426897626212945177628091195786707458122783970171784415105291802893207873272974885715430223118336
PS C:\Users\Neko\> [BigInt]999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
Run Code Online (Sandbox Code Playgroud)
这将抛出错误
At line:1 char:318
+ ... 999999999999999999999999999999999999999999999999999999999999999999999
+ ~
The numeric constant 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 is not valid.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : BadNumericConstant
Run Code Online (Sandbox Code Playgroud)
我认为这是一个控制台问题而不是一个BigInt
问题,因为错误没有提到[BigInt]
数据类型,不像其他数据类型的数字太大
PS C:\Users\Neko> [UInt64]18446744073709551615
18446744073709551615
PS C:\Users\Neko> [UInt64]18446744073709551616
Cannot convert value "18446744073709551616" to …
Run Code Online (Sandbox Code Playgroud) 为应用程序做组件。对于部分想要添加传递一些可选强调色以获得输出的功能,例如:
<section style="--mycolor:red">
... //contents
</section>
Run Code Online (Sandbox Code Playgroud)
其中“red”可以在页面构建期间作为颜色名称、#hex、“rgba()”或“hsla()”字符串传递到后端。它提供了将该颜色用于其子元素的机会section
- 用于边框颜色、第一个字母、标记、背景等。
简单代码^:
<section style={`--mycolor:{color}`};>
Run Code Online (Sandbox Code Playgroud)
不起作用,因为 next 需要可映射代码,但看起来 css 变量名称不能在内联语法中解析。我还可以用<style jsx>
语句注入它:
<style jsx>{`
section{
--mycolor: ${ color != '' ? color : 'var(--default-color)'};
}
`}
</style>
Run Code Online (Sandbox Code Playgroud)
但这个解决方案对于这样简单的任务来说看起来“肮脏”——添加了大量不必要的代码只是为了服务一个 CSS 规则。
我认为这可以通过类似的事情来实现
<section styles={myStyle}>
Run Code Online (Sandbox Code Playgroud)
其中 myStyle 是jsx样式对象,但我不明白如何手动创建它(在示例中,它是唯一导入的道具,没有详细信息从哪里获得)。
那么有没有办法实现像这样的简单输出<section style="--mycolor:red">
呢?
我真的很喜欢用 bash 编码,但 Windows 中的 bash 功能曾经有很多限制。虽然现在 bash Windows 用户比 Windows 10 之前有很多好处。但是,随着所有的改进,我觉得有一件事对我来说还有待改进。双击.sh
文件的默认行为在 Windows 中从未真正能够执行任何操作,.sh
文件扩展名甚至在设置的“按文件类型选择默认应用程序”部分中不可用。我希望能够更改.sh
文件的默认操作,但忽略了它并暂时摆脱了它,但这个链接终于给了我希望。
在 Ubuntu 终端和为 Linux 添加 Windows 子系统之前,如果没有虚拟机,确实无法访问 Windows 上的 bash 终端。现在,随着 Windows 终端的加入,它结合了 Microsoft Azure 终端、命令提示符、Powershell 和 Ubuntu,这对于像我这样的人来说真的很棒,但是尽管 Windows 新增了一些很棒的功能,允许将 Linux 终端进一步集成到 Windows 中,甚至能够C:
使用 Ubuntu编辑驱动器。
我确信有一种方法可以允许双击.sh
文件在 Windows 终端 Ubuntu 中打开,但我不知道如何操作。这个问题帮助我弄清楚了如何做到这一点,并帮助我将默认.bat
文件行为更改为 Windows 终端,但我仍然陷入了一个困境,我真正相信这是不可能的。所以,当我放弃时,这就是我要去的地方,Stack Overflow 的神奇之地:)
.sh
在那里找到它,也无法在正常设置的任何默认应用程序部分中找到它。.sh
,我查看了注册表并寻找HKEY_CLASSES_ROOT
并寻找sh
任何与HCR
单独相关的 …windows bash windows-10 windows-subsystem-for-linux windows-terminal
在powershell中,您可以使用以下方法创建函数function name {commands}
并使这些函数接受参数:
function myFunction {
param($var1, $var2)
}
Run Code Online (Sandbox Code Playgroud)
但你也可以用
function myFunction($var1, $var2) {}
Run Code Online (Sandbox Code Playgroud)
他们会是一样的。
例如,如果我创建了一个函数func1
:
function func1 {
param($var1, $var2)
echo "$var1 $var2"
}
Run Code Online (Sandbox Code Playgroud)
我会通过使用func1 1 2
where $var1
will be equal to1
和$var2
will be equal to 来调用它2
。
输入:
PS C:\Users\Neko> func1 1 2
Run Code Online (Sandbox Code Playgroud)
输出:
1 2
Run Code Online (Sandbox Code Playgroud)
但是,如果我做同样的事情,而是使用另一种将参数传递给函数的方法:
function func2($var1, $var2) {
echo "$var1 $var2"
}
Run Code Online (Sandbox Code Playgroud)
我也会以完全相同的方式调用它,通过使用func2 1 2
where$var1
将等于1
和$var2
等于2
前一个函数来调用它。 …
我正在玩通行证,并以这种方式配置我的 twitter 登录:
passport.use(new TwitterStrategy({
consumerKey: '*****',
consumerSecret: '*****',
callbackURL: "http://blabla/callback"
},
function(token, tokenSecret, profile, done) {
done(null, profile)
}
));
Run Code Online (Sandbox Code Playgroud)
我希望能够在运行时根据登录的用户配置以下值:(consumerKey, consumerSecret, callbackURL)。也就是说,每个用户都将拥有他们需要在 Twitter 上注册的 Twitter 应用程序。
有什么建议吗?
I was making a PowerShell script in Visual Studio Code that used the command Get-PSDrive
, and to my surprise, it seemed like while using VS Code, a new drive identical to my C:\
drive called Temp
appeared.
I was taken aback by this result as as far as I knew, I only had 2 other drives besides my main C:\
drive connected. I tried to replicate this on other terminals with no success except for PowerShell 7:
与这个问题相关。
cl.exe
我想在 Windows 上从 git bash运行。通常您需要开发人员提示才能执行此操作,因此我这样做:
cmd //V //K "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
Run Code Online (Sandbox Code Playgroud)
这会将开发者提示符作为子 shell 打开。如果我愿意的话,我可以从那里逃跑cl
。
但是,如果我可以从 git bash 运行命令而无需进入子 shell,那就太好了。我会很高兴:
以某种方式“ source
ing”文件VsDevCmd.bat
以导出它设置为环境中变量的变量,这样我就可以cl
从 bash 运行,或者
将 更改//K
为 a//C
并更改为当前(bash)工作目录,然后cl
使用转发的任何参数执行。如果它是别名,则奖励积分。
根本无法弄清楚#1。
我需要 #2 语法方面的帮助,因为 while
cmd //V //C "C:\Program Files (x86)\...\VsDevCmd.bat"
Run Code Online (Sandbox Code Playgroud)
工作的意思是它执行批处理脚本并立即退出,我不知道如何将多个命令链接在一起。跑步
cmd //V //C "C:\Program Files (x86)\...\VsDevCmd.bat & cl"
Run Code Online (Sandbox Code Playgroud)
例如,给出
'C:\Program' is not recognized as an internal or external command,
operable program or batch file. …
Run Code Online (Sandbox Code Playgroud) powershell ×3
bash ×2
.net-core ×1
batch-file ×1
bigint ×1
c# ×1
cmd ×1
express ×1
git-bash ×1
javascript ×1
next.js ×1
node.js ×1
passport.js ×1
windows ×1
windows-10 ×1