小编Thi*_*uce的帖子

Scaladoc图

是否可以使用Scaladoc和SBT生成图表?

我试着在我的行中添加这行build.sbt: scalacOptions in (Compile,doc) := Seq("-diagrams", "-diagrams-debug")

但我收到:图生成运行时间细分:

diagrams model filtering
========================
count:        242 items
total time:   0 ms
average time: 0 ms
maximum time: 0 ms

diagrams model generation
=========================
count:        242 items
total time:   45 ms
average time: 0 ms
maximum time: 11 ms

dot diagram generation
======================
count:        89 items
total time:   24 ms
average time: 0 ms
maximum time: 3 ms

dot process runnning
====================
count:        89 items
total time:   590 ms
average …
Run Code Online (Sandbox Code Playgroud)

scala sbt scaladoc

10
推荐指数
1
解决办法
779
查看次数

Haskell中的无限列表并行过滤器

我想在Haskell中找到无限列表中的第一个匹配元素.

这段代码有效:

findPassword passwordHash = (head . filter (checkPassword passwordHash)) allStrings
Run Code Online (Sandbox Code Playgroud)

checkPassword真的很长(因为它是一个SHA1哈希)

checkPassword hash string = (sha1 string) == hash
Run Code Online (Sandbox Code Playgroud)

allStrings只是所有可能字符串的列表:

allStrings = [ c : s | s <- "" : allStrings, c <- ['a'..'z'] ++ ['0'..'9'] ]
Run Code Online (Sandbox Code Playgroud)

我希望这些代码并行运行,但如果我用parFilter替换过滤器:

import qualified Control.Parallel.Strategies as S
parFilter p = S.withStrategy (S.evalBuffer 1000 S.rseq) . filter p
Run Code Online (Sandbox Code Playgroud)

它不起作用......你有什么想法吗?这段代码也使用了大量内存,但这是另一个问题.这里有完整的脚本https://github.com/ThibaudDauce/habreaker

parallel-processing haskell infinite

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

如何使用 Rust 和 Tokio 构建多个并发服务器?

我希望使用 Rust 和 Tokio 在不同端口上构建多个并发服务器:

let mut core = Core::new().unwrap();
let handle = core.handle();

// I want to bind to multiple port here if it's possible with simple addresses
let addr = "127.0.0.1:80".parse().unwrap();
let addr2 = "127.0.0.1:443".parse().unwrap();

// Or here if there is a special function on the TcpListener
let sock = TcpListener::bind(&addr, &handle).unwrap();

// Or here if there is a special function on the sock
let server = sock.incoming().for_each(|(client_stream, remote_addr)| {
    // And then retrieve the current port in …
Run Code Online (Sandbox Code Playgroud)

concurrency rust rust-tokio

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

SSH:仅接受来自本地主机的密码连接

我希望能够使用密码连接到 root@localhost,并仅使用私钥从外部 (root@my-ip) 连接。我没有找到在 /etc/ssh/sshd_config 中写什么来允许 this\xe2\x80\xa6 如果它需要 SSH 密钥和密码,也可以。

\n\n

你有好主意吗?

\n

ssh config sshd

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