小编til*_*lex的帖子

缩放图像保持其纵横比在背景中可绘制

如何使背景图像适合视图,但在<bitmap />用作背景可绘制XML 时保持其纵横比?没有<bitmap>android:gravity值给出预期效果的.

scaling android android-drawable android-background android-bitmap

58
推荐指数
3
解决办法
8万
查看次数

为什么空Java应用程序会消耗内存?

可能重复:
为什么空Java程序消耗内存?

为什么绝对空的Java应用程序会不断消耗内存?该应用程序:

public class Dummy {
    public static void main(String[] args) throws IOException {
        System.in.read();
    }
}
Run Code Online (Sandbox Code Playgroud)

甚至:

public class Dummy {
    public static void main(String[] args) throws InterruptedException {
        synchronized (Thread.currentThread()) {
            Thread.currentThread().wait();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

堆状态:

空Java应用程序堆状态

更新:IOException修复.

java memory

14
推荐指数
0
解决办法
170
查看次数

C++网络库类似于Netty

有没有类似于JBoss的Netty的C++网络库?我需要一个架构,我可以将协议处理程序添加到列表中并将网络数据包作为对象处理.

c++ java networking netty

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

预处理sbt-twirl模板

我需要在我的sbt项目中预处理一些Twirl模板.是否可以在build.sbt中定义一个任务,该任务将 Twirl插件编译其模板之前运行?

scala sbt twirl

8
推荐指数
1
解决办法
226
查看次数

Assanax中的Cassandra CQL3支持

Astyanax是否通过CQL3准备好的声明支持"插入"?我使用最新的Astyanax库1.56.24和Cassandra 1.2.1.当我尝试使用CQL3执行预准备语句时:

keyspace.prepareQuery(conn.CF_CONTACTS)
  .withCql("INSERT INTO contacts (a, b) VALUES (?, ?);")
  .asPreparedStatement()
  .withStringValue("123")
  .withStringValue("456")
  .execute();;
Run Code Online (Sandbox Code Playgroud)

我得到以下异常:

Caused by: InvalidRequestException(why:Cannot execute/prepare CQL2 statement since the CQL has been set to CQL3(This might mean your client hasn't been upgraded correctly to use the new CQL3 methods introduced in Cassandra 1.2+).)
at org.apache.cassandra.thrift.Cassandra$prepare_cql_query_result.read(Cassandra.java:38738)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_prepare_cql_query(Cassandra.java:1598)
at org.apache.cassandra.thrift.Cassandra$Client.prepare_cql_query(Cassandra.java:1584)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$6$3$1.internalExecute(ThriftColumnFamilyQueryImpl.java:747)
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$6$3$1.internalExecute(ThriftColumnFamilyQueryImpl.java:742)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:56)
Run Code Online (Sandbox Code Playgroud)

java cassandra astyanax

7
推荐指数
1
解决办法
1696
查看次数

Cassandra NoHostAvailableException,但仍有活动节点

我在一个DC中有两个C*2.0.2节点(在cassandra.yaml中有默认配置)和一个RF = 2的密钥空间.两个客户端使用Datastax Java Driver 1.0.3连接到此DC.客户端使用CL = ONE从/向C*读取和写入数据,没有任何错误.但当我关闭一个节点时,两个客户端都会遇到大量异常:

com.datastax.driver.core.exceptions.NoHostAvailableException:
All host(s) tried for query failed (no host was tried)
Run Code Online (Sandbox Code Playgroud)

在那一堆例外之后,客户端继续成功地与另一个仍然存活的节点一起工作.我应该怎么做才能收到任何NoHostAvailableException,因为一次至少有一个活动节点并且使用了CL = ONE?

更新: 当我关闭两个节点中的一个时,我有时会在我的应用程序日志中看到以下异常:

[Reconnection-1] [ERROR] [Control connection] Cannot connect to
any host, scheduling retry
Run Code Online (Sandbox Code Playgroud)

如果我只关闭一个节点,为什么两个节点都不可用?第二个还活着,我可以用cqlsh连接到它.

java cassandra datastax-java-driver

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

Android的用于Swing的LinearLayout

是否有一个用于Swing的LayoutManager在Android中充当LinearLayout?我非常喜欢组件重量的概念.

java swing android layout-manager android-linearlayout

5
推荐指数
2
解决办法
3445
查看次数

Akka同行在防火墙后面

据我所知,没有办法运行位于防火墙后面的Akka远程tcp客户端,因为每个Akka对等端都必须有一个tcp服务器套接字才能接收消息.我对吗?

我需要使用Akka创建一个纯tcp客户端,该客户端能够连接到远程服务器并从其接收响应但无法接收传入连接.

networking scala akka

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

Play Framework 2.0.升级bonecp

Scala for Play 2.0中有一个项目.我遇到了一个已知的与bonecp 0.7.1数据库连接的错误,并希望将此库升级到0.8.0版.在文件/project/plugins.sbt中,我添加了以下内容:

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

libraryDependencies += "com.jolbox" % "bonecp" % "0.8.0-rc2-SNAPSHOT"
Run Code Online (Sandbox Code Playgroud)

但是在编译和发布之后,我得到了一个包含了bonecp 0.7.1的存档.我该怎么做才能让Play Framework使用bonecp 0.8.0?

scala sbt playframework bonecp playframework-2.0

3
推荐指数
2
解决办法
1947
查看次数