当我打开布局编辑器时,eclipse会给出这个错误:
parseSdkContent failed
Could not initialize class android.graphics.Typeface
Run Code Online (Sandbox Code Playgroud)
当我尝试运行项目时,它会给出这个错误:
An internal error occurred during: "Launching myapp".
java.lang.NullPointerException
Run Code Online (Sandbox Code Playgroud)
每次我收到此错误,我都要重启eclipse.有什么解决方案吗?这个问题今天突然开始.
XML文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
>
<RelativeLayout
android:id="@+id/refresh_match_layout"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_centerInParent="true"
android:layout_margin="15dp"
android:background="@drawable/app_detay_lay_bg"
android:orientation="vertical"
android:padding="10dp"
android:visibility="visible" >
<ImageView
android:id="@+id/app_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="10dp"
android:textColor="#ffffff"
android:textSize="20sp" />
<TextView
android:id="@+id/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:textColor="#000000"
android:layout_toRightOf="@+id/app_icon"
android:layout_marginTop="2dp"
android:textSize="20sp" />
<ImageButton
android:id="@+id/app_detail_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="2dp"
android:background="@null"
android:src="@drawable/settings_detail"/>
<ImageButton
android:id="@+id/app_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/app_icon"
android:layout_alignTop="@+id/app_detail_button"
android:background="@null"
android:src="@drawable/settings_remove" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
错误图片:

我可以获得该网站的所有统计数据,aggregation但我想为某个用户提供,例如$where.
所有统计数据:
games.aggregate([{
$group: {
_id: '$id',
game_total: { $sum: '$game_amount'},
game_total_profit: { $sum: '$game_profit'}}
}]).exec(function ( e, d ) {
console.log( d )
})
Run Code Online (Sandbox Code Playgroud)
当我尝试使用$match运算符时,我收到错误:
games.aggregate([{
$match: { '$game_user_id' : '12345789' },
$group: {
_id: '$id',
game_total: { $sum: '$game_amount'},
game_total_profit: { $sum: '$game_profit'}}
}]).exec(function ( e, d ) {
console.log( d )
})
Arguments must be aggregate pipeline operators
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
javascript mongodb node.js mongodb-query aggregation-framework
我想获取所有用户user_totaldocs,user_totalthings并希望对这些变量求和.
怎么可能呢?这是用户架构:
var user_schema = mongoose.Schema({
local : {
...
...
user_id : String,
user_totaldocs : Number,
user_totalthings : Number
....
}
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试加载测试网页(在我的服务器中).页面是:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<iframe width="420" height="315" src="http://www.youtube.com/embed/XGSy3_Czz8k?autoplay=1"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是webView没有加载页面.甚至没有onProgressChanged在%40-50之后调用
此外,从url加载js脚本的所有站点都会出现此问题.包括youtube,fb等.
WebConsole: XMLHttpRequest cannot load https://googleads.g.doubleclick.net/pagead/id. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.youtube.com' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
在这里我的设置
FrameLayout contentFrame = (FrameLayout) findViewById(R.id.ContentFrame);
WebView mWebView = new WebView(this);
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
mWebView.loadUrl("http://ozgur.dk/browser.html");
contentFrame.removeAllViews();
contentFrame.addView(mWebView);
Run Code Online (Sandbox Code Playgroud)
布局:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/ContentFrame"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
Run Code Online (Sandbox Code Playgroud) 我想balance仅使用更新方法汇总旧用户来更新新用户。
users.update({user_id: 12345}, {balance: balanceFromFunc+oldBalance});
Run Code Online (Sandbox Code Playgroud)
有什么简单的方法可以做到这一点吗?还是我必须这样做?:
users.where(.... err, docs){
var oldBalance = users.docs.balance ;
var newBalance = "somevalue";
var NEW_Balance = newBalance + oldBalance;
users.update(...,balance : NEW_BALANCE)
}
Run Code Online (Sandbox Code Playgroud) 我刚刚将node.js,npm和mongodb安装到一个新的Ubuntu 12.04服务器上.当我尝试打开我的网站时,我收到此错误:
/home/proj/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js:402
return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(pa
^
TypeError: Object function Buffer(subject, encoding, offset) {
if (!(this instanceof Buffer)) {
return new Buffer(subject, encoding, offset);
}
var type;
// Are we slicing?
if (typeof offset === 'number') {
this.length = coerce(encoding);
this.parent = subject;
this.offset = offset;
} else {
// Find the length
switch (type = typeof subject) {
case 'number':
this.length = coerce(subject);
break;
case 'string':
this.length = Buffer.byteLength(subject, encoding);
break;
case 'object': // Assume object is an …Run Code Online (Sandbox Code Playgroud) 我想把这两个变量加起来:
xValue 是2.00000000(正面)
yValue 是-0.00001250(负数)
<%= xValue.toFixed(8) + yValue.toFixed(8) %>
Run Code Online (Sandbox Code Playgroud)
输出正在变为: 2.00000000-0.00001250
但我需要看到这个:= 1.9999875
如果我提取变量:
<%= xValue.toFixed(8) - yValue.toFixed(8) %>
Run Code Online (Sandbox Code Playgroud)
没问题:= 2.0000125
我做错了什么?
我有这些数组:
// I want to calculate these arrays each other.
var a = [1,2,3]
var b = [1,2,3]
var c = [3,4,5]
// ->
var result = [5, 8, 11]
Run Code Online (Sandbox Code Playgroud)
我可以用下面的方法计算两个数组但是如何求和n个数组呢?
Array.prototype.Sum = function (arr) {
var s = [];
if (arr != null && this.length == arr.length) {
for (var i = 0; i < arr.length; i++) {
var c = this[i] + arr[i]
s.push(c);
}
}
return s;
}
Run Code Online (Sandbox Code Playgroud)