小编oɔɯ*_*ɯǝɹ的帖子

在Fibonacci序列中,是fib(0)0还是1?

我正在做一个主题的任务是fib(0)被定义为= 1.但那不可能是正确的?fib(0)是0?

Program with fib(0) = 1; spits out fib(4) = 5
Program with fib(0) = 0; spits out fib(3) = 3
Run Code Online (Sandbox Code Playgroud)

什么是正确的定义?

fibonacci

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

如何创建带边框的表单,但没有标题栏?(比如Windows 7上的音量控制)

在Windows 7中,音量混合器窗口具有特定样式,具有粗糙透明边框,但没有标题栏.如何在winforms窗口中重新创建窗口样式?

体积混合器

我尝试将Text设置为string.Empty,将ControlBox设置为false,这将删除标题栏,但边框也会消失:

边界消失了

.net c# windows-7 winforms windows-style-flags

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

ASP.Net httpruntime executionTimeout不工作(和是debug = false)

我们刚刚注意到executionTimeout已停止在我们的网站上工作.去年它肯定在工作......很难说什么时候停止了.

我们目前正在运行:

  • Windows的2008x64
  • IIS7
  • 32位二进制文​​件
  • 管理管道模式=经典
  • 框架版本= v2.0

Web.Config有

<compilation defaultLanguage="vb" debug="false" batch="true">
<httpRuntime executionTimeout="90" />
Run Code Online (Sandbox Code Playgroud)

我们为什么一直看到Timetaken到20分钟的任何暗示.DebugType(完全vs pdbonly)的编译选项会有任何影响吗?

datetime       timetaken httpmethod Status  Sent    Received<BR>
12/19/10 0:10  901338    POST       302 456 24273<BR>
12/19/10 0:18  1817446   POST       302 0   114236<BR>
12/19/10 0:16  246923    POST       400 0   28512<BR>
12/19/10 0:12  220450    POST       302 0   65227<BR>
12/19/10 0:22  400150    GET        200 180835  416<BR>
12/19/10 0:20  335455    POST       400 0   36135<BR>
12/19/10 0:57  213210    POST       302 0   51558<BR>
12/19/10 0:48  352742    POST       302 438 25802<BR> …
Run Code Online (Sandbox Code Playgroud)

asp.net httpruntime executiontimeout

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

VSCode自动在终端中打开Git shell - 如何禁用它?

从上一个VSCode版本开始,有一个弹出窗口询问我是否要允许Git打开.好吧,我允许这个,现在每当我尝试打开集成终端时,Git Shell会在外部打开并关闭集成终端.

我的用户配置:

"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"

但它没有帮助,因为git已经在运行.

我想打开powershell,并在VSCode中使用git shell,就像之前一样.我怎样才能做到这一点?

更新:

我git config -l --show-origin按照VonC的建议运行:

file:"C:\\ProgramData/Git/config"       core.symlinks=false
file:"C:\\ProgramData/Git/config"       core.autocrlf=true
file:"C:\\ProgramData/Git/config"       core.fscache=true
file:"C:\\ProgramData/Git/config"       color.diff=auto
file:"C:\\ProgramData/Git/config"       color.status=auto
file:"C:\\ProgramData/Git/config"       color.branch=auto
file:"C:\\ProgramData/Git/config"       color.interactive=true
file:"C:\\ProgramData/Git/config"       help.format=html
file:"C:\\ProgramData/Git/config"       http.sslcainfo=D:/TOOLS/Git/mingw64/ssl/certs/ca-bundle.crt
file:"C:\\ProgramData/Git/config"       diff.astextplain.textconv=astextplain
file:"C:\\ProgramData/Git/config"       rebase.autosquash=true
file:"D:\\TOOLS\\Git\\mingw64/etc/gitconfig"    credential.helper=manager
file:C:/Users/myusername/.gitconfig  filter.lfs.clean=git-lfs clean -- %f
file:C:/Users/myusername/.gitconfig  filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Users/myusername/.gitconfig  filter.lfs.process=git-lfs filter-process
file:C:/Users/myusername/.gitconfig  filter.lfs.required=true
file:C:/Users/myusername/.gitconfig  user.name=MYName
file:C:/Users/myusername/.gitconfig  user.email=some@email.com
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=false
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.symlinks=false
file:.git/config        core.ignorecase=true
file:.git/config        remote.origin.url=https://github.com/MyProject/my-project.git
file:.git/config        remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config        branch.master.remote=origin
file:.git/config        branch.master.merge=refs/heads/master
file:.git/config        branch.routing.remote=origin …
Run Code Online (Sandbox Code Playgroud)

git git-shell visual-studio-code vscode-settings

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

使空间像Visual Studio中的选项卡一样工作的提示

在工作中,我们有使用4个空格进行代码缩进的约定.我习惯于使用tabs缩进,但想遵循惯例.

注意:我不打算在这里开始讨论空格与标签.

我调整了我的Visual Studio设置以用4个空格替换选项卡,但我有一些问题调整为使用空格.

例如:

  • 如何轻松取消缩进代码?对于tab字符,我只需要使用backspace一次,我需要使用backspace 4次空格.

  • 如何确保始终有正确数量的空间(不是三个或五个)?

  • 如何使用标签尽可能快地浏览我的代码?(向左或向右箭头跳转到带有制表符的下一个缩进,但只移动一个带空格的位置)

  • 比较文件时如何忽略空格更改?

理想情况下,我希望这些用于缩进的4个空格能够同等地用于制表符.

我主要使用c#和基于XML的文件.

欢迎任何提示!

c# xml visual-studio-2010 visual-studio

15
推荐指数
2
解决办法
3373
查看次数

单元测试 - 扩展Visual Studio单元测试类型 - 不工作

