是否可以让主机打开Docker容器访问端口?具体来说,我在主机上运行MongoDB和RabbitMQ,我想在Docker容器中运行一个进程来监听队列并(可选)写入数据库.
我知道我可以将一个端口从容器转发到主机(通过-p选项)并从Docker容器中连接到外部世界(即Internet),但我不希望暴露RabbitMQ和MongoDB端口从东道主到外部世界.
编辑:一些澄清:
Starting Nmap 5.21 ( http://nmap.org ) at 2013-07-22 22:39 CEST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00027s latency).
PORT STATE SERVICE
6311/tcp open unknown
joelkuiper@vps20528 ~ % docker run -i -t base /bin/bash
root@f043b4b235a7:/# apt-get install nmap
root@f043b4b235a7:/# nmap 172.16.42.1 -p 6311 # IP found via docker inspect -> gateway
Starting Nmap 6.00 ( http://nmap.org ) at 2013-07-22 20:43 UTC
Nmap scan report for 172.16.42.1
Host is up (0.000060s latency).
PORT STATE SERVICE
6311/tcp …Run Code Online (Sandbox Code Playgroud) 当尝试将图形从Rmd绘制到Word和Docx时,绘图大小不同,其中docx版本修剪边缘.有什么方法可以防止这种情况吗?
这是一个Rmd,它在某种程度上最低限度地再现了这一点.(在其他图中,效果更加极端,但需要更多代码才能重现)
```{r}
library(gemtc)
example(gemtc)
forest(results)
```
Run Code Online (Sandbox Code Playgroud)
rmarkdown::render("./test.Rmd", output_format="word_document", clean=F)
rmarkdown::render("./test.Rmd", output_format="html_fragment")

请注意CrI右侧修剪.
运行之间的绘图参数似乎不同(这是来自不同的图):
par(no.readonly = T)
(DOCX)
## $pin
## [1] 3.76 2.16
##
## $plt
## [1] 0.164 0.916 0.255 0.795
Run Code Online (Sandbox Code Playgroud)
与
(HTML)
## $pin
## [1] 5.76 3.16
##
## $plt
## [1] 0.1171429 0.9400000 0.2040000 0.8360000
##
Run Code Online (Sandbox Code Playgroud)
在同一个情节.在某些情况下,这会导致边缘被修剪得极其严重.
版本信息
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 …Run Code Online (Sandbox Code Playgroud) 我对Clojure和函数式编程相当新,我一直在努力解决以下问题.我想为一系列令牌(字符串)分配一个唯一且稳定的索引.由于查找比插入更多,因此哈希映射似乎是要走的路.
在Java中,我会写一些东西
int last = 0;
HashMap<String, Integer> lut = new HashMap<String, Integer>();
function Integer getIndex(String token) {
Integer index = lut.get(token);
if(index == null)
last++;
lut.put(token, last);
return last;
else {
return index;
}
}
Run Code Online (Sandbox Code Playgroud)
Clojure中的音译版本就像
(def last-index (atom 0))
(def lookup-table (atom {}))
(defn get-index [token]
(if (nil? (get @lookup-table token))
(do
(swap! last-index inc)
(swap! lookup-table assoc token @last-index)
@last-index)
(get @lookup-table token)))
Run Code Online (Sandbox Code Playgroud)
但这似乎并不是非常自我,因为它基本上是副作用,甚至没有隐藏它.
那么如果没有两个原子来保持状态,你会怎么做呢?
目前我正在尝试使用RESTful API构建一个Web服务来处理一些长时间运行的任务(作业).
这个想法是用户通过执行POST来提交作业,该POST返回一些用于检查作业状态的URL,该URL还包含结果的URL.一旦作业完成(即某些值写入数据库),结果URL将返回相应的信息(而不是没有结果),并且作业URL将指示已完成的状态.
不幸的是,计算非常密集,因此一次只能运行一个,因此需要对作业进行排队.
在伪事情中需要这样的东西
(def job-queue (atom queue)) ;; some queue
(def jobs (atom {}))
(defn schedule-job [params]
;; schedules the job into the queue and
;; adds the job to a jobs map for checking status via GET
;; note that the job should not be evaluated until popped from the queue
)
(POST "/analyze" [{params :params}]
(schedulde-job params))
(GET "job/:id" [:d]
(get @jobs id))
;; Some function that pops the next item from the queue
;; and …Run Code Online (Sandbox Code Playgroud) 我有一个由句子和相应的多标签组成的数据集(例如,一个句子可以属于多个标签)。在语言模型 (Word2Vec) 上使用卷积神经网络和循环神经网络的组合,我能够达到很好的准确性。然而,它 /too/ 擅长对输出进行建模,因为很多标签可以说是错误的,因此输出也是错误的。这意味着评估(即使有正则化和辍学)给人的印象是错误的,因为我没有基本事实。清理标签的费用会高得令人望而却步。所以我不得不以某种方式探索“去噪”标签。我看过诸如“从大量噪声标记数据中学习用于图像分类”之类的东西,但是他们假设在输出上学习某种噪声协方差矩阵,我不确定在 Keras 中如何做。
有没有人处理过多标签文本分类设置中的嘈杂标签问题(最好使用 Keras 或类似工具),并且对如何学习带有噪声标签的鲁棒模型有很好的想法?
我正在尝试将 Apache Jena 3.0 中的 a 转换ResultSet为 a Model。
以前我用过
ResultSetFormatter.toModel功能,但这似乎已被删除。
当前获取结果集模型(用于序列化为 JSON-LD 和 RDF/XML)的最佳方法是什么?
clojure ×2
apache-jena ×1
docker ×1
hashmap ×1
java ×1
jena ×1
jobs ×1
keras ×1
knitr ×1
linux ×1
networking ×1
pandoc ×1
port ×1
python ×1
queue ×1
r ×1
r-markdown ×1
semantic-web ×1
sparql ×1
state ×1
web-services ×1