小编Muk*_*Ram的帖子

INSTALL_FAILED_DUPLICATE_PERMISSION ... C2D_MESSAGE

我在我的应用中使用Google通知,直到现在我在清单中完成了以下操作:

<!-- GCM -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Keeps the processor from sleeping when a message is received. --> 
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <!-- This app has permission to register and receive data message. --> 

<!-- Creates a custom permission so only this app can receive its messages. NOTE: APP_PACKAGE.permission.C2D_MESSAGE -->   
<permission android:name="com.myapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />    
<!-- END GCM -->
Run Code Online (Sandbox Code Playgroud)

它完美运行,直到我将Nexus 7更新为Android 5.0.
现在,当我尝试使用Eclipse在此设备中安装应用程序时,出现此错误:

INSTALL_FAILED_DUPLICATE_PERMISSION perm = com.myapp.permission.C2D_MESSAGE pkg …

android android-notifications google-cloud-messaging android-5.0-lollipop

176
推荐指数
9
解决办法
11万
查看次数

如何在Windows上设置Spark?

我正在尝试在Windows上设置Apache Spark.

经过一番搜索,我明白独立模式就是我想要的.我要下载哪些二进制文件才能在Windows中运行Apache spark?我在火花下载页面看到了带有hadoop和cdh的发行版.

我没有在网上引用这个.我们非常感谢您的分步指南.

windows apache-spark

89
推荐指数
5
解决办法
19万
查看次数

window,window.top和window.parent有什么区别?

我只注意到top,windowparent变量给我相同的值.我在gmail收件箱页面测试了这个.有谁知道这三个值之间有什么区别?

html javascript

60
推荐指数
1
解决办法
4万
查看次数

reshape2融化警告信息

我正在使用melt并遇到以下警告消息:
attributes are not identical across measure variables; they will be dropped

环顾四周后人们提到它是因为变量是不同的类; 但是,我的数据集不是这种情况.

这是数据集:

