小编Mit*_*ops的帖子

如何删除' - 用我的mu4e发送'行

最近开始使用mu4e在emacs中发送电子邮件.当我写作时,我默认在底部有一行

--
Sent with my mu4e
Run Code Online (Sandbox Code Playgroud)

我总是可以删除它,但宁可它首先没有出现在签名区域.在我的emacs init.el中删除它的命令是什么?

emacs

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

如何执行mongo cloneCollection命令将集合复制到远程服务器

我想将一个集合从一个数据库复制到另一个服务器上的实例.从其他stackoverflow 问题,我理解这样做的正确方法是使用此命令:

{ cloneCollection: "<collection>", from: "<hostname>", query: { <query> } }
Run Code Online (Sandbox Code Playgroud)

通过http://docs.mongodb.org/manual/reference/command/cloneCollection/

但是,我不明白我在哪里输入这个命令?它不被接受为......

$ mongod { cloneCollection: "remote", from: "ec2-whatever-amazon.com"}
Run Code Online (Sandbox Code Playgroud)

如何通过命令行将远程集合复制db.remote.collnamedb.local.collname使用此cloneCollection语法?

mongodb

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

Cabal安装沙箱无法重新安装基础或任何其他依赖项

编辑未来的灵魂沉溺于此:

复制下面的任何命令是不明智的,不要执行它们.请查看Zeta的答案,了解我为什么接近这个错误.

原始问题

我的沙盒似乎陷入了某些软件包的全局版本,而不是使用沙箱版本.我已经在SO上寻找答案,并且许多问题在没有具体说明的情况下得到解答,或者稍有不同,所以我似乎无法让我的设置运行.这就是我所拥有的:

1. Version of cabal is old:

$ cabal --v
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 
Run Code Online (Sandbox Code Playgroud)

哦,亲爱的,这是旧的,不会运行沙盒.

2. Install cabal with cabal
$ cabal install cabal
Resolving dependencies...
Downloading Cabal-1.22.6.0...

...lots of stuf...

Registering Cabal-1.22.6.0...
Installed Cabal-1.22.6.0
Run Code Online (Sandbox Code Playgroud)

看起来不错.

3. Try it out:
$ cabal sandbox init
cabal: unrecognised command: sandbox (try --help)
Run Code Online (Sandbox Code Playgroud)

嗯.

$ which cabal
/usr/bin/cabal
Run Code Online (Sandbox Code Playgroud)

啊.

$ ${HOME}/.cabal/bin/cabal --version
cabal-install version 1.22.2.0
using version 1.22.2.0 of the Cabal library 
Run Code Online (Sandbox Code Playgroud)

啊哈.

$ …
Run Code Online (Sandbox Code Playgroud)

haskell cabal cabal-install cabal-sandbox

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

Haskell流下载

我发现使用流行的Haskell库进行流式下载的两个建议方法是:

我将如何修改前者中的代码以(a)保存到文件,并且(b)仅打印(取5个)字节响应,而不是对stdout的整个响应?

我对(b)的尝试是:

