小编Spe*_*ets的帖子

Visual Studio 2015非常慢

我刚刚完成安装,整个IDE超级慢.看起来它在背景中进行了一些繁重的CPU调用,整个IDE实际上已经冻结并且在大约2-3秒内没有响应.

我没有使用Visual Studio 2013 Ultimate这个问题.我正在运行Visual Studio 2015 Professional.

已安装的附加组件/包:

  • Node.js工具
  • ReSharper的

有人有主意吗?

visual-studio-2015

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

Visual Studio:Git Team Explorer不显示任何更改

当我第一次将项目添加到源代码控制(GIT)时,它将显示所有文件,一切都将是桃子.我可以继续工作大约30分钟-1小时,所有的更改都会显示出来(我做的任何文件都会更改).

但经过一段时间后,它表明无论我做了多少更改,都不会编辑任何文件.我只是不明白......我看了.gitignore文件,我没有看到我正在使用的任何文件类型,所以我不知道到底发生了什么.

我正在使用多层MVC应用程序,因此有很多C#,一堆.cshtml等等.

提示?谷歌找不到任何东西.这是.gitignore文件......我和这个家伙有同样的问题......他没有回答!

当我保存带有更改的文件时,其状态会自动返回到未更改/已提交(蓝色锁定)

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc …
Run Code Online (Sandbox Code Playgroud)

c# git visual-studio

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

Javascript 等效于 Matlab 函数的函数:Polyfit/Polyval?

迫切需要一个相当于 Matlab 中存在的 polyval 和 polyfit 函数的 Javascript。本质上,matlab 中的那些函数根据指定的多项式基于两个大小相同的数组进行曲线拟合。我需要在 javascript 中做一些涉及曲线拟合的计算,但我一生都找不到等效的函数。

这是MatLab对polyfit函数的解释

"P = POLYFIT(X,Y,N) 找出 N 次多项式 P(X) 的系数,它在最小二乘意义上最适合数据 Y。P 是长度为 N+1 的行向量,包含多项式降幂系数,P(1)*X^N + P(2)*X^(N-1) +...+ P(N)*X + P(N+1)。”

这是 MatLab 对 polyval 的解释。

"POLYVAL 求值多项式。Y = POLYVAL(P,X) 返回在 X 处求值的多项式 P 的值。P 是长度为 N+1 的向量,其元素是多项式的降幂系数。

    Y = P(1)*X^N + P(2)*X^(N-1) + ... + P(N)*X + P(N+1)"
Run Code Online (Sandbox Code Playgroud)

任何帮助都会是超级的。

问候,

javascript math matlab linear-algebra

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

与数据库的连接失败.检查连接字符串是否正确以及DbContext构造函数

访问数据库时出错.这通常意味着与数据库的连接失败.检查连接字符串是否正确,以及是否使用了相应的DbContext构造函数来指定它或在应用程序的配置文件中找到它.

我发誓我尝试了一切!完成本教程并努力获得与数据库的连接.

我在SQL Server 2012中的表名为"tblEmployee",数据库名为"Sample"

这是Employee.cs类

[Table("tblEmployee")]
public class Employee
{
    public int EmployeeID { get; set; }
    public string Name { get; set; }
    public string City { get; set; }
    public string Gender { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

这是员工上下文模型类

public class EmployeeContext : DbContext
{
    public DbSet<Employee> Employees { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

这是EmployeeControler

public class EmployeeController : Controller
{
    public ActionResult Details()
    {
        EmployeeContext employeeContext = new EmployeeContext();
        Employee employee = employeeContext.Employees.Single(emp => emp.EmployeeID == 2);
        return …
Run Code Online (Sandbox Code Playgroud)

c# sql-server asp.net-mvc entity-framework

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

Font-Awesome fa-circle with two colors?

I'm trying to get a half circle like onto my page but I'm struggling a bit using fa fa-adjust

<i class="fa fa-adjust" style="color: green"></i>
Run Code Online (Sandbox Code Playgroud)

At this point I cant change the left side of the circle. Can a CSS wizard please help me so I can configure the two colors of the circle? I want the right side to be green and the left to be gray.

Below is the circle I want(ideally), WITH the same CSS settings as the …

html css

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

实体框架代码首先在Controller中使用上下文

我终于让我的代码按预期工作但我无法弄清楚为什么以前我设置它的方法不起作用.我一直得到一个空引用异常,具体来说,"对象引用未设置为对象的实例.我想要做的是传入一个只读的BlogDb模型并在整个控制器中使用LINQ查询,但似乎每个控制器动作我必须传入BlogDb模型.

private readonly BlogDb model;

public PostsController(BlogDb model)
{
    this.model = model;
}

public ActionResult Index()
{
    return View();
}

[ValidateInput(false)]
public ActionResult Update(int? id, string title, string body, DateTime date, string tags)
{
    var _db  = new BlogDb();

    if (!IsAdmin)
    {
        RedirectToAction("Index");
    }
    if (ModelState.IsValid)
    {
        Post post = GetPost(id);
        post.Title = title;
        post.Body = body;
        post.Date = date;
        post.Tags.Clear();

        tags = tags ?? string.Empty;
        string[] tagNames = tags.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        foreach (string tagName in …
Run Code Online (Sandbox Code Playgroud)

c# linq asp.net-mvc entity-framework

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

使用jQuery在MVC中的DisplayFor和EditorFor之间切换

必须有一种方法可以在我的View上切换DisplayFor和EditorFor div.我想单击"显示"字段旁边的"编辑"按钮,并隐藏DisplayFor元素并显示EditorFor字段.完成文本更新后,我想在"编辑器"字段中提交表单和数据.

我不确定为什么这不起作用,提示?

我的jQuery

<script type="text/javascript">

function myFunction(element) {

    $(element).find("span.item-display").html($(element).find("span.item-field").find(":input:first").val());
    $(element).find("span.item-display")
        .show()
        .next("span.item-field")
        .hide();
}
Run Code Online (Sandbox Code Playgroud)

我的HTML视图

<dt><strong>@Html.LabelFor(m => m.FirstName) </strong></dt>
        <dd>
            <span class="item-display">
                @Html.DisplayFor(m => m.FirstName)
            </span>
            <span class="item-field" style="display:none">
                @Html.EditorFor(m => m.FirstName)
            </span>

            <span>
                <button type="button" onclick="myFunction(this)" />

            </span>
        </dd>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery

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

DropDownListFor在静态状态列表上

我发誓我有一段时间试图从静态状态列表中填充DropDownList.我希望通过EntityFramework从db预先填充此列表.

我的RegisterViewModel

public class RegisterViewModel
{
    [Required(ErrorMessage = "You can't leave this empty")]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 4)]
    [Display(Name = "User name")]
    [RegularExpression(@"^[a-zA-Z0-9]*$", ErrorMessage = "The username can only be comprised of letters.")]
    public string UserName { get; set; }

    [Required(ErrorMessage = "You can't leave this empty")]
    [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 8)]
    [DataType(DataType.Password)]
    [Display(Name = "Password")]
    public string Password { …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc html.dropdownlistfor

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