目前我有一个标准的标签栏,当点击进入相应的viewController时.但是当我选择更多标签时,我想从标签栏中弹出一个菜单,如下图所示.
有任何建议实施吗?提前致谢.
好吧,我在 Ubuntu 中使用这个命令编译我的程序
javac -classpath .:/home/ss/lucene-4.0.0/core/lucene-core-4.0.0.jar:/home/ss/lucene-4.0.0/queryparser/lucene-queryparser-4.0.0.jar:/home/ss/lucene-4.0.0/analysis/common/lucene-analyzers-common-4.0.0.jar:/home/ss/lo.jar:/home/neetish/mysql-connector-java-5.1.25-bin.jar kel.java
Run Code Online (Sandbox Code Playgroud)
它编译。
我运行使用
java -classpath .:/home/ss/lucene-4.0.0/core/lucene-core-4.0.0.jar:/home/ss/lucene-4.0.0/queryparser/lucene-queryparser-4.0.0.jar:/home/ss/lucene-4.0.0/analysis/common/lucene-analyzers-common-4.0.0.jar:/home/ss/lo.jar:/home/ss/mysql-connector-java-5.1.25-bin.jar kel.java
Run Code Online (Sandbox Code Playgroud)
我得到
Could not find or load main class kel.java
Run Code Online (Sandbox Code Playgroud)
谁能帮我吗?
我的应用程序工作得很好,直到我下载新的Xcode,现在它被错误"信号SIGABRT"停止并指出:
[PlaceHolder setDescription:]: unrecognized selector sent to instance 0x79838900
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PlaceHolder setDescription:]: unrecognized selector sent to instance 0x79838900'
Run Code Online (Sandbox Code Playgroud)
我知道,这些信息可能不足以理解发生了什么,但我不知道从哪里开始搜索.如果setter方法有错误,为什么我的应用程序之前有效?是否有任何新的更改阻止应用启动?
PlaceHolder是一个对象,它包含属性(如图像链接,文本等).此外,还有一个新的"黄色"警告 - Auto property synthesis will not synthesize property 'description' because it is 'read-write' but it will be synthesized 'read-only' via another property
我真的很挣扎.我一直无法配置Intellij使用Javac,无法运行javadoc.我似乎无法让我的Java运行时环境稳定并在Mac OSX上高效工作.
我已经创建了最基本的示例,这是一个hello world程序,它仍然是来自命令行的错误.我读到的关于这个错误的一切都告诉我"升级编译器".但我真的不确定问题是什么,javac和java都运行1.8(现在,我尝试升级系统JVM之后).
我在调用javac,检查版本等时明确设置了路径.一切都告诉我它是1.8.
有谁能解释如何解决这个问题?(不将我的系统恢复为1.5 SDK).
这是从基本的hello world应用程序输出的:
$JAVA_HOME/bin/javac Main.java
Main.java:3: cannot access java.lang.Object
bad class file: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
class file has wrong version 52.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Main {
^
1 error
localhost:mycompany$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
localhost:mycompany$
Run Code Online (Sandbox Code Playgroud)
javac版本的输出:
javac -version
javac 1.8.0_45
javac: no source files
Usage: javac <options> <source files>
Run Code Online (Sandbox Code Playgroud)
java版本的输出:
java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14) …Run Code Online (Sandbox Code Playgroud) 我用$ hint命令坚持使用Mongo.我有收藏,我已经索引了这个集合.但问题是,我使用Aggregate框架查询集合,但我想暂时禁用索引,所以我使用这样的提示命令:
db.runCommand(
{aggregate:"MyCollectionName",
pipeline:[{$match : {...somthing...},
{$project : {...somthing...}}]
},
{$hint:{$natural:1}}
)
Run Code Online (Sandbox Code Playgroud)
请注意我{$hint:{$natural:1}}用来禁用此查询的索引,我在MongoDB命令行上运行了SUCCESSFULLY这个命令.但我不知道如何将此命令映射到Mongo Java Api(Java代码).
我使用了lib mongo-2.10.1.jar
我已经保存了流ByteArrayOutputStream.现在我想读一下FileInputStream.我怎样才能做到这一点?
这是我的outputStream.
...
OutputStream out = new ByteArrayOutputStream();
...
Run Code Online (Sandbox Code Playgroud)
现在怎么读,从FileInputStream?
根据Javadoc:
void clear()
Run Code Online (Sandbox Code Playgroud)Removes all of the elements from this list (optional operation). The list will be empty after this call returns.
为什么清除List是可选操作?
这不会清除RAM以清除包含数千个objetcs的List吗?
当我试图获取根元素公司的属性时,我发现了以下问题,也有一些例外.
但我进口了我需要的一切; 然后eclipse说删除未使用的导入.
我想知道为什么即使在我导入了所有内容之后它也会发生,请给我一些想法来删除这个bug.
这也是做xml解析的方法吗?是否有任何替代和简单的方法来做同样的事情?
import java.io.EOFException;
import java.io.File;
import javax.lang.model.element.Element;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import javax.lang.model.element.Element;
public class DomTest1 {
private static final String file = "test1.xml";
public static void main(String[] args) {
if (args.length>0) {
file = args[0];
}
try {
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
Document document=builder.parse(new File(file));
Element root=document.getDocumentElement();
System.out.println(root.getTagName());
System.out.printf("name: %s%n", root.getAttribute("name"));
System.out.printf("sHortname: %s%n", root.getAttribute("sHortname"));
System.out.printf("mission : %s%n", root.getAttribute("mission"));
} catch(EOFException e) {
e.printStackTrace();
}
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation …Run Code Online (Sandbox Code Playgroud) 我创建了一个名为Threadimplements 的类,Runnable但由于某种原因我无法调用start()或sleep()方法.每当我尝试这样做时,我都会收到错误,说这些方法对于类来说是未定义的,并建议我创建它们.所以我创建了一个新项目并复制了一个示例代码,以查看我自己的代码是否有问题,并且我收到了相同的错误.这是示例代码:
class Thread implements Runnable {
private int a;
public Thread (int a) {
this.a = a;
}
public void run() {
for (int i = 1; i <= a; ++i) {
System.out.println(Thread.currentThread().getName() + " is " + i);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我自己的代码:
public class Thread extends PID implements Runnable {
public Thread() {}; // Empty constructor for thread object
public void run() …Run Code Online (Sandbox Code Playgroud) 我是Java新手.我有这个2 GB xml文件,我需要解析并将其数据存储到数据库中.
StackOverflow上的某个人建议我将Dom4j用于长xml文件.解析做得很好,但是返回的Document(由Dom4j)很长并且在迭代时将所有DOM对象加载到内存(堆)中.
这导致内存不足异常.有人可以帮我解决这些错误吗?我们是否在Java中有一些现象用于Java中的按需堆分配和沉积?