我正在尝试在我的Android应用程序中开发一个消息应用程序.消息将像whatsapp和beluga.我用谷歌搜索它,发现C2DM Android 2.2可以将推送通知发送到设备.但是,这在Android 2.1上不可用.有谁知道whatsapp如何发送2.1设备的通知?
我试图将格式拆分为多个元组,因此它可以处理案例类中超过22个字段.但是,我收到错误"值,并且不是play.api.libs.json.Format的成员".如何合并案例类的多种格式?
val fields1to2: Format[(Int, String)] = (
(__ \ "a").format[Int] and
(__ \ "b").format[String]
).tupled
val fields3to4: Format[(Boolean, List[Int])] = (
(__ \ "c").format[Boolean] and
(__ \ "d").format[List[Int]]
).tupled
implicit val hugeCaseClassReads: Format[Huge] = (
fields1to2 and fields3to4 // "value and is not a member of play.api.libs.json.Format"
) {
case ((a, b), (c, d)) =>
Huge(a, b, c, d)
}
Run Code Online (Sandbox Code Playgroud) 我从Play 2.0.3 java应用程序中收到此错误.我怎么能重新启动Heroku Postgres Dev DB?我找不到在Heroku帮助中心重启数据库的任何说明.
app[web.1]: Caused by: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections
Run Code Online (Sandbox Code Playgroud) 在Play 2.3中,我可以根据不同的请求路径或方法禁用某些过滤器.但是,我在Play 2.4中找不到办法.https://www.playframework.com/documentation/2.4.x/ScalaHttpFilters.如何在Play 2.4 HttpFilters中获得类似的结果.
这是我在Play 2.3中的表现.
object CacheCtrlHeadersFilter extends EssentialFilter {
def apply(action: EssentialAction) = new EssentialAction {
def apply(requestHeader: RequestHeader) = {
action(requestHeader).map { result =>
result.withHeaders(
CACHE_CONTROL -> "no-cache, no-store, must-revalidate, private",
PRAGMA -> "no-cache"
)
}
}
}
}
import play.api.libs.iteratee._
object FilterChainByRequestHeader {
def apply[A](action: EssentialAction, filtersFun: (RequestHeader) => List[EssentialFilter]): EssentialAction = new EssentialAction {
def apply(rh: RequestHeader): Iteratee[Array[Byte], Result] = {
val chain = filtersFun(rh).reverse.foldLeft(action) { (a, i) => i(a) }
chain(rh) …Run Code Online (Sandbox Code Playgroud) 如何使用Certbot的Dnsimple插件通过DNS挑战自动获取和续订证书?我在网上找不到任何例子.
https://github.com/certbot/certbot/tree/master/certbot-dns-dnsimple
我们将记录批量插入Hyperledger Fabric.但是,我们正在努力解决问题.即使我们不断增加超时,我们也会在稍后发生此错误.
每个事务PutState在循环中使用所有这些记录插入1000条记录(盲插入,读取集中没有任何内容).我们还将BatchTimeout增加到3s,将MaxMessageCount增加到100,这样我们就可以获得更大的块(我们看到每个块有4个事务,因此每个块将4000个[每个事务4x1000个记录]记录插入到分类帐中).
当bulk_update为CouchDB失败并且对等方必须分别为每个(每个事务的1000个记录)记录重试时,查询花费的时间太长并超出了超时.但这是我们的假设.我们也发现了这个:https://jira.hyperledger.org/browse/FAB-10558,但它说已经修复了v1.2.0,这是我们正在使用的版本.
我们得到的错误net/http: request canceled (Client.Timeout exceeded while reading body)来自以下日志:
我们尝试在对等容器中设置以下环境变量:
CORE_CHAINCODE_EXECUTETIMEOUT=120s
并且req.setProposalWaitTime(120 * 1000)在使用Java SDK时也是如此.
但是,我们稍后会得到相同的超时错误.因此,我们可以将超时变量增加到更大的数字,但我们相信它会在稍后再次发生.插入CouchDB所需的时间是否与CouchDB中的记录数成比例?当文档数量增加时,更新索引会花费更多时间吗?
我们得到的运行时错误日志(插入2-4百万条记录后)如下:
October 5th 2018, 04:36:38.646 github.com/hyperledger/fabric/core/committer.(*LedgerCommitter).CommitWithPvtData(0xc4222db8c0, 0xc451e4f470, 0xc4312ddd40, 0xdf8475800)
October 5th 2018, 04:36:38.646 github.com/hyperledger/fabric/gossip/state.(*GossipStateProviderImpl).deliverPayloads(0xc4220c5a00)
October 5th 2018, 04:36:38.646 goroutine 283 [running]:
October 5th 2018, 04:36:38.646 /opt/gopath/src/github.com/hyperledger/fabric/core/committer/committer_impl.go:105 +0x6b
October 5th 2018, 04:36:38.646 /opt/gopath/src/github.com/hyperledger/fabric/gossip/privdata/coordinator.go:236 +0xc3b
October 5th 2018, 04:36:38.646 /opt/gopath/src/github.com/hyperledger/fabric/gossip/state/state.go:771 +0x6c
October 5th 2018, 04:36:38.646
October 5th 2018, 04:36:38.646 github.com/hyperledger/fabric/core/ledger/kvledger.(*kvLedger).CommitWithPvtData(0xc421fb1860, 0xc451e4f470, 0x0, 0x0) …Run Code Online (Sandbox Code Playgroud) 我仍在开发我的应用程序的第一个版本2.如何重新生成进化脚本?
我有两个控制器都在Play 2.0中使用AKKA演员.因此,有两个测试用例针对这两个API进行测试.但是,执行'play test'时,只有一个测试用例会成功,另一个测试用例会失败.如果我单独运行它,它会成功运行.我的预感是演员系统已经被第一次测试关闭了.但是,我是Play 2和Akka的新手,这只是我的猜测.有解决方法吗?
@Test
public void callPostA() {
running(testServer(2222, fakeApplication(inMemoryDatabase())), new Runnable() {
@Override
public void run() {
HttpPost httpPost = new HttpPost("http://localhost:2222/controllera");
....
}
});
}
@Test
public void callPostB() {
running(testServer(2222, fakeApplication(inMemoryDatabase())), new Runnable() {
@Override
public void run() {
HttpPost httpPost = new HttpPost("http://localhost:2222/controllerb");
....
}
});
}
Run Code Online (Sandbox Code Playgroud)
两个控制器如下:
public class PostA extends Controller {
// master actor for workers
public static ActorRef masterActorA = Akka.system().actorOf(new Props(new UntypedActorFactory() {
public UntypedActor create() {
return new PostAActorMaster(Config.NUMBER_OF_WORKER_ACTOR); …Run Code Online (Sandbox Code Playgroud) 尝试在 Google Colab 上安装 pyaudio,但出现错误“错误:pyaudio 的构建轮失败”。
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools
!pip install pyaudio
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Collecting pyaudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
ERROR: Failed building wheel for pyaudio
Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-000dzv_9/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tvs_aja7/install-record.txt --single-version-externally-managed --compile" …Run Code Online (Sandbox Code Playgroud) 我们计划将我们的软件扩展到东南亚地区。我们自托管的Mongo集群完全搭建在中国的AWS数据中心。我们如何将 MongoDB 复制集设置为 AWS Singapore 并允许在两个区域上写入并依赖 MongoDB 在后台异步同步数据?
scala ×2
akka ×1
android ×1
aws-regions ×1
certbot ×1
couchdb ×1
dnsimple ×1
heroku ×1
hyperledger ×1
java ×1
lets-encrypt ×1
mobile ×1
mongodb ×1
postgresql ×1
pyaudio ×1
python ×1
replicate ×1