小编Eri*_*ver的帖子

从Clojure地图过滤零值?

nil从Clojure地图过滤值的最佳方法是什么{}

{ :a :x :b nil :c :z }
;;=>  { :a :x, :c :z }
Run Code Online (Sandbox Code Playgroud)

clojure map filter

15
推荐指数
2
解决办法
8603
查看次数

自定义PowerShell提示

我正在寻找自定义Powershell prompt函数实现的不同示例.如果您有自己的自定义实现,请发布脚本.现有资源的链接也很好.

用于发布提示实际外观的屏幕截图(预览)的奖励积分.

powershell prompt

14
推荐指数
3
解决办法
9555
查看次数

使用AWS Cognito,我可以在给定禁用的未经身份验证的IdentityId的情况下解析经过身份验证的IdentityId吗?

我有一个JavaScript Web应用程序,支持Cognito未经身份验证的身份.我正在试图找出如何识别DISABLED未经身份验证的IdentityId的链接身份验证IdentityId.

第一个未经身份验证的用户通过身份获得IdentityId AWS.config.credentials.get.内部CognitoIdentityCredentials使用getId生成一个新的未经身份验证的IdentityId.

let unathenticatedIdentityId;

const AWS = require('aws-sdk');
AWS.config.region = region;
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId
});
AWS.config.credentials.get(err => {
    unathenticatedIdentityId = AWS.config.credentials.identityId;
});
Run Code Online (Sandbox Code Playgroud)

然后,我们的用户通过身份验证到Cognito用户池amazon-cognito-identity-js,未经身份验证的IdentityId将更改为与其Cognito登录相关联的经过身份验证的IdentityId.未经身份验证的IdentityId会自动标记,DISABLED并在内部链接到经过身份验证的IdentityId.

let authenticatedIdentityId;

const { CognitoUserPool, CognitoUser, AuthenticationDetails } = require('amazon-cognito-identity-js');
const Pool = new CognitoUserPool({
    UserPoolId,
    ClientId,
});
const authDetails = new AuthenticationDetails({
    Username,
    Password,
});
const user = new CognitoUser({
    Pool,
    Username,
});
user.authenticateUser(authDetails, {
    onSuccess: (session) => {
        AWS.config.credentials.params.Logins = …
Run Code Online (Sandbox Code Playgroud)

javascript authentication amazon-web-services amazon-cognito

14
推荐指数
1
解决办法
466
查看次数

在我的C#应用​​程序中进行"ping"

我需要我的应用程序来ping我稍后将指定的地址,只需将平均Ping时间复制到Label的.Text即可.

有帮助吗?

编辑:

如果有人有兴趣,我找到了解决方案:

Ping pingClass = new Ping();        
PingReply pingReply = pingClass.Send("logon.chronic-domination.com");
label4.Text = (pingReply.RoundtripTime.ToString() + "ms");
Run Code Online (Sandbox Code Playgroud)

c# ping

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

为什么(int 10)生成一个Long实例?

为什么不(int 10)生成类型的实例java.lang.Integer

; why Long here?
=> (type (int 10))
; java.lang.Long

; this one is also Long, why not java.lang.Number?
=> (type (num 10))
; java.lang.Long

=> (type (double 10))
; java.lang.Double
=> (type (long 10))
; java.lang.Long
=> (type (float 10))
; java.lang.Float
=> (type (short 10))
; java.lang.Short
=> (type (bigint 10))
; clojure.lang.BigInt
=> (type (bigdec 10))
; java.math.BigDecimal
=> (type (boolean 10))
; java.lang.Boolean
=> (type (char 10))
; java.lang.Character
=> …
Run Code Online (Sandbox Code Playgroud)

clojure type-coercion clojure-java-interop

13
推荐指数
2
解决办法
2024
查看次数

在Clojure中延迟评估

我在理解delay宏如何在Clojure中工作时遇到了一些麻烦.它似乎没有做到期望它做什么(即:延迟评估).正如您在此代码示例中看到的:

; returns the current time
(defn get-timestamp [] (System/currentTimeMillis))

; var should contain the current timestamp after calling "force"
(def current-time (delay (get-timestamp)))
Run Code Online (Sandbox Code Playgroud)

但是,调用current-timeREPL似乎会立即评估表达式,即使没有使用force宏:

user=> current-time
#<Delay@19b5217: 1276376485859>
user=> (force current-time)
1276376485859
Run Code Online (Sandbox Code Playgroud)

为什么评价get-timestamp在第一次force通话之前没有延迟?

clojure delay lazy-evaluation

12
推荐指数
1
解决办法
2027
查看次数

在MVC中使用HtmlHelper有什么好处吗?

是否有一个具体的原因,我应该使用Html.CheckBox,Html.TextBox等方法,而不只是手动编写HTML?

<%= Html.TextBox("uri") %>
Run Code Online (Sandbox Code Playgroud)

呈现以下HTML

<input type="text" value="" name="uri" id="uri"/>
Run Code Online (Sandbox Code Playgroud)

它猜测它可以为您节省一些关键击键但除此之外.是否有一个特定的原因,为什么我应该尽可能地使用HtmlHelpers或者它只是一个偏好的东西?

asp.net-mvc

11
推荐指数
2
解决办法
1902
查看次数

如果没有OverflowException,将"1.79769313486232E + 308"转换为double?

我有这个字符串"1.79769313486232E + 308",我试图将其转换为.NET数值(双??)但我得到以下异常.我在用Convert.ToDouble().进行此转换的正确方法是什么?

OverflowException:对于Double,值太大或太小

.net c# double

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

将Keith Hill的PowerShell Get-Clipboard和Set-Clipboard转换为PSM1脚本

我想将Keith Hill的Get-Clipboard和Set-Clipboard的C#实现转换为纯PowerShell作为.PSM1文件.

有没有办法在PowerShell中启动STA线程,就像他在使用剪贴板时在Cmdlet中那样?

博客发布
代码

c# powershell multithreading sta

11
推荐指数
2
解决办法
6837
查看次数

PowerShell -match运算符和多个组

我在PowerShell中处理以下日志条目我试图使用-match运算符提取所有活动名称和持续时间,但我只返回一个匹配组.当我在C#中使用该Regex对象做同样的事情时,我没有得到我看到的所有匹配.谁能解释我做错了什么?

相关的PowerShell脚本

$formattedMessage -match "(Get\sClient\sModel|Parse\sExpression|Get\sAbstract\sQuery|Compile\sQuery|Execute\sQuery|Get\sQuery\sPlan\sComplexity|Async\sTotal|Total)\s-\sduration\(([0-9]*)" | out-null
$matches
Run Code Online (Sandbox Code Playgroud)

产量

Name  Value
----  -----
0     Get Client Model - duration(0   
1     Get Client Model
2     0
Run Code Online (Sandbox Code Playgroud)

日志条目示例:

Timestamp: 11/9/2009 6:48:41 PM
Message: 
Category: QueryService
Priority: 3
EventId: 1001
Severity: Information
Title: SPARQL Query Response
Machine: SPOON16-SERVER
App Domain: KnowledgeBaseHost.exe
ProcessId: 2040
Process Name: D:\QueryService\QSHost.exe
Thread Name: 
Win32 ThreadId:8092
Extended Properties:
Key - Workflow_cbbdd58b-e574-4054-88d4-1dd7a56dc9d9
Timeout - 1800
Result Format - WireTable
Result from Registry - False
Compiled Query …
Run Code Online (Sandbox Code Playgroud)

.net regex powershell

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