小编Que*_*tin的帖子

跨文件扫描全局变量

这是在VS 2013更新3.我声明了变量_variables.scss:

$fontFamily: "Times New Roman", Times, serif;
$shapeColor: #ACAEAA;
...
Run Code Online (Sandbox Code Playgroud)

然后它在我的开头导入,main.scss如下所示:

@import '_variables.scss';
@import '_base.scss'; // not able to use any variables declared in _variables.css
Run Code Online (Sandbox Code Playgroud)

main.scss,所有全局变量都可以正常工作.但是,全局变量都不适用于_base.scss.VS拒绝编译它们并将它们标记为Undeclared Variable.这是VS编译器问题还是我做错了什么?

sass web-essentials visual-studio-2013

21
推荐指数
1
解决办法
5196
查看次数

使用int键时输入字符串格式错误

首先,我想向您保证,我已经在SO上阅读了许多类似标题的帖子.

我已经创建了一个ASP.NET MVC项目,并在本文后面将模板表的键更改为int

http://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity

但是我在这行StartUp.Auth.cs中遇到了运行时错误

getUserIdCallback: (id) => (id.GetUserId<int>()))
Run Code Online (Sandbox Code Playgroud)

Error = System.FormatException:输入字符串的格式不正确.任何帮助表示赞赏.

c# asp.net asp.net-mvc asp.net-identity

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

IE中的Bootstrap select加载时间过长

我正在将1000条记录加载到bootstrap select下拉列表中.在Chrome中需要大约2秒钟,但在IE 9中需要30秒.此外,在IE中取消或x输出引导模式也需要10 + s.API调用没问题,但渲染速度很慢; 有人可以给我一些方向吗?

所以我正在加载客户列表并设置所选.这是代码.

    var customerPicker = $('#customer-picker');
    API.getCustomers().then(function (result) {
        loadDropdown(customerPicker, result.customers); 

        // set the selected to current customer; it takes 10s in IE
        customerPicker.val(currentCustomerId).selectpicker('refresh'); 

        // it takes about 10s in IE too. selector is the bs modal div
        $(selector).css('z-index', '1060').modal('show'); 
    }).catch(function (errorMessage) {
        ToastManager.showError(errorMessage || 'An error occurred while loading customer list. Please try again.');
    });

    function loadDropdown($div, arr) {
        var options = '';
        $.each(arr, function (i, item) {
            options = options + …
Run Code Online (Sandbox Code Playgroud)

jquery twitter-bootstrap bootstrap-modal bootstrap-select

12
推荐指数
1
解决办法
1363
查看次数

DI/IoC for .net mvc async/await

我使用Simple Injector作为我的.Net MVC项目的IoC容器.这是我如何注册服务.

SimpleInjectorInitializer.cs

 public static void Initialize() {
    var container = new Container();

    container.Options.DefaultScopedLifestyle = new WebRequestLifestyle();  
    //container.Options.DefaultScopedLifestyle = new ExecutionContextScopeLifestyle(); // replace last line with this for async/await

    InitializeContainer(container);
    container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
    container.Verify();
    DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
}

private static void InitializeContainer(Container container) {
    container.Register<MyDbContext>(Lifestyle.Scoped);
    container.Register(typeof(IUnitOfWork<>), typeof(UnitOfWork<>), Lifestyle.Scoped);
    container.Register(typeof(IRepository<>), typeof(Repository<>), Lifestyle.Scoped);
    container.Register<ICustomerService, CustomerService>(Lifestyle.Scoped);

    //what does this do by the way?
    //using (container.BeginExecutionContextScope()) {
    //}
}
Run Code Online (Sandbox Code Playgroud)

CustomerController

public interface ICustomerService : IService<Customer> {}

public class CustomerService : BaseService<Customer, MyDbContext>, ICustomerService { …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net-mvc asynchronous simple-injector

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

使用C#从FTP服务器下载名称包含特殊字符的文件

我尝试下载文件,但无法识别所有带有特殊字符的文件。其他文件可以下载,文件名asdf#code@.pdf不能下载。

错误:

远程服务器返回错误:(550) 文件不可用(例如,找不到文件,无法访问)。

在本地,创建了具有正确名称的文件,但它是空的。同样的事情发生在#文件名内部的JPG 文件上。我怎样才能让他们被认可?

//Download the file from remote path on FTP to local path
private static void Download(string remotePath, string localPath)
{
    FtpWebRequest reqFTP;
    try
    {
        reqFTP = GetWebRequest(WebRequestMethods.Ftp.DownloadFile, remotePath);
        FileStream outputStream = new FileStream(localPath, FileMode.Create);

        FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
        Stream ftpStream = response.GetResponseStream();
        long cl = response.ContentLength;
        int bufferSize = 2048;
        int readCount;
        byte[] buffer = new byte[bufferSize];
        readCount = ftpStream.Read(buffer, 0, bufferSize);
        while (readCount > 0)
        {
            outputStream.Write(buffer, 0, readCount);
            readCount …
Run Code Online (Sandbox Code Playgroud)

.net c# ftp character-encoding ftpwebrequest

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

Alert() 不会从数据表的第二页触发

我有一个使用 Jquery 和数据表插件从后端返回的数据表。我需要在数据表中选择订单号并发出警报。警报和控制台在数据表的第一页中运行良好,但从第二页不再触发。我用谷歌搜索了它,但.live()已被弃用,并且建议的答案.on()似乎不起作用。

jQuery:

$(document).ready(function () {
$.ajax({
    type: "POST",
    //url: "OrderDetail.asmx/HelloWorld",
    url: "Order.aspx/GetOrder",
    data: "{'id':'273440'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) {
        $('#order').append(msg.d);
        //alert(msg.d);
        console.log(msg);
        $('#orderTable').dataTable({
            // "sScrollY": "100px",

            "bAutoWidth": false,
            "bDeferRender": true
            //"bPaginate": false

        });
        // Click order number to get the details
        // Problem is here 
        $('.orderNumber').on('click', function () {
            var orderNum = $(this).text();
            console.log(orderNum);
        });

    },
    error: function (xhr, status, error) {
        // Display a generic error for now.
        alert("Ajax …
Run Code Online (Sandbox Code Playgroud)

jquery datatables

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