小编Mr *_*ter的帖子

C#:'lambda expression'和'lambda expression'之间没有隐式转换?

无法确定条件表达式的类型,因为'lambda expression'和'lambda expression'之间没有隐式转换

说什么?有人可以向我解释这个编译错误吗?这是产生它的代码:

    protected override Func<System.IO.Stream> GetStream()
    {
        return someBool
            ? () => EmbeddedResourceExtractor.GetFile("SomeFile1.ext")
            : () => EmbeddedResourceExtractor.GetFile("SomeFile2.ext");
    }
Run Code Online (Sandbox Code Playgroud)

这不是:

    protected override Func<System.IO.Stream> GetStream()
    {
        return () => EmbeddedResourceExtractor.GetFile("SomeFile1.ext");
    }
Run Code Online (Sandbox Code Playgroud)

这两个都没有:

    protected override Func<System.IO.Stream> GetStream()
    {
        if(someBool)
            return () => EmbeddedResourceExtractor.GetFile("SomeFile1.ext");
        return () => EmbeddedResourceExtractor.GetFile("SomeFile2.ext");
    }
Run Code Online (Sandbox Code Playgroud)

c# lambda

37
推荐指数
1
解决办法
7039
查看次数

iPhone,"超过最多5个过滤的专辑列表试图注册.这将失败." 错误

当我尝试从照片库中读取图像时,我收到错误消息"超过最多5个过滤的专辑列表试图注册.这将失败." 图像未读取.

知道如何解决这个问题吗?

iphone xcode uiimagepickercontroller uiimage

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

内部导航被拒绝:iOS上的Cordova中的<allow-navigation not set>

我使用Cordova构建了一个iOS应用程序.该应用程序尝试在index.html中加载网页,例如http://yourdomain.com/home.但是,该页面在控制台"内部导航被拒绝 - <allow-navigation>未设置为url =' http://yourdomain.com/home '" 时出现错误并且出现错误.

我已经设置<access origin="http://yourdomain.com/home" subdomains="true" />并尝试设置<allow-navigation>标签.但页面保持空白.我错过了什么吗?请指导.