#!/usr/bin/env stack
{- stack --install-ghc --resolver lts-5.13 runghc
   --package http-conduit
 -}
{-# LANGUAGE OverloadedStrings #-}
import           Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString        as S
import qualified Data.Conduit.List      as CL
import           Network.HTTP.Simple
import           System.IO              (stdout)

main :: IO ()
main = httpSink "http://httpbin.org/get" $ \response -> do
    liftIO $ putStrLn
           $ "The status code was: "
          ++ show (getResponseStatusCode response)

    CL.mapM_ (take 5) (S.hPut stdout)
Run Code Online (Sandbox Code Playgroud)

它无法映射(取5),并向我提出了很多建议,但我仍然不了解在monads上进行映射或liftIO是如何工作的。

另外,此资源:

http://haskelliseasy.readthedocs.io/en/latest/#note-on-streaming

…向我发出警告,“我知道我在做什么,我想对资源(例如流媒体)进行更细粒度的控制”,这是不容易或通常不支持的。

我看过的其他地方:

如果Haskellverse中有什么可以简化此过程,更像Python的请求:

response = requests.get(URL, …
Run Code Online (Sandbox Code Playgroud)

haskell conduit

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

从go调用fortran库的最小例子

我正在寻找这两种语言之间FFI的最小例子,这是一个非常简单的Go程序调用Fortran库的hello世界.

我想强调一点,我不是在寻找外部资源,建议或教程,只是golang中的最小代码片段,以及Fortran中的相应格式.

这个网站上有很多例子:

Go - > Fortran示例符合这些并且对其他开发人员有用.

编辑以解决重复声明

这个问题有一个答案和一个链接的问题,因为这是一个副本而不是.关闭并重定向此问题作为可能以-5票结束的副本对stackoverflow用户没有用,尽管两者都提出了一个合理的问题.

fortran ffi go

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

在javascript中异步等待sqlite

我正在查看本教程,其中有一个名为 aa-sqlite 的库,以便用 async-await 替换 Promises() 语法。

没有在 npm 上看到 aa-sqlite。async await sqlite 是否还有另一种更新的语法?

这是我正在尝试使用标准 sqlite 库:

const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database("tmp.db")

async function myfunc(db) {
  let sql = "SELECT id id FROM TABLE LIMIT 2"
  let res1 = await db.run(sql)
  console.log(res1)
  for (row of res1) {
    console.log(row);   
  }
Run Code Online (Sandbox Code Playgroud)

但这会产生

TypeError: res1 is not iterable
Run Code Online (Sandbox Code Playgroud)

我不希望res1成为一个对象,而是一个结果的迭代器。如何db.run在 ES7/ES8 中异步/等待查询结果?

javascript sqlite asynchronous node.js async-await

4
推荐指数
3
解决办法
4729
查看次数

Huggingface 长文档摘要

我预计摘要任务通常会假设长文档。但是,根据此处的文档,我所做的任何简单摘要调用都表示我的文档太长:

>>> summarizer = pipeline("summarization")
>>> summarizer(fulltext)
Token indices sequence length is longer than the specified maximum sequence length for this model (5620 > 1024). Running this sequence through the model will result in indexing errors

>>> summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
>>> summary = summarizer(fulltext)
Token indices sequence length is longer than the specified maximum sequence length for this model (8084 > 1024). Running this sequence through the model will result in indexing errors

>>> summarizer = pipeline("summarization", …
Run Code Online (Sandbox Code Playgroud)

python huggingface-transformers

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

Autoformat code in a jupyter notebook with a keystroke

Is there a widget or keyboard shortcut to apply code formatting a jupyter notebook?

If I have a function like:

def f(x):
y = x*2
z = y*2
return z
Run Code Online (Sandbox Code Playgroud)

I'd like to be able to autotab this function over to:

def f(x):
    y = x*2
    z = y *2
    return z
Run Code Online (Sandbox Code Playgroud)

automatically.

jupyter-notebook

4
推荐指数
2
解决办法
5075
查看次数

如何从linux命令行纵向连接SVG文件?

我有一系列方形 SVG 文件,我想将它们纵向排列成一个超长的 SVG 文件。

我尝试使用 imagemagick 将它们组合起来。基于此页面:http : //linux.about.com/library/cmd/blcmdl1_ImageMagick.htm

和这个

http://www.imagemagick.org/Usage/compose/

我试过这个命令

composite 'file1.svg' 'file2.svg' +adjoin 'outputfile.svg'

但是,我收到以下错误消息: composite: unrecognized option '+adjoin' @ error/composite.c/CompositeImageCommand/565.

我尝试了其他几个 imagemagick 命令(转换、显示),但没有成功。如何在命令行上组合这些文件?是否有执行此操作的inkscape命令?

linux command-line svg image-manipulation imagemagick

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

使用png()和dev.off()在R中打印图(lm(y~x))

我想打印文件,当你绘制()线性模型的拟合时,R产生的回归诊断图表.有四个,它们会中断执行

Hit <Return> to see next plot:
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 
Run Code Online (Sandbox Code Playgroud)

因此,以下通常可行的代码不会:

png('Filename.png', width=mywidth, height=myheight, units='in', res=300)
plot(lm(y~x)
dev.off()
Run Code Online (Sandbox Code Playgroud)

因为我每次仍然必须按下输入,并且不清楚这是否会正确地进行subplotted,或者将每个绘图命名为不同的文件.

如何捕获直接打印到磁盘的这些诊断图像?如果重要的话,我在linux机器上.

linux plot png r

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