小编Mik*_*e U的帖子

swift 3错误:参数标签'(_ :)'与任何可用的重载都不匹配

刚刚将项目转换为Swift 3并且无法找出以下错误.

public func currencyString(_ decimals: Int) -> String {

    let formatter = NumberFormatter()
    formatter.numberStyle = .currency
    formatter.maximumFractionDigits = decimals
    return formatter.string(from: NSNumber(self))!
}
Run Code Online (Sandbox Code Playgroud)

返回行显示错误"Argument labels'(_ :)'与任何可用的重载都不匹配"

知道需要改变什么来解决这个问题

swift swift3

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

字符串格式数字数123K,数百万123M,数十亿123B

有没有办法使用字符串格式化器来格式化数千,百万,数十亿到123K,123M,123B,而无需更改代码以将值除以千,百万或十亿?

String.Format("{0:????}", LargeNumber)
Run Code Online (Sandbox Code Playgroud)

c# string-formatting

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

MVC 6托管在IIS HTTP错误500.19上

在Windows 10上访问IIS中的MVC 6应用程序时收到HTTP错误500.19.

在IIS中,我将应用程序池设置为"无托管代码"

该应用程序托管在新网站的根目录中.

我使用Visual Studio 2015使用以下设置发布了应用程序.

配置:调试目标DNX版本:dnx-clr-win-x64.1.0.0-rc1-update1

web.config是Visual Studio提供的样板

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

出了什么问题?

谢谢

麦克风

iis asp.net-core-mvc

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

netstandard20 中的 System.Data.Linq

我有一个引用 .Net 4.6 项目的 netstandard20 项目,除了我调用 .Net 4.6 项目中的任何功能之外,所有编译和运行,我收到以下错误。

FileNotFoundException:无法加载文件或程序集“System.Data.Linq,版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089”。该系统找不到指定的文件。

在2017年VS,在工程资源管理器下Dependancies / SDK / Microsoft.NETCore.App我可以看到System.Data.dllSystem.Data.Common.dll,但没有参考System.Data.Linq.dll,我假定这是我的问题,也没有在被拉开。

如何让我的项目包括在内System.Data.Linq.dll

如果我包括C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Data.Linq.dll我收到以下错误

BadImageFormatException: 无法加载文件或程序集“System.Data.Linq,版本=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”。不应为执行加载引用程序集。它们只能在仅反射加载器上下文中加载。(来自 HRESULT 的异常:0x80131058)

c# .net-standard .net-standard-2.0

12
推荐指数
2
解决办法
9678
查看次数

角 Nginx Docker 404

一直在努力解决这个问题。

我有一个非常简单的带有路由的 Angular 项目,下面是 app.module.ts、nginx.conf 和 docker 文件。

我通过容器启动

docker run --rm -d -p 80:80/tcp demo:latest
Run Code Online (Sandbox Code Playgroud)

浏览到http://localhost和站点工作所有路由呈现

如果我在http://localhost/contact并刷新页面或直接输入 Url,我会从 Nginx 获得 404。

nginx.conf 有 try_files $uri /index.html; 这是所有有类似问题的帖子都说需要设置的。

知道我做错了什么。

docker run --rm -d -p 80:80/tcp demo:latest
Run Code Online (Sandbox Code Playgroud)

配置文件

server {
    listen   80;

    root /usr/share/nginx/html;
    index index.html;

    server_name _;

    location / {
        try_files $uri /index.html;
    }
}
Run Code Online (Sandbox Code Playgroud)

文件

FROM nginx

COPY nginx.conf /etc/nginx/conf.d/

