我想获得不存在字段下载的所有文档
find{ "download" : {$exists: false}}
Run Code Online (Sandbox Code Playgroud)
对于Java,我找到了一个例子:
BasicDBObject neQuery = new BasicDBObject();
neQuery.put("number", new BasicDBObject("$ne", 4));
DBCursor cursor = collection.find(neQuery);
while(cursor.hasNext()) {
System.out.println(cursor.next());
}
Run Code Online (Sandbox Code Playgroud)
我的改编是
BasicDBObject field = new BasicDBObject();
field.put("entities.media", 1);
field.put("download", new BasicDBObject("$exists",false));
System.out.println("Start Find");
DBCursor cursor = collection.find(query,field);
System.out.println("End Find Start Loop ALL 100k");
int i = 1;
while(cursor.hasNext())
Run Code Online (Sandbox Code Playgroud)
存在线不起作用:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.mongodb.MongoException: Unsupported projection option: $exists
at com.mongodb.MongoException.parse(MongoException.java:82)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:314) …Run Code Online (Sandbox Code Playgroud) 我在我的项目中附加了四个库,但是当我尝试运行这个项目时,那个时候Eclipse显示错误对话框,错误"堆空间出现问题".那我该怎么办?任何与此相关的想法都有帮助.
我有一个MediaPlayer播放本地音频文件的对象.我TimerTask在播放音频时使用a 来更新SeekBar的位置和TextView上的文本.
有一个按钮.当用户按下按钮时音频开始.当他们第二次按下它时音频停止.当他们第三次按下它再次开始播放时,应用程序会因错误而崩溃
'causedby: TimerTask is scheduled already and InvocationTargetException'.
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
public void onAudioClicked(View v) {
if (mainPlayer == null) {
mainPlayer = MediaPlayer.create(this, R.raw.session1);
// Get audio duration and set textview
int d = mainPlayer.getDuration();
TextView t = (TextView)findViewById(R.id.totalTime);
t.setText(String.format("%d:%d",
TimeUnit.MILLISECONDS.toMinutes(d),
TimeUnit.MILLISECONDS.toSeconds(d) -
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(d))));
sb.setProgress(0);
sb.setMax(mainPlayer.getDuration());
mainPlayer.start();
timer = new Timer();
timer.schedule(task, 1000);
} else {
mainPlayer.stop();
mainPlayer.release();
mainPlayer = null;
timer.cancel();
task.cancel();
timer = null;
}
}
TimerTask task = new TimerTask(){
public void …Run Code Online (Sandbox Code Playgroud) 我是新来的node和express
我在我的ubuntu 13.10机器上安装了节点和npm.现在,我正在尝试express使用以下命令全局安装(我按照官方网站上的说明)
sudo npm install express -g
Run Code Online (Sandbox Code Playgroud)
但是当我想要做的时候
express --help
Run Code Online (Sandbox Code Playgroud)
要么
express
Run Code Online (Sandbox Code Playgroud)
它在shell中没有任何回馈
在执行时打印日志 sudo npm install express -g
npm http GET https://registry.npmjs.org/express
npm http 304 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/commander/0.6.1
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/mkdirp/0.3.4
npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1
npm http GET https://registry.npmjs.org/cookie/0.1.0
npm http GET https://registry.npmjs.org/fresh/0.1.0
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/send/0.1.0
npm http GET https://registry.npmjs.org/cookie-signature/1.0.1
npm http GET https://registry.npmjs.org/connect/2.7.11
npm http GET https://registry.npmjs.org/methods/0.0.1
npm …Run Code Online (Sandbox Code Playgroud) 我一直在视频网站[平台:php]工作,我需要在亚马逊S3服务器上传视频并提取缩略图.
我已经在该存储桶中成功创建了一个存储桶并上传了视频文件.但我不知道如何从上传的视频中提取缩略图.所以,那就是我陷入困境的地方.
任何帮助将不胜感激.提前致谢!
我正在构建一个独立的Java应用程序.
在那,我必须使用main()方法的类.由于这是所有执行开始的类,我通常放在一个包结构中
com.<company-name>.<project-name>.init
com.<company-name>.<project-name>.main
com.<company-name>.<project-name>.server
com.<company-name>.<project-name>.initializer
Run Code Online (Sandbox Code Playgroud)
我的问题是,
当我尝试将类型(Int,String)的对象添加到我在以下异常中收到的List时:
var data = List((10, "test1"))
data.add((11, "here"))
java.lang.UnsupportedOperationException
java.util.AbstractList.add(AbstractList.java:131)
java.util.AbstractList.add(AbstractList.java:91)
Run Code Online (Sandbox Code Playgroud)
如何将此元组(11,"here")添加到List'数据'?
为什么我收到这个例外?
我有一个基本模板:
<template name="ApplicationLayout">
{{> yield}}
</template>
Run Code Online (Sandbox Code Playgroud)
我使用Iron Router将模板路由到它,如下所示:
Router.configure({
layoutTemplate: 'ApplicationLayout',
notFoundTemplate: 'home'
});
Router.route('/', function () {
this.render('home');
});
Run Code Online (Sandbox Code Playgroud)
每当有人到达该网站时,他们将始终显示agegate模板.单击提交按钮后,我想更改为其他页面(主页).
Template.agegate.events({
"click #submit": function (event) {
this.render('home');
}
});
Run Code Online (Sandbox Code Playgroud)
路由实际上工作(我到达所需的页面),但它会抛出一个错误:
Uncaught TypeError: undefined is not a function
我假设这是因为thisin this.render('home')指的是当前模板,而它需要引用父模板(ApplicationLayout模板).但是,我不知道该怎么做,或者这甚至是相关的.
那么,如何才能在Template事件函数中正确路由?
从Play 2.0.4迁移到Play 2.1.1后,我收到以下错误:
[error] /home/xxx/project/app/controllers/Application.scala:489: type mismatch;
[error] found : play.api.data.Form[contents.Entry]
[error] required: play.data.Form[contents.Entry]
[error] Ok(views.html.shareKnowledge(contentForm, loadEntries(Option(request.user.id), Option(request.user.id), None, None), Map("deleteButton"->"show")))
Run Code Online (Sandbox Code Playgroud)
HTML模板中的相应行是
@(contentForm: Form[contents.Entry], entries: Array[contents.Entry], streamDisplayOptions: Map[String,String])
Run Code Online (Sandbox Code Playgroud)
我只是传了一张表格......
我阅读http://www.playframework.com/documentation/2.1.0/Migration 但我仍然不知道如何解决它.
我有以下两个文件:
MainObject.scala
import mypkg.MyObject._
object MainObject {}
Run Code Online (Sandbox Code Playgroud)
MYPKG/MyObject.scala
package mypkg
object MyObject {}
Run Code Online (Sandbox Code Playgroud)
然后,当我尝试编译时,scalac MainObject.scala我得到了错误
MainObject.scala:1:错误:对象MyObject不是包mypkg的成员
知道为什么会出现这个错误吗?
我有这个小一点的代码,但我不知道为什么它不能读取的值aa.width从aa类ab类.
我正在尝试创建一个基本游戏.该文件ab.java具有print语句.我知道我没有调用函数aa,但这就是java的工作方式.我以为我可以这样做aa.width,我会得到价值,因为它是一个公共变量...感谢您的帮助
aa.java:
package com.Game;
import javax.swing.JFrame;
public class aa {
public static ab f= new ab();
public static int width = 600;
public static int height = 400;
public static void main(String args[]){
f.setSize(width,height);
f.setResizable(false);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setTitle("game first");
f.setLocationRelativeTo(null);
System.out.println("main window running!");
}
}
Run Code Online (Sandbox Code Playgroud)
ab.java
package com.Game;
import java.awt.GridLayout;
import javax.swing.*;
public class ab extends JFrame {
/**
*
*/
private static final long serialVersionUID = …Run Code Online (Sandbox Code Playgroud)