我正在运行Akka Streams Reactive Kafka应用程序,该应用程序应该在高负载下运行.运行应用程序大约10分钟后,应用程序关闭了OutOfMemoryError
.我试图调试堆转储,发现它akka.dispatch.Dispatcher
占用了大约5GB的内存.以下是我的配置文件.
Akka版本:2.4.18
Reactive Kafka版本:2.4.18
1 application.conf
.:
consumer {
num-consumers = "2"
c1 {
bootstrap-servers = "localhost:9092"
bootstrap-servers=${?KAFKA_CONSUMER_ENDPOINT1}
groupId = "testakkagroup1"
subscription-topic = "test"
subscription-topic=${?SUBSCRIPTION_TOPIC1}
message-type = "UserEventMessage"
poll-interval = 100ms
poll-timeout = 50ms
stop-timeout = 30s
close-timeout = 20s
commit-timeout = 15s
wakeup-timeout = 10s
use-dispatcher = "akka.kafka.default-dispatcher"
kafka-clients {
enable.auto.commit = true
}
}
Run Code Online (Sandbox Code Playgroud)
2 . build.sbt
:
java -Xmx6g \
-Dcom.sun.management.jmxremote.port=27019 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Djava.rmi.server.hostname=localhost \
-Dzookeeper.host=$ZK_HOST \ …
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码将视图约束到父 UIScrollView 的左右锚点。
尽管右锚和左锚被设置为 ScrollView 的左锚和右锚,但视图不会扩展以填充滚动视图。
注意:这张图片中的灰色背景是 UIScrollView 的背景,所以我知道它被正确地限制在它的父视图中。
代码:
self.wtfView.translatesAutoresizingMaskIntoConstraints = false
self.wtfView.backgroundColor = UIColor.orange
self.wtfView.topAnchor.constraint(equalTo: self.passwordField.bottomAnchor, constant: 40.0).isActive = true
self.wtfView.leftAnchor.constraint(equalTo: self.containerView.leftAnchor, constant: 40.0).isActive = true
self.wtfView.rightAnchor.constraint(equalTo: self.containerView.rightAnchor, constant: 40.0).isActive = true
self.wtfView.heightAnchor.constraint(equalToConstant: 50.0).isActive = true
self.wtfView.bottomAnchor.constraint(equalTo: self.containerView.bottomAnchor, constant: 40.0).isActive = true
Run Code Online (Sandbox Code Playgroud)
编辑:以下代码工作正常,但我更喜欢使用左+右锚点技术来指定宽度,而不是在宽度约束下。那不应该吗?
self.wtfView.translatesAutoresizingMaskIntoConstraints = false
self.wtfView.backgroundColor = UIColor.orange
self.wtfView.topAnchor.constraint(equalTo: self.passwordField.bottomAnchor, constant: 40.0).isActive = true
self.wtfView.leftAnchor.constraint(equalTo: self.containerView.leftAnchor, constant: 40.0).isActive = true
self.wtfView.widthAnchor.constraint(equalTo: self.containerView.widthAnchor, constant: -80.0).isActive = true //THE DIFFERENT ONE
self.wtfView.heightAnchor.constraint(equalToConstant: 50.0).isActive = true
self.wtfView.bottomAnchor.constraint(equalTo: self.containerView.bottomAnchor, constant: …
Run Code Online (Sandbox Code Playgroud) 我正在使用一个测试项目,我正在编写一个纯Javascript Jasmine Karma设置来测试预编译的Typescript设置.但是,我无法启动测试用例.
我可以在控制台中看到来自编译的打字稿的控制台消息,但它根本不会启动测试脚本.
请注意,这来自AngularApp,但这整个部分来自一个没有Angular2的部分.
没有错误消息,除此之外显示0/0测试已运行,并且"component/to/test"没有时间戳.
在test.spec.js文件中,我有
define("testName", ["component/to/test"], function(component){
describe("testing module", function(){
it("should work", function(){expect(true).toEqual(true)});
})
}
Run Code Online (Sandbox Code Playgroud)
在已编译的打字稿文件中,myTs.js
var requirejs, require, define;
(function (global) {
define("component/to/test" ["depend", "ences"]), function(depend,ences)
{ more code here })
some compiled typescript here
});
require.config({
path: {path to javascript libs},
shim: { ... }
})
Run Code Online (Sandbox Code Playgroud)
在我的业力档案中
basePath: '',
frameworks: ['jasmine', 'requirejs'],
files: [
'lib1',
'lib2',
'spec/test-main.js',
{pattern: 'js/*.js', included: true, served: true},
{pattern: 'spec/*.spec.js', included: false, served: true}
],
exclude: [],
reporters: ['progress'],
autoWatch: …
Run Code Online (Sandbox Code Playgroud) 为什么dodge参数不为每个组创建多个条形图?我正在寻找一个分组的条形图,而不是我得到的堆积条形图.
df<-data.frame(c(40,23,18,41,15,14,38,21,1),c(rep("Do you agree with \nthe 'Hands Up' protestors ?",3),rep("Have the Police alienated themselves\n from the Public?",3),rep("Are the public ignoring the\n dangers Police face everyday?",3)),c("49%","28%","22%","59%","21%","20%","63%","35%","2%"),c(1,1,1,2,2,2,3,3,3))
colnames(df)<-c("values","names","percentages","group")
ggplot(df,aes(names,values,group=group))+
geom_bar(stat = "identity",position = "dodge",fill=rep(c("green","red","orange"),3))+
geom_text(aes(label=percentages))+
ylab("number of votes")+
xlab("")+
ggtitle("Police Opinion polls")
Run Code Online (Sandbox Code Playgroud)
我的结果:
我想要的是:
下面是一个描述我正在尝试做的事情的片段。在我的应用程序中,我有一个贯穿始终的 replaysubject。在某个时候,我想获得从主题发出的最后一个值,但last
似乎不适用于 ReplaySubject。
const subject = new Rx.ReplaySubject();
subject.next(1);
subject.next(2);
subject.next(3);
subject.next(4);
subject.subscribe(num => console.log(num));
var lastObserver = subject.last();
lastObserver.subscribe(num => console.log('last: ' + num));
Run Code Online (Sandbox Code Playgroud)
上面的代码不会为 触发任何东西lastObserver
,但 subscribe 工作得很好。
有没有人能够无线连接到QuickTime Player?我可以使用Xcode 9进行无线调试,但是当我尝试连接到QT时,设备不会出现在列表中......
我已经去了设备并确保选中"通过网络连接".如果我使用照明电缆,这可以正常工作.
这就是Apple在Xcode 9页面上所说的:
剪断脐带
选择本地网络上的任何iOS或tvOS设备来安装,运行和调试您的应用程序 - 无需将USB线插入Mac.只需在首次使用新iOS设备时单击"通过网络连接"复选框,该设备将从此时开始通过网络提供.无线开发也适用于其他应用程序,包括Instruments,Accessibility Inspector,Quicktime Player和Console.
有任何想法吗?
我有一个普通的ASCII文件.当我尝试打开它时codecs.open(..., "utf-8")
,我无法读取单个字符.ASCII是UTF-8的子集,为什么不能codecs
以UTF-8模式打开这样的文件?
# test.py
import codecs
f = codecs.open("test.py", "r", "utf-8")
# ASCII is supposed to be a subset of UTF-8:
# http://www.fileformat.info/info/unicode/utf8.htm
assert len(f.read(1)) == 1 # OK
f.readline()
c = f.read(1)
print len(c)
print "'%s'" % c
assert len(c) == 1 # fails
# max% p test.py
# 63
# '
# import codecs
#
# f = codecs.open("test.py", "r", "utf-8")
#
# # ASC'
# Traceback (most recent call last):
# File "test.py", …
Run Code Online (Sandbox Code Playgroud) 假设我有n
一些名称为link123.txt
、link345.txt
、link645.txt
等的文件。
我想 grep 这些n
文件的子集来查找关键字。例如:
grep 'searchtext' link123.txt link 345.txt ...
Run Code Online (Sandbox Code Playgroud)
我想做类似的事情
grep 'searchtext' link[123\|345].txt
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我如何将文件名作为正则表达式提及?
我创建了一个名为qc
qc 环境的命名空间。
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.namespace.name | quote }}
Run Code Online (Sandbox Code Playgroud)
kubectl create -f namespace.yaml
但是我可以随时通过运行kubectl delete namespace qc
.
如何禁用删除用户创建的命名空间?
谢谢
ios ×2
akka ×1
akka-stream ×1
autolayout ×1
bash ×1
cocoa-touch ×1
codec ×1
ggplot2 ×1
grep ×1
jasmine ×1
javascript ×1
kubectl ×1
kubernetes ×1
linux ×1
namespaces ×1
ocr ×1
python ×1
python-2.7 ×1
quicktime ×1
r ×1
readline ×1
regex ×1
rxjs ×1
scala ×1
tesseract ×1
typescript ×1
utf-8 ×1
xcode ×1
xcode9 ×1