我们被要求从NUnit迁移到MSTest,现在必须将所有现有测试转换为新平台.大多数转换得很好但我们有参数化测试的问题.我们发现以下网站显示了如何编写扩展并下载了代码.

http://blogs.msdn.com/b/vstsqualitytools/archive/2009/09/04/extending-the-visual-studio-unit-test-type-part-2.aspx

但是,虽然它编译得很好,但RowTestClass测试都无法运行,并显示以下错误消息:

"无法初始化单元测试扩展'urn:RunAsTestClassAttribute':未为以下属性注册单元测试扩展:Microsoft.VisualStudio.Test.Sample.UnitTestTypeExtension.RunAsSample.RunAsTestClassAttribute."

我们正在使用VS2010(10.0.40219.1 SP1Rel)(Microsoft .NET Framework版本4.0.30319 SP1Rel)

我想知道它是否与以下库有关:

Microsoft.VisualStudio.QualityTools.Common.dll
Runtime Version: v2.0.50727

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.VisualStudio.QualityTools.Common.dll

Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Runtime Version: v4.0.30319

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

Microsoft.VisualStudio.QualityTools.Vsip.dll
v4.0.30319

C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Vsip\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Vsip.dll
Run Code Online (Sandbox Code Playgroud)

任何帮助使这项工作非常感谢.

c# unit-testing visual-studio-2010 visual-studio vs-unit-testing-framework

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

最小化asp.net的启动时间

我在IIS中运行多个Web服务(WCF).当服务温暖(加载)时,典型的请求大约需要0.5秒才能完成.但是,当应用程序不热(冷启动)时,在服务启动并运行之前,第一次命中需要大约20秒.发生应用程序池循环时会发生同样的情况.

我希望减少此Web服务的冷启动时间.我已经执行的一些操作是:

  • 配置应用程序池,使其在20分钟后空闲时间不再循环(以便应用程序保持温暖).这可以最大限度地减少冷启动的发生,但不会使冷启动更快.应用程序池回收现在有限,但确实发生了.

  • 修改了machine.config,

像这样:

<runtime>
    <!-- see http://msdn.microsoft.com/en-us/library/bb629393(v=vs.90).aspx -->
    <generatePublisherEvidence enabled="false"/>
</runtime>
Run Code Online (Sandbox Code Playgroud)

这将启动时间从20秒减少到大约10秒.

  • 我试过NGEN用来预编译程序集,

像这样

for %d in (*.dll) do ngen install %d
Run Code Online (Sandbox Code Playgroud)

这不会减少启动时间(只会增加部署的复杂性).

我真的希望进一步缩短冷启动时间.我有什么选择呢?

(旁注:找出启动时间花在哪里的最佳方法是什么?我如何监控正在发生的事情?)

.net asp.net iis performance startup

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

C#/ .Net中"新"属性的优缺点?

考虑以下示例代码:

// delivery strategies
public abstract class DeliveryStrategy { ... }
public class ParcelDelivery : DeliveryStrategy { ... }
public class ShippingContainer : DeliveryStrategy { ... }
Run Code Online (Sandbox Code Playgroud)

和以下示例Order类:

// order (base) class
public abstract class Order
{
    private DeliveryStrategy delivery;

    protected Order(DeliveryStrategy delivery)
    {
        this.delivery = delivery;
    }

    public DeliveryStrategy Delivery
    {
        get { return delivery; }
        protected set { delivery = value; }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我派生出一种新类型的订单类时,它将继承DeliveryStrategy类型的Delivery属性.

现在,当给出CustomerOrders必须使用ParcelDelivery策略交付时,我们可以考虑在CustomerOrder类中" 新 "交付属性:

public class CustomerOrder : Order
{
    public CustomerOrder()
        : base(new …
Run Code Online (Sandbox Code Playgroud)

.net c# properties new-operator

9
推荐指数
3
解决办法
6060
查看次数

渲染输出中缺少HTML块

我管理一个.NET webforms网站,自从我在这里工作之前就遇到了一个奇怪的问题.每隔一段时间就会抛出一个 System.Web.HttpException:从客户端(:)错误电子邮件中检测到一个潜在危险的Request.Path值.

该错误来自网站中随机页面的随机部分,而我注意到的最后一个部分是针对CGI script_name的此条目:

SCRIPT_NAME /Scrienu_6 { border-style:none; }.SystemMenu_7 { background-color:
Run Code Online (Sandbox Code Playgroud)

Looking at the rendered code for the page, it looks like a packet has been dropped near the head of the response and it's slicing off the end of the src portion of a script tag down to partway through an inline style block.

<script type="text/javascript" src="../Scripts/DisableTheScreen.js"></script>
<style type="text/css">
.floatingMenu
{
margin-top: 0px;
}
</style>
<link href="../App_Themes/siteTheme/Button.css" type="text/css" rel="stylesheet" />
<link href="../App_Themes/siteTheme/ConfirmBox.css" type="text/css" rel="stylesheet" /> …
Run Code Online (Sandbox Code Playgroud)

asp.net iis webforms

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

如何在powershell中使用.ps1xml文件显示嵌套集合

我有一个像这样的分层对象结构:

public class Department
{
    public string Name { get; set; }
    public string Manager { get; set; }
    public Employee[] Employees { get; set; }
}

public class Employee
{
    public string Name { get; set;}
    public string Speciallity { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

如何创建自定义.ps1xml文件,让我显示Department(s)如下:

    Department : Testers
    Manager    : P.H. Boss

Name                       Speciallity
----------                 -----------------------------
Some Employee              .Net
Another Employee           BizTalk
Yet Another                PowerShell
...                        ...


    Department : Developers
    Manager    : Wally

Name                       Speciallity
----------                 ----------------------------- …
Run Code Online (Sandbox Code Playgroud)

format powershell

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