小编fra*_*ale的帖子

rebase - 如果rerere解决所有冲突,则自动继续

Git rerere提供了在rebase期间重用以前的冲突解决方案,甚至可以通过设置来解析已解析的文件rerere.autoupdate = True(如另一个问题中所详述).但是,即使解决了所有冲突并且所有文件都已暂存,我仍然必须运行git rebase --continue以继续rebase操作.

如果已解决所有冲突并暂停所有更改,我该如何自动继续rerere

git git-rebase git-rerere

25
推荐指数
2
解决办法
998
查看次数

Test.QuickCheck.Monadic:为什么断言应用于Bool,而不是Testable a => a

使用QuickCheck测试Monadic代码时(Claessen,Hughes 2002),assert有类型:

assert :: (Monad m, Testable a) => a -> PropertyM m ()
Run Code Online (Sandbox Code Playgroud)

但是,在Test.QuickCheck.Monadic,它有类型:

assert :: (Monad m) => Bool -> PropertyM m ()
Run Code Online (Sandbox Code Playgroud)

为什么assert在库中有后一种类型?

haskell quickcheck

18
推荐指数
1
解决办法
338
查看次数

使用LDAP和sssd,Centos 7 ssh登录失败

我已经在Centos 7上运行了一个LDAP服务器.id,getent passwd,用户工作.但'ssh'失败了.从/ var/log/secure看来,身份验证似乎成功了,但是pam不喜欢其他东西.我不确定如何缩小问题所在.

在/ var /日志/安全:

May 11 16:33:40 localhost sshd[45055]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=ldapserver.abc.com  user=user1
May 11 16:33:40 localhost sshd[45055]: pam_sss(sshd:auth): authentication success; logname= uid=0 euid=0 tty=ssh ruser= rhost=ldapserver.abc.com user=user1
May 11 16:33:40 localhost sshd[45055]: pam_sss(sshd:account): Access denied for user user1: 6 (Permission denied)
May 11 16:33:40 localhost sshd[45055]: Failed password for user1 from ldapserver.abc.com port 55185 ssh2
May 11 16:33:40 localhost sshd[45055]: fatal: Access denied for user user1 by PAM account configuration …
Run Code Online (Sandbox Code Playgroud)

linux ssh pam openldap sssd

6
推荐指数
1
解决办法
9727
查看次数

导入分配的外部函数时是否需要使用IO?

在Haskell中,使用FFI绑定到分配功能时,它是适当的避免使用IO时的外部函数分配并构建了一些值,并将该值依赖于函数的参数?

考虑以下功能:

/**
 * The foo_create contract: if allocation succeeds, the
 * return value points to a value that depends only on 'x'
 * and 'name', otherwise a null pointer is returned.
 */
foo_t *foo_create(int x, const char *name);
Run Code Online (Sandbox Code Playgroud)

以下列方式导入此功能是否合适?

newtype Foo = Foo (Ptr Foo)

foreign import unsafe "foo.h foo_create"
foo_create :: CInt -> CString -> Ptr Foo
Run Code Online (Sandbox Code Playgroud)

然后可以包装此低级绑定函数以提供更好的API:

makeFoo :: CInt -> CString -> Maybe Foo
makeFoo x s =
  let
    ptr …
Run Code Online (Sandbox Code Playgroud)

haskell allocation ffi

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

适用于<$>和<*>的运算符部分

考虑类型的函数a -> b -> c和应用值a1, a2 :: (Applicative f) => f a.

我希望构造一个函数,该函数可以应用于类型的函数a -> b -> c以获得类型的值Applicative f :: f c.我可以通过以下方式执行此操作:

g :: (Applicative f) => (a -> b -> c) -> f c
g = \f -> f <$> a1 <*> a2
Run Code Online (Sandbox Code Playgroud)

(显式lambda是故意的,因为我正在考虑在任何级别构建此函数,而不仅仅是顶层).

如果我尝试g用无点样式编写:

g = (<$> a1 <*> a2)
Run Code Online (Sandbox Code Playgroud)

我得到以下编译错误:

The operator `<$>' [infixl 4] of a section
    must have lower precedence than that of the operand,
      namely …
Run Code Online (Sandbox Code Playgroud)

haskell applicative operator-sections

5
推荐指数
2
解决办法
720
查看次数

为什么需要"包装"函数类型才能满足类型检查器的需要?

以下程序类型检查:

{-# LANGUAGE RankNTypes #-}

import Numeric.AD (grad)

newtype Fun = Fun (forall a. Num a => [a] -> a)

test1 [u, v] = (v - (u * u * u))
test2 [u, v] = ((u * u) + (v * v) - 1)

main = print $ fmap (\(Fun f) -> grad f [1,1]) [Fun test1, Fun test2]
Run Code Online (Sandbox Code Playgroud)

但是这个程序失败了:

main = print $ fmap (\f -> grad f [1,1]) [test1, test2]
Run Code Online (Sandbox Code Playgroud)

带有类型错误:

Grad.hs:13:33: error:
    • Couldn't match type ‘Integer’ …
Run Code Online (Sandbox Code Playgroud)

haskell type-systems automatic-differentiation type-mismatch

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

config中的req_extensions和命令行上的-extensions有什么区别?

OpenSSL Cookbook中的示例openssl root ca config 定义了以下内容(p40):

[req]
...
req_extensions = ca_ext

[ca_ext]
...
Run Code Online (Sandbox Code Playgroud)

稍后(p43),生成根ca密钥,然后生成root ca自签名证书.

openssl req -new \
-config root-ca.conf \
-out root-ca.csr \
-keyout private/root-ca.key

openssl ca -selfsign \
-config root-ca.conf \
-in root-ca.csr \
-out root-ca.crt \
-extensions ca_ext
Run Code Online (Sandbox Code Playgroud)

在这个特定的用例中,req_extensions不是多余的吗?什么时候真的需要req_extension?

openssl csr x509 pkcs#10

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