作为谷歌驱动程序用户(使用我的Gmail帐户),我想将我上传的文件的所有权转让给其他用户(使用他们的Gmail帐户).
我发现了这个方便的工具:https://github.com/davidstrauss/google-drive-recursive-ownership,它会调用此方法:
service.permissions().update(fileId=drive_item['id'],
permissionId=permission_id, body=permission, transferOwnership=True).execute()
Run Code Online (Sandbox Code Playgroud)
我已验证fileId是否正确,permission_id是否正确,以及作为正文传入的权限对象.
代码似乎很好,它对谷歌驱动器"本机"文件(如谷歌文档和电子表格)运行良好.
但是当针对上传的PDF运行时,会发生以下错误:
<HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/0Bxz4bvKt4QekTWlUUHg0XzUydTa/permissions/18055737357773114524
?transferOwnership=true&alt=json returned "Insufficient permissions for this file">
Run Code Online (Sandbox Code Playgroud)
为什么改变"原生"谷歌云端硬盘文件的所有权任何想法,使用"更新"的方法,但改变上传文件的所有权(如PDF和docx文件)时不正常工作?
我们怎样才能让 MS JDBC 驱动程序在 n 秒后抛出超时错误?
背景
我们有一个应用程序,默认情况下使用 Microsoft JDBC 驱动程序(版本 4.0)来查询 SQL Server 2014。
大多数时候,查询需要 10-20 秒才能完成。然而,有时查询需要超过 5 分钟才能完成。
我们希望应用程序将耗时超过 5 分钟的查询视为错误。目前该应用程序不提供超时设置,因此我们只能研究 MS JDBC 驱动程序的超时设置,但我找不到任何东西来标记长时间运行的查询有超时错误。
我找到了 jTDS 驱动程序的超时设置(socketTimeout)。
MS 驱动程序是否有等效的“socketTimeout”或“queryTimeout”?我已尝试以下所有方法,但均不适用于 MS 驱动程序:
#None of these enforce a timeout with the MS Driver
jdbc:sqlserver://hostname\instanceName;databaseName=mydb;queryTimeout=10
jdbc:sqlserver://hostname\instanceName;databaseName=mydb;socketTimeout=10
jdbc:sqlserver://hostname\instanceName;databaseName=mydb;queryTimeout=10
#This works great with the jTDS driver:
jdbc:sqlserver://hostname\instanceName;databaseName=mydb;socketTimeout=10
Run Code Online (Sandbox Code Playgroud) 有没有办法访问传递给我的函数的单元格的单元格坐标(以 A1 表示法)?
例如,如果我的功能是这样的
function displayA1Notation(myCell){
return myCell.getA1Notation();
}
Run Code Online (Sandbox Code Playgroud)
我将以下内容放入单元格 B4 中:
=displayA1Notation(C6)
Run Code Online (Sandbox Code Playgroud)
我希望看到这个:
C6
Run Code Online (Sandbox Code Playgroud)
但我实际看到的是这样的:
Kansas
Run Code Online (Sandbox Code Playgroud)
(“Kansas”是C6的实际单元格值)
我知道这看起来很容易......我只是努力让它发挥作用。
谢谢~!
如何在我的用 powershell 编写的 Azure 函数中的 run.ps1 文件中引用其他 powershell 函数?
细节:
我有 25 个私有的“助手”函数,我编写了这些函数来帮助操作数据、哈希表,并且通常使我可以更轻松地在 powershell 中编写脚本。我一直在更改和添加这些函数的功能,我更喜欢将它们组合在一个lib文件夹中,然后在我的 Azure Function 冷启动时导入。
我可以通过在我的 run.ps1 文件顶部包含我的“帮助程序”函数来完成所有这些工作(我不想这样做,因为这感觉很笨拙并且不允许我将每个函数分开到它自己的文件中)。
如何通过将我的所有函数分离到它们自己的文件中然后源/导入它们来使其工作?
我试过像这样设置我的文件夹结构:
FunctionApp
| - host.json
| - profile.ps1
| - lib
| | - helperfunction1.ps1
| | - helperfunction2.ps1
| | - helperfunction3.ps1
... (etc)
| - myFunction
| | - function.json
| | - run.ps1
Run Code Online (Sandbox Code Playgroud)
我在我的 profile.ps1 文件中使用此代码导入每个函数:
$functionFiles = Get-ChildItem -Path "$PSScriptRoot\lib" -Filter *.ps1
Write-Information "Loading scripts"
foreach($file in $functionFiles){
Write-Information "Sourcing $($file.FullName)"
. …Run Code Online (Sandbox Code Playgroud)