我正在使用VSCode来调试Python脚本.
按照本指南,我在launch.json文件中设置参数
但是,当我按下Debug时,它表示我的参数无法识别:
在VSCode使用时PowerShell,让我们使用相同的参数执行相同的文件:
所以:相同的文件,相同的路径,相同的参数.在终端正在工作,在VSCode中没有.
我哪里错了?
我正在遵循这个非常简单的指南,以便迈出进入 PyOpenGL 的第一步。
\n我安装了pip install PyOpenGL PyOpenGL_accelerate,一切都好。
我通过测试代码测试了安装:
\nimport OpenGL.GL\nimport OpenGL.GLUT\nimport OpenGL.GLU\nprint("导入成功!") # 如果您看到此信息打印到控制台,则安装成功
\n都好
\n我现在运行这个脚本:
\nfrom OpenGL.GL import *\nfrom OpenGL.GLUT import *\nfrom OpenGL.GLU import *\n\nw,h= 500,500\ndef square():\n glBegin(GL_QUADS)\n glVertex2f(100, 100)\n glVertex2f(200, 100)\n glVertex2f(200, 200)\n glVertex2f(100, 200)\n glEnd()\n\ndef iterate():\n glViewport(0, 0, 500, 500)\n glMatrixMode(GL_PROJECTION)\n glLoadIdentity()\n glOrtho(0.0, 500, 0.0, 500, 0.0, 1.0)\n glMatrixMode (GL_MODELVIEW)\n glLoadIdentity()\n\ndef showScreen():\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n glLoadIdentity()\n iterate()\n glColor3f(1.0, 0.0, 3.0)\n square()\n glutSwapBuffers()\n\nglutInit()\nglutInitDisplayMode(GLUT_RGBA)\nglutInitWindowSize(500, 500)\nglutInitWindowPosition(0, …Run Code Online (Sandbox Code Playgroud) python opengl pyopengl visual-c++ visual-studio-2017-build-tools
我设置了远程桌面连接,计算机说:AzureAD\username已经可以访问:
很好,让我们尝试使用连接AzureAD\username:
不幸的是它说:
您的凭据无效。远程机器已加入 AAD。如果您要登录工作帐户,请尝试使用您的工作电子邮件地址。
当然没有用。任何的想法?
windows remote-desktop remote-access microsoft-account azure-active-directory
我们最近被空降到一个新的 ETL 项目,该项目的代码非常糟糕。我手中有一个包含 700 行和各种更新的查询。
我想对其进行调试SET XACT_ABORT ON;,目标是如果只有一个事务失败则回滚所有内容。
但我找到了几种将其存档在 StackOverflow 上的方法,如下所示:
BEGIN TRANSACTION;
BEGIN TRY
-- Multiple sql statements goes here
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
END CATCH
Run Code Online (Sandbox Code Playgroud)
或这个:
BEGIN TRY
BEGIN TRANSACTION
-- Multiple sql statements goes here
COMMIT TRANSACTION
END TRY
BEGIN CATCH
PRINT(ERROR_MESSAGE())
ROLLBACK TRANSACTION
END CATCH
Run Code Online (Sandbox Code Playgroud)
而这些都没有用途SET XACT_ABORT ON;。
我不明白,和SET XACT_ABORT ON使用一样吗BEGIN TRY BEGIN TRANSACTION?
我可以只使用:
SET XACT_ABORT ON;
-- Multiple …Run Code Online (Sandbox Code Playgroud) 我需要为Python学生编写一些基本脚本,如下所示:
#!/usr/bin/python
# -*- coding: utf-8 -*-
mia_età = 31
print mia_età
Run Code Online (Sandbox Code Playgroud)
但显然我在声明变量时不能使用重音字符.有什么出路吗?
("mia_età"在意大利语中的意思是"my_age",我想避免他们在学习Python的同时用他们的语言编写语法错误)
我在 MacOS Catalina 上使用 VS Code 1.140.1,我需要比较两个文件。
比较有效,但当我尝试在比较时进行编辑时,我无法进行编辑,VS Code 提示:“无法在只读编辑器中进行编辑”。
这有点令人沮丧,因为其他 IDE(如 Notepad++)确实允许您在比较时进行编辑,这非常有用,因为它会显示两个文件何时相同。
有什么办法吗?
或者您建议将 VS Code 更换为其他 IDE?
It's not easy to use the official LinkedIn API and I cannot find a valid documentation.
Following the official documentation I created a new application in order to obtain the Client ID and Client Secret
When I now make a POST call through Postman to https://www.linkedin.com/oauth/v2/accessToken this is what I obtain:
{
"error": "invalid_grant_type",
"error_description": "The passed in grant_type is invalid"
}
Run Code Online (Sandbox Code Playgroud)
Where am I wrong?
EDIT AFTER HELP FROM @Amit Singh
Thanks to @AmitSingh I was able to create …
我从未见过如此简单的脚本如此失败:
$SQLServer = "localhost"
$cred = Get-Credential
invoke-sqlcmd -ServerInstance $SQLServer -Credential $cred -Query "select @@version"
Run Code Online (Sandbox Code Playgroud)
这句话说 -Credentials不被认可:
Invoke-Sqlcmd : A parameter cannot be found that matches parameter name 'Credential'.
Run Code Online (Sandbox Code Playgroud)
那么有什么意义Get-Credential呢?我在互联网上看到很多例子,他们都是这样使用的。
编辑示例:为什么此代码正在使用-Credential?因为-Credential在函数内部?
function Pause ($Message="Press any key to continue..."){
""
Write-Host $Message
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
function GetCompName{
$SQLServer = Read-Host "Please enter a computer name or IP"
CheckHost
}
function CheckHost{
$ping = gwmi Win32_PingStatus -filter "Address='$SQLServer'"
if($ping.StatusCode -eq 0){$pcip=$ping.ProtocolAddress; GetCollation}
else{Pause …Run Code Online (Sandbox Code Playgroud) 我已经在 14 个查询中吐出了Glenn Berry 的性能查询,但其中一个(第 9 个)不起作用。
这是我的 PowerShell 代码:
#Provide SQLServerName
$SQLServer ="localhost"
#Provide Database Name
$DatabaseName ="master"
#Prompt for user credentials
$credential = Get-Credential
$Query1= "-- 09 Index Sizes
-- Note: THIS IS SLOW as it reads index blocks. SAMPLED is not that high, but watch for prod I/O impact if using 'DETAILED'
SELECT DB_NAME() AS DatabaseName,
Object_name(i.object_id) AS TableName
,i.index_id, name AS IndexName
,i.type_desc
,ips.page_count, ips.compressed_page_count
,CAST(ips.avg_fragmentation_in_percent as DECIMAL(5,1)) [fragmentation_pct]
,CAST(ips.avg_page_space_used_in_percent as DECIMAL(5,1)) [page_space_used_pct]
,ips.index_depth, …Run Code Online (Sandbox Code Playgroud) 我试图自己找到解决方案,但现在我没有主意了。我编写了一个脚本,我想用它来检查机器上是否安装了 Erlang:
# Check if a Software ins installed
function Check_Program_Installed($programName) {
$x86_check = ((Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall") |
Get-ItemProperty |
Where-Object {$_.DisplayName -like "*$programName*" } |
Select-Object -Property DisplayName, UninstallString)
if(Test-Path 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall')
{
$x64_check = ((Get-ChildItem "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall") |
Get-ItemProperty |
Where-Object {$_.DisplayName -like "*$programName*" } |
Select-Object -Property DisplayName, UninstallString)
}
if ($x86_check -and $x64_check -eq $null){
write-host "$programName is not installed on this computer" -ForegroundColor Green
#continue
}
elseif ($x86_check -or $x64_check -ne $null){
write-host "On this computer is installed …Run Code Online (Sandbox Code Playgroud) powershell ×3
python ×3
sql-server ×3
automation ×1
compare ×1
diff ×1
get ×1
ide ×1
linkedin-api ×1
opengl ×1
postman ×1
pyopengl ×1
rest ×1
rollback ×1
scripting ×1
t-sql ×1
try-catch ×1
unicode ×1
visual-c++ ×1
visual-studio-2017-build-tools ×1
windows ×1
xact-abort ×1