RUN rm -rf /usr/share/nginx/html/*

COPY ./dist /usr/share/nginx/html
Run Code Online (Sandbox Code Playgroud)

nginx http-status-code-404 docker angular

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

asp-validation-summary not showing, field validation working

Im using dotnet core MVC and am having issues with asp-validation-summary.

Validation is working at a field level using asp-validation-for however I am not getting anything showing up in the asp-validation-summary.

<div asp-validation-summary="ModelOnly" class="text-danger"></div>
Run Code Online (Sandbox Code Playgroud)

I have also tried

<div asp-validation-summary="All" class="text-danger"></div>
Run Code Online (Sandbox Code Playgroud)

Any ideas what I am missing.

Done loads of searching and cant see solution to my problem

Thanks

validation asp.net-mvc asp.net-core-mvc .net-core

10
推荐指数
1
解决办法
6401
查看次数

在应用程序和设置日志下的子目录中创建事件日志

我一直在寻找一种在 的子目录下创建多个单独的事件日志的方法Applications and Services Logs,就像有一个子目录Microsoft然后它有一个子目录Windows然后有应用程序登录的各种其他目录一样。

  • 应用程序和服务\Microsoft\Windows\所有用户安装代理
  • 应用程序和服务\Microsoft\Windows\AppHost
  • ...

我想创建如下所示的东西

  • 应用程序和服务\我的公司\应用程序 1
  • 应用程序和服务\我的公司\应用程序 2
  • 应用程序和服务\我的公司\应用程序 3

我遇到的所有示例都只允许您直接在Applications and Services目录下创建日志,而不能创建子目录。

谢谢

c# event-log windows-server-2012-r2

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

jQuery调用函数,每个项目都在选择中

我试图使用jQuery选择中找到的每个对象调用一个函数

<a href="#" class="can-click" data-code="a">a</a>
<a href="#" class="can-click" data-code="b">b</a>
<a href="#" class="can-click" data-code="c">c</a>
<a href="#" class="can-click" data-code="d">d</a>
Run Code Online (Sandbox Code Playgroud)

每个a元素都有一个数据代码值:

<p class="output" data-value="1"></p>
<p class="output" data-value="2"></p>
<p class="output" data-value="3"></p>
Run Code Online (Sandbox Code Playgroud)

每个p元素都有一个数据值:

$(document).ready(function () {
    $(".can-click").click(function () {
    var code = $(this).data("code");
        $("output").each(Display(code));
    });
});
Run Code Online (Sandbox Code Playgroud)

我想要的是,当你点击锚点时,a你会收到一个警告,显示点击锚点的数据代码和每个数据的数据值p,附带代码我想要弹出3个警报.

function Display(code) {

    var p = $(this);
    var value = p.data("value");
        alert(code + " " + value);
}
Run Code Online (Sandbox Code Playgroud)

这是jsfiddle中代码的链接:http://jsfiddle.net/mikeu/XFd4n/

javascript jquery

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

当ajax调用失败时,如何停止引导x-editable来更新已编辑的字段?

当ajax调用失败时,如何停止引导x-editable来更新已编辑的字段?

我正在传递一个函数作为url.

$('.order-price').editable({
    type: "text",
    title: "Order Price",
    url: function (params) {
        var orderID = $(this).data("order-id");
        var data = "OrderID=" + orderID + "&Price=" + params.value;

        $.ajax({
            type: 'post',
            url: '/Trades/SetOrderPrice',
            data: data,
            async: false,
            error: function (xhr, ajaxOptions, thrownError) {
                return false;
                // Do I return something here instead of false?

            }

        })
    }
});
Run Code Online (Sandbox Code Playgroud)

ajax jquery twitter-bootstrap x-editable

7
推荐指数
1
解决办法
4951
查看次数

当我实现UITableViewRowAction时,为什么所有Section Heading行都与表格单元格一起滑动

我有以下swift代码来实现UITableViewRowAction,当我滑动一行时,行按预期向左滑动,但是所有Section Header Rows也同时向下滑动到表行.

我还包括一个屏幕截图来显示正在发生的事情

如果我删除viewForHeader覆盖并用titleForHeaderInSection替换它,那么我没有问题.

覆盖viewForHeader的原因是我想在Header Row中放置一个图像.

override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {

    let cell = tableView.dequeueReusableCellWithIdentifier("header") as UITableViewCell

    cell.textLabel?.text = instrumentGroups[section].name
    cell.imageView?.image = UIImage(named: instrumentGroups[section].name)

    return cell
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> InstrumentTableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("instrumentCell", forIndexPath: indexPath) as InstrumentTableViewCell

    cell.instrument = instrumentGroups[indexPath.section].instruments[indexPath.row]

    return cell
}

override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {

    let instrument = instrumentGroups[indexPath.section].instruments[indexPath.row]

    var actions: [AnyObject] = []

    var action = UITableViewRowAction(style: …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift uitableviewrowaction

6
推荐指数
2
解决办法
2469
查看次数