我正在使用v7支持库在Android 2.x上显示ActionBar.它运行良好但我必须在启用Proguard后修复一些类/方法未找到的错误.
是否有关于需要保留哪些类的指南?
到目前为止我有这些:
-keep public class android.support.v7.internal.widget.ActionBarContainer
-keep class android.support.v7.internal.widget.ActionBarView$HomeView
-keep public class android.support.v7.internal.widget.ActionBarContextView
Run Code Online (Sandbox Code Playgroud)
它现在似乎工作但我不确定它会在某个阶段不会崩溃,因为某些XML文件中引用了一些其他所谓的内部类.
我正在尝试在Linux上的Jetty 7.0.1中运行的Java webapp中调试文件描述符泄漏.
由于打开的文件过多而导致请求开始失败,应用程序已经愉快地运行了一个月左右,并且必须重新启动Jetty.
java.io.IOException: Cannot run program [external program]: java.io.IOException: error=24, Too many open files
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:246)
Run Code Online (Sandbox Code Playgroud)
起初我认为问题在于启动外部程序的代码,但它使用的是commons-exec,我没有看到它有什么问题:
CommandLine command = new CommandLine("/path/to/command")
.addArgument("...");
ByteArrayOutputStream errorBuffer = new ByteArrayOutputStream();
Executor executor = new DefaultExecutor();
executor.setWatchdog(new ExecuteWatchdog(PROCESS_TIMEOUT));
executor.setStreamHandler(new PumpStreamHandler(null, errorBuffer));
try {
executor.execute(command);
} catch (ExecuteException executeException) {
if (executeException.getExitValue() == EXIT_CODE_TIMEOUT) {
throw new MyCommandException("timeout");
} else {
throw new MyCommandException(errorBuffer.toString("UTF-8"));
}
}
Run Code Online (Sandbox Code Playgroud)
在服务器上列出打开的文件我可以看到大量的FIFO:
# lsof -u jetty
... …Run Code Online (Sandbox Code Playgroud) 假设你有
val docs = List(List("one", "two"), List("two", "three"))
Run Code Online (Sandbox Code Playgroud)
例如List("one","two")表示包含术语"one"和"two"的文档,并且您希望为每个术语构建一个包含文档频率的地图,即在这种情况下
Map("one" -> 1, "two" -> 2, "three" -> 1)
Run Code Online (Sandbox Code Playgroud)
你会如何在Scala中做到这一点?(并且以有效的方式,假设一个更大的数据集.)
我的第一个类似Java的想法是使用一个可变映射:
val freqs = mutable.Map.empty[String,Int]
for (doc <- docs)
for (term <- doc)
freqs(term) = freqs.getOrElse(term, 0) + 1
Run Code Online (Sandbox Code Playgroud)
它运作得很好,但我想知道如何以更"功能"的方式做到这一点,而不是诉诸一个可变的地图?
我是Spring MVC的新手.我在我的spring mvc应用程序中寻找一个地方,我可以在应用程序中初始化各种各样的东西.通常我在我的主servlet的init()方法中做到了,但现在调度程序servlet是spring,我不能覆盖init函数.
什么是最佳做法?
谢谢.
任何人都知道在Rust中是否有解决以下错误的方法?
或者至少解释错误的含义?文档说发送特征没有实现者......
fn f1() {
println!("f1");
}
fn main() {
let f2 = || {
println!("f2");
};
spawn(proc() {
f1();
f2(); // error: the trait `core::kinds::Send` is not implemented for the type `||`
});
}
Run Code Online (Sandbox Code Playgroud)
这是
$ rustc --version
rustc 0.13.0-nightly (adb44f53d 2014-10-12 00:07:15 +0000)
Run Code Online (Sandbox Code Playgroud)