test <- structure(list(park = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L), .Label = c("miss", "piro", "sacn", "slbe"), class = "factor"), 
    a1.one = structure(c(3L, 1L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 
    3L), .Label = c("agriculture", "beaver", "development", "flooding", 
    "forest_pathogen", "harvest_00_20", "harvest_30_60", "harvest_70_90", 
    "none"), class = "factor"), a2.one = structure(c(6L, 6L, 
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = …
Run Code Online (Sandbox Code Playgroud)

r melt reshape2

52
推荐指数
1
解决办法
4万
查看次数

ASP.NET MVC 5错误处理

我们希望处理403错误,404错误,由于a导致的所有错误,MySpecialDomainException并为所有其他错误(包括IIS配置中的错误!)提供默认错误页面.所有错误都应该返回正确的Razor视图,ErrorController在视图前面有一个非常好的.例如,像这样:

public class ErrorController : Controller
{
    public ViewResult NotFound () { return View(); }
    public ViewResult Forbidden () { return View(); }
    public ViewResult Default ()
    {
        var ex = ObtainExceptionFromSomewhere();
        if(ex is MySpecialDomainException)
            return View("MySpecialDomainException", new ErrorModel { Exception = ex });

        return View("GeneralError", new ErrorModel { Exception = ex });
    }
}
Run Code Online (Sandbox Code Playgroud)

目前,您可以在www上找到许多不同的方法,有些可能已经过时了.在这些:

  • Controller.OnException()
  • 错误过滤器
  • web.config中的customErrors元素
  • 处理Global.asax的Application_Error

Q1:使用ASP.NET MVC 5满足我们要求的推荐方法是什么?

我们还希望捕获IIS主机中发生的错误.Q2:为了防止IIS必须处理任何404,我们考虑添加一个匹配所有可能URL的默认路由 - 这是值得推荐的吗?最好注册IIS的404'?

问题3:甚至可以注册一个可以返回控制器的IIS错误页面,还是仅支持ASPX /静态HTML的IIS?

c# error-handling asp.net-mvc asp.net-mvc-5 asp.net-mvc-5.1

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

Django:从django.urls导入反向; ImportError:没有名为urls的模块

我正在使用民意调查应用程序完成DjangoProject教程.正如教程在第4部分中所述,我试图导入'reverse': from django.urls import reverse但是得到错误:

来自django.urls导入反向ImportError:没有名为urls的模块

我把它改成了ROOT_URLCONF' urls',然而,它也没有用.

感谢任何帮助,谢谢.

settings.py

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3jyaq2i8aii-0m=fqm#7h&ri2+!7x3-x2t(yv1jutwa9kc)t!e'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'polls.apps.PollsConfig',
    'django.contrib.admin',
    'django.contrib.auth', …
Run Code Online (Sandbox Code Playgroud)

python django django-views

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

如何在Flask-SQLAlchemy中声明基本模型类?

我想声明一个所有其他模式对象都可以继承的基类,例如:

class Base(db.Model):
    created_on = db.Column(db.DateTime, default=db.func.now())
    updated_on = db.Column(db.DateTime, default=db.func.now(), onupdate=db.func.now())
Run Code Online (Sandbox Code Playgroud)

然后所有其他模式对象都可以从它继承而不必重复两列的声明.

我如何在Flask-SQLAlchemy中执行此操作?

from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy(app)

class User(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key = True)
    email = db.Column(db.String(255), unique = True)
Run Code Online (Sandbox Code Playgroud)

sqlalchemy flask flask-sqlalchemy

20
推荐指数
1
解决办法
9853
查看次数

删除tinyMCE中的额外p标记

当您从word文档复制并粘贴到tinyMCE编辑器时,有时会出现不需要的<p>标记:

<p>&nbsp;</p>
<div class="starpasspro-example-question">
   <p><strong>Example: Levels of strategy</strong></p>
   <p>Microsoft is one of the world&rsquo;s largest organisations, providing corporate solutions to businesses throughout the world to help them realise their fullest potential. At Microsoft, there are three levels of strategy as follows:</p>
</div>
<p>&nbsp;</p>
Run Code Online (Sandbox Code Playgroud)

这里生成的代码我想以<p>任何方式删除标签吗?

tinymce

14
推荐指数
2
解决办法
2万
查看次数

警告:尝试在视图不在窗口层次结构中的ViewController上显示ViewController

我已经查看过相关问题,但没有解决我的问题.

我试图使用dismissViewControllerAnimated:animated:completionpresentViewControllerAnimated:animated:completion连续.使用故事板,我通过部分卷曲动画模拟呈现InfoController.

部分卷曲显示我想要启动的InfoController上的按钮MFMailComposeViewController.因为部分卷曲部分隐藏了MFMailComposeViewController,我首先要通过取消动画部分卷曲来解除InfoController.然后我想要MFMailComposeViewController动画片.

目前,当我尝试这个时,部分卷曲没有动画,但是MFMailComposeViewController没有得到呈现.我也有一个警告:

警告:尝试在InfoController上显示MFMailComposeViewController:其视图不在窗口层次结构中!

InfoController.h:

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>

@interface InfoController : UIViewController <MFMailComposeViewControllerDelegate>

@property (weak, nonatomic) IBOutlet UIButton *emailMeButton;

-(IBAction)emailMe:(id)sender;

@end
Run Code Online (Sandbox Code Playgroud)

InfoController.m

#import "InfoController.h"

@interface InfoController ()

@end

@implementation InfoController 

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (IBAction)emailMe:(id)sender {
    [self dismissViewControllerAnimated:YES completion:^{
        [self sendMeMail];
    }];
}

- (void)sendMeMail {
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
if([MFMailComposeViewController canSendMail]){
    if(mailController)
    {
        NSLog(@"%@", self); // This returns …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

9
推荐指数
2
解决办法
1万
查看次数

使用 CSS 屏蔽 div

好吧,假设我正在为我的 div 使用以下设置:

.background将包含一个图像。 .overlay会有一个半透明的白色背景作为覆盖层, .inner会有效地屏蔽掉 div 大小的矩形吗?使背景透明并穿过覆盖层 div。

<div class="background">
    <div class="overlay">
        <div class="inner">
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

只用CSS可以实现吗?

html css mask masking

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