小编use*_*852的帖子

C#\避免内存不足异常

假设我有一个List<T>成员班.假设我不确定将推送多少项(但我不想将其作为阻止列表) - 此列表包含过去24小时内项目的滑动窗口(我使用LINQ查询访问它) ).

是否有一种简洁的方法告诉列表将自己序列化为某个磁盘文件以避免内存不足并在项目从列表中再次删除时自行化?(文件流或其他东西)

或者我是否需要自己编写机制?

c# linq serialization list filestream

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

MVC 4表单 - 提交按钮不执行任何操作

试图在MVC4(+ Razor)中实现一个表单,但是提交按钮没有做任何事情.

控制器(应该获得后期操作):

public class GeneralController
{
    [HttpPost]
    public ActionResult SearchResults(SearchParamsModel searchParams)
    {
        // doin some stuff here
        return View("SearchResultsView");
    }
}
Run Code Online (Sandbox Code Playgroud)

查看(.cshtml)

@model Models.SearchParamsModel 
@using (Html.BeginForm("SearchResults", "General", FormMethod.Post))
{
    <section class="form-field">
        <input type="text" name="Property1" id="Property1" class="field field139 autocomplete-init-no-img" />
        <label for="Property1">value1</label>

        <form action="" method="post" class="clearfix">           
            <input type="submit" value="some value" class="submit btn blue-btn special-submit" />
        </form>
    </section>
}
Run Code Online (Sandbox Code Playgroud)

模型

public class SearchParamsModel 
{
    public string Property1{ get; set; }
}
Run Code Online (Sandbox Code Playgroud)

post submit asp.net-mvc-4

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

当视图使用主布局时,MVC 4 \表单提交按钮不起作用

好吧,经过长时间的调查,似乎当我有一个创建的视图与_layout.cshtml一起工作时 - 我所拥有的表格中的提交按钮不起作用(没有动作返回给控制器)​​.

只有当我创建一个视图并取消选中"使用布局或母版页"时 - 该按钮才有效!

这看起来非常不清楚,所以 - 如何使用一般的_layout.cshtml和一个工作表单按钮同时查看?

下面:尝试在MVC4(+ Razor)中实现一个表单

控制器(应该获得后期操作):

public class GeneralController {
        [HttpPost]
                public ActionResult SearchResults(SearchParamsModel searchParams)
                {
                    // doin some stuff here
                    return View("SearchResultsView");
                }
}
Run Code Online (Sandbox Code Playgroud)

查看(.cshtml)

    @model Models.SearchParamsModel 
     @using (Html.BeginForm("SearchResults", "General", FormMethod.Post))
             {
 <section class="form-field">
                            <input type="text" name="Property1" id="Property1" class="field field139 autocomplete-init-no-img" />
                            <label for="Property1">value1</label>
                <form action="" method="post" class="clearfix">           
                    <input 
                        type="submit" 
                        value="some value" 
                        class="submit btn blue-btn special-submit" />
                </form>
         </section>
        }
Run Code Online (Sandbox Code Playgroud)

模型

public class SearchParamsModel 
    {
        public string Property1{ get; …
Run Code Online (Sandbox Code Playgroud)

forms controller asp.net-mvc-4

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

将初始小时设置为完整日历

完整的日历 - 有没有办法设置小部件的"着陆时间"?目前第一个可见小时是06:00 - 如果我想要看到第一个小时-15:00 - 但我不会失去前几个小时(用户仍然可以向上滚动并看到它们) - 但是最重要的数据通常是从15:00开始......这可以实现吗?

jquery fullcalendar

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

node.js\sanitize html并删除标签

如何判断"sanitize-html"实际删除html标签(仅保留其中的内容)?目前,如果我将它设置为保留div部分,在输出中它也写入<div>some content</div>- 我只想要内部...('一些内容')

简而言之 - 我不想要标签,属性等 - 只有那些元素的内容..

var Crawler = require("js-crawler");
    var download = require("url-download");
    var sanitizeHtml = require('sanitize-html');
    var util = require('util');
    var fs = require('fs');

    new Crawler().configure({depth: 1})
      .crawl("http://www.cnn.com", function onSuccess(page) {

        var clean = sanitizeHtml(page.body,{
         allowedTags: [ 'p', 'em', 'strong','div' ],
        });
        console.log(clean);
        fs.writeFile('sanitized.txt', clean, function (err) {
            if (err) throw err;
            console.log('It\'s saved! in same location.');
        });

        console.log(util.inspect(clean, {showHidden: false, depth: null}));
        var str = JSON.stringify(clean.toString());
        console.log(str);
        /*download(page.url, './download')
        .on('close', function …
Run Code Online (Sandbox Code Playgroud)

html-sanitizing node.js

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

一种在控制台中查看预建步骤输出的方法?

我在预构建步骤中编译另一个需要时间的项目 - 在控制台中看不到任何输出我只是在等待.有没有办法将它输出到控制台?

console visual-studio-2010 pre-build-event

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

删除性能计数器类别失败

我有这个简单的代码:

public void CreateCounters() {
    if (PerformanceCounterCategory.Exists(_categoryName)) {
        PerformanceCounterCategory.Delete(_categoryName);
    }

    // create logic…
}
Run Code Online (Sandbox Code Playgroud)

适用于我的机器.我在我的服务器上运行它,得到以下堆栈跟踪:

System has detected a fatal error. EXITING... 
NativeErrorCode: 1010 
ErrorCode: -2147467259 
Message: The configuration registry key is invalid 
TargetSite: Void RegisterFiles(System.String, Boolean) 
HelpLink:  
Source: System 
Stack Trace: 
 at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister) 
 at System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName) 
 at myApp.Common.Utils.PerformanceCounters.PerformanceCounters.CreateCounters() 
 at myApp.Common.Utils.PerformanceCounters.myAppPerformanceCounterReporter.Init() 
 at myApp.Common.Utils.PerformanceCounters.myAppPerformanceCounterReporter.get_Instance() 
 at myApp.Program.Main(String[] args) 
Run Code Online (Sandbox Code Playgroud)

该类别存在于服务器上,我可以在perfmonGUI中看到它.

c# perfmon performancecounter

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

在HighChart Solid Gauge中隐藏YAxis值

在以下示例中,可以“隐藏” Y轴值-例如-不显示0和200(在左侧)。寻找更清洁的图表。

http://www.highcharts.com/demo/gauge-solid/dark-unica

highcharts gauge

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

run script of batch file from within WIX

I implement wix to generate some msi. I'd like to maintain .bat file (that is packed within this wix project) to contain some work to do (and to be activated with some custom action) I added the .bet to my wix project in VS2010.

My question is

  1. how do I actually wrap it within the msi that on target machine the script will be available to run?
  2. How do I actually refer to that embedded batch file in the custom …

windows-installer wix wix3.5

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

在构建过程中将版本注入 DLL

这是我的情况:

  1. 我有 VS2010 解决方案,其中包含 X 项目。

  2. Wix 项目可以从所有编译的工件创建 msi。

  3. 我有构建机器\ Jenkins,首先编译(MSBuild .Net 4)所有解决方案,然后编译wix以将其打包到msi。

我如何将产品编号(例如 11.2.0.4789)注入到所有工件\dll中 - 尽可能简单?

编译解决方案时是否可以传递命令行参数?

versioning msbuild wix visual-studio-2010 jenkins

0
推荐指数
1
解决办法
2355
查看次数