在index.html中添加以下元标记后,"内部导航错误"已经消失,但页面仍为空白.:(

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script src: 'self' 'unsafe-inline' 'unsafe-eval'">
Run Code Online (Sandbox Code Playgroud)

webpage ios web cordova cordova-plugins

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

Angular2 Base64清理不安全的URL值

我服务器的响应如下:

[{"coreGoalId":1,"title":"Core goal 1","infrastructure":"Sample Infrastructure","audience":"People","subGoals":null,"benefits":[{"benefitId":1,"what":"string","coreGoalId":1}],"effects":null,"steps":null,"images":[{"imagelId":1,"base64":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcU\nFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wgARCAIWAe4DASIA\nAhEBAxEB/8QAHAABAAIDAQEB"}]}]
Run Code Online (Sandbox Code Playgroud)

我正在尝试显示其中返回的base64图像.

在我的组件中:

ngOnInit() {

    this.homeService.getGoals()
    .subscribe(
        goals => this.coreGoals = goals,
        error =>  this.errorMessage = <any>error);
}
Run Code Online (Sandbox Code Playgroud)

然后在模板中:

<ul>
    <li *ngFor="let goal of coreGoals">
        {{goal.title}}
        <img [src]="'data:image/jpg;base64,'+goal.images[0].base64 | safeHtml" />
    </li>
</ul> 
Run Code Online (Sandbox Code Playgroud)

safeHtml是我创建的管道,如下所示:

import { Pipe } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';

@Pipe({name: 'safeHtml'})
export class SafeHtml {
  constructor(private sanitizer:DomSanitizer){}

  transform(html) {
    return this.sanitizer.bypassSecurityTrustHtml(html);
  }
}
Run Code Online (Sandbox Code Playgroud)

这给了我Required a safe URL, got a HTML错误.这里出了什么问题?如果我从那里删除管道<img />它说不安全的网址.

angular

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

错误包括Latex中的图像

编译我的Latex文件时出现以下错误:

!LaTeX错误:无法确定tree.jpg中的图形大小(无BoundingBox).

为什么我会收到此错误?这与.eps文件有什么关系?

事实上,我可以在我的机器上用MacTex编译好.但是,当我在线提交给科学期刊进行发布时,它会在服务器上编译它并向我发送所有这些错误的PDF,以防止它编译.

我使用以下语法来包含图像:

\begin{figure}[!h]
    \begin{center}
        \scalebox{0.45}{
            \includegraphics{tree.jpg}}
    \end{center}
            \caption{\small A sample}
            \label{tree}
\end{figure}
Run Code Online (Sandbox Code Playgroud)

我该怎么办 ?可能是他们的服务器使用旧的编译器?

更新:它终于奏效了.我将第一张图片转换为PDF格式,编辑完美无缺.我猜它使用了该PDF的边界框值并将其应用于所有图像.

pdf latex eps

34
推荐指数
4
解决办法
12万
查看次数

更新eclipse时出错

我在eclipse中点击更新,我得到一个错误,这是因为我不止一次更新了eclipse.有没有办法修复eclipse并有能力使用更新?

An error occurred while collecting items to be installed
  No repository found containing: org.eclipse.jem/osgi.bundle/2.0.202.v200810282000
  No repository found containing: org.eclipse.jem.workbench/osgi.bundle/2.0.102.v200810230530
  No repository found containing: org.eclipse.jpt.core/osgi.bundle/2.1.0.v200812160210
  No repository found containing: org.eclipse.jpt.doc.user/osgi.bundle/1.0.300.v200812110000
  No repository found containing: org.eclipse.jpt.eclipselink.core/osgi.bundle/1.1.0.v200812110000
  No repository found containing: org.eclipse.jpt.eclipselink.core.ddlgen/osgi.bundle/1.0.100.v200811030000
  No repository found containing: org.eclipse.jpt.eclipselink.feature/org.eclipse.update.feature/2.1.0.v200812180210-318Y9oA55S8_795555
  No repository found containing: org.eclipse.jpt.eclipselink.ui/osgi.bundle/1.1.0.v200812100000
  No repository found containing: org.eclipse.jpt.feature/org.eclipse.update.feature/2.1.0.v200812180210-7979AgCYQCD4IRJdCEDC
  No repository found containing: org.eclipse.jpt.ui/osgi.bundle/2.1.0.v200812080000
  No repository found containing: org.eclipse.jst.common.frameworks/osgi.bundle/1.1.201.v200810161330
  No repository found containing: org.eclipse.jst.ejb.doc.user/osgi.bundle/1.1.100.v200810092245
  No repository found containing: org.eclipse.jst.ejb.ui/osgi.bundle/1.1.203.v200810010400
  No repository found containing: org.eclipse.jst.enterprise_core.feature/org.eclipse.update.feature/3.0.3.v200810010400-42E_4_kE77c_FAP7X99 …

eclipse eclipse-plugin

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

Bootstrap中的流体容器3

如何在bootstrap 3中制作流体容器?

在bootstrap 2.3.2 .container-fluid中有类.但现在在bootstrap 3中它缺失了,只有.container类.请帮我.

css less twitter-bootstrap twitter-bootstrap-3

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

击败"多个名为'xxx:'found"的方法错误

在我的ViewController.m文件中的当前项目中,我正在运行该方法:

[[connection writer] writeData: data];
Run Code Online (Sandbox Code Playgroud)

它返回警告:

warning: multiple methods named 'writeData:' found
Run Code Online (Sandbox Code Playgroud)

我试图调用该方法:

- (void) writeData: (NSData*)data
Run Code Online (Sandbox Code Playgroud)

...在TCPWriter.m中.不幸的是,还有另外两种writeData方法

- (void)writeData:(NSData *)data;
Run Code Online (Sandbox Code Playgroud)

...在NSFileHandle.h和......

- (BOOL)writeData:(NSData *)data
Run Code Online (Sandbox Code Playgroud)

......在NSURLHandle.h.这对我来说尤其令人困惑,因为[conn writer]应该返回TCPWriter类,该类应该调用正确的writeData方法.此外,我甚至不完全确定NSFileHandle.h和NSURLHandle.h甚至包含在ViewController.h中包含的任何库中,而不是包含在项目的不同部分中.

如何向编译器显示writeData我想要调用的方法以及为什么会发生此错误?

xcode warnings objective-c

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

我怎样才能将argv []作为int?

我有一段这样的代码:

int main (int argc, char *argv[]) 
{
   printf("%d\t",(int)argv[1]);
   printf("%s\t",(int)argv[1]);
}
Run Code Online (Sandbox Code Playgroud)

在shell中我这样做:

./test 7

但是第一个printf结果不是7,我怎样才能将argv []作为int?非常感谢

c

29
推荐指数
4
解决办法
9万
查看次数

消息队列错误:找不到能够读取消息的格式化程序

我正在使用C#将消息写入消息队列,如下所示:

queue.Send(new Message("message"));
Run Code Online (Sandbox Code Playgroud)

我正在尝试阅读如下消息:

Messages messages = queue.GetAllMessages();
foreach(Message m in messages)
{
  String message = m.Body;
  //do something with string
}
Run Code Online (Sandbox Code Playgroud)

但是我收到一条错误消息,上面写着:"找不到能够读取此消息的格式化程序."

我究竟做错了什么?

c# message-queue

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