小编LOS*_*OST的帖子

有没有办法在Windows中通过进程找出和/或限制GPU使用?

我想在某些机器上启动CPU和GPU密集型进程,但这些进程不得干扰用户的任务.所以我需要限制或至少检测我的进程的GPU使用情况.这些进程是封闭源代码,因此我无法从内部观察GPU使用情况.

windows gpu gpgpu process cpu-usage

11
推荐指数
1
解决办法
1万
查看次数

如何使IdentityServer将用户身份添加到访问令牌?

简短:我的客户端从IdentityServer示例服务器检索访问令牌,然后将其传递给我的WebApi.在我的控制器中,this.HttpContext.User.GetUserId()返回null(尽管用户有其他声明).我怀疑访问令牌中没有nameidentity声明.如何让IdentityServer包含它?

到目前为止我尝试过的:

  • 从混合切换到隐式流(随机尝试)
  • 在我添加的IdSvrHost范围定义中

    Claims = {new ScopeClaim(ClaimTypes.NameIdentifier,alwaysInclude:true)}

  • 在我添加的IdSvrHost客户端定义中

    Claims = {new Claim(ClaimTypes.NameIdentifier,"42")}

(也是随机尝试)

我还尝试了范围定义中的其他范围,但它们都没有出现.看来,这种名称通常包含在身份令牌中,但对于我所知道的大多数公共API,您不会向服务器提供身份令牌.

更多细节:IdSrvHost和Api位于不同的主机上.控制器有[授权].事实上,我可以看到其他声明即将到来.Api配置为

JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();

app.UseIdentityServerAuthentication(options => {
    options.Authority = "http://localhost:22530/";

    // TODO: how to use multiple optional scopes?
    options.ScopeName = "borrow.slave";
    options.AdditionalScopes = new[] { "borrow.receiver", "borrow.manager" };

    options.AutomaticAuthenticate = true;
    options.AutomaticChallenge = true;
});
Run Code Online (Sandbox Code Playgroud)

范围:

public static Scope Slave { get; } = new Scope {
    Name = "borrow.slave",
    DisplayName = "List assigned tasks",
    Type = ScopeType.Resource,

    Claims = {
        new ScopeClaim(ClaimTypes.NameIdentifier, alwaysInclude: true),
    },
}; …
Run Code Online (Sandbox Code Playgroud)

access-token asp.net-web-api identityserver3 identityserver4

11
推荐指数
1
解决办法
8427
查看次数

byref在F#4.5中返回

我正在尝试将F#样式接口添加到具有byref返回方法的类型.这是代码:

type IPool<'P, 'T when 'T: struct> =
  abstract member GetReference: ITypedPointer<'P, 'T> -> byref<'T>

let Ref<'TPool, 'P, 'T when 'TPool :> IPool<'P, 'T>> (pool: 'TPool) pointer =
  pool.GetReference pointer
Run Code Online (Sandbox Code Playgroud)

令我惊讶的是,在我介绍IPool界面之前,类似的事情工作正常.在此之前,Ref本身包含一个类似的实现&pool.data.[idx],并且运行良好.

我尝试安装每晚构建的F#Tools,因为最新版本没有正式支持byref返回,并且介绍它们的PR最近已经完成:https://github.com/Microsoft/visualfsharp/pull/4888

但是,我仍然error FS3209: The address of the variable 'copyOfStruct' cannot be used at this point. A method or function may not return the address of this local value.使用Visual Studio.类型outref<T>仍然似乎不可用.我错过了什么吗?

我也试图删除pointer参数,只返回pool.GetReference只得到一个不同的错误信息.

另外:最终目标是能够做到

let aref = …
Run Code Online (Sandbox Code Playgroud)

f# byref return-by-reference

9
推荐指数
1
解决办法
341
查看次数

如何在Application Insights中禁用标准性能计数器?

Application Insights中的标准性能计数器会产生过多的卷.如何禁用它们并仅报告我自己的计数器+一些标准计数器(但不是全部),或者只是降低采样频率?

.net azure-application-insights

8
推荐指数
2
解决办法
1863
查看次数

如何在最新的 .NET Core 工具中进行版本自动增量?

我正在使用最新的(截至今天).NET Core 工具。在那里,您可以在 <Version> MSBuild 属性中指定版本。但是,与 [assembly:AssemblyVersion] 不同,这似乎不支持通配符。如何以相同的方式自动增加版本?

解释为什么这是一个坏主意,以及应该做什么也是一个很好的答案。

versioning csproj nuget .net-core

5
推荐指数
1
解决办法
2005
查看次数

检测Windows应用商店是否可用

我的目标是建议用户从桌面应用程序安装应用程序的商店版本,但我需要知道用户是否可以执行此操作(例如,其Windows 10+,并且商店可用).

我可以轻松检测到Windows 10+.

问题是有许多SKU,如Windows Server和Windows LTSB,它们没有Store,但提供的API基本相同.

到目前为止我尝试过的:

  • try 创建一个实例 Windows.Management.Deployment.PackageManager
  • GetProductInfo功能

尽管没有Store,但前者在Windows Server上取得了成功.

后者虽然目前适用于今天,但需要手动检查所有非商店SKU,并没有真正解决问题,因为没有什么能阻止微软将Windows应用商店引入Windows 2019 LTSB.

实际上,更具体地说,我想知道当前用户是否可以从Windows应用商店安装桌面桥接应用程序.

c# windows-store

5
推荐指数
1
解决办法
131
查看次数

4
推荐指数
1
解决办法
970
查看次数

seL4和紫红色的内核之间在概念上有什么区别?

最初我以为Fuchsia是第一个广泛使用基于功能的安全性的内核,但是看起来在seL4中它们也是主要的安全性原语。

microkernel fuchsia sel4

3
推荐指数
1
解决办法
323
查看次数

如何将复杂表达式传递给参数化的活动模式?

我将活动模式"Expression"定义如下:

let (|Expression|_|) expression _ = Some(expression)
Run Code Online (Sandbox Code Playgroud)

现在我试图以这种方式使用它:

match () with
| Expression((totalWidth - wLeft - wRight) / (float model.Columns.Count - 0.5)) cw
    when cw <= wLeft * 4. && cw <= wRight * 4. ->
        cw
| Expression((totalWidth - wLeft) / (float model.Columns.Count - .25)) cw
    when cw <= wLeft * 4. && cw > wRight * 4. ->
        cw
| Expression((totalWidth - wRight) / (float model.Columns.Count - .25)) cw
    when cw > wLeft * 4. && cw <= …
Run Code Online (Sandbox Code Playgroud)

f# active-pattern

2
推荐指数
1
解决办法
425
查看次数

忽略XamlWriter.Save中不可序列化的对象

我有一堆需要转储到xaml的WPF控件。一些控件包含存储在其Tag属性中的不可序列化的对象。在保存Xaml时,我需要忽略它们,因为我需要布局本身,但是XamlWriter.Save会生成一条错误消息,指出它们不可序列化。

xaml ignore save xaml-serialization

2
推荐指数
1
解决办法
2070
查看次数