小编Kyl*_*Mit的帖子

vs 2012:Shims编译

我试图在VS 2012终极中制作一个垫片,如MSDN网站中所述:

[TestClass]
public class TestClass1
{ 
    [TestMethod]
    public void TestCurrentYear()
    {
        int fixedYear = 2000;

        using (ShimsContext.Create())
        {
          // Arrange:
          // Detour DateTime.Now to return a fixed date:
          System.Fakes.ShimDateTime.NowGet = 
              () =>
              { return new DateTime(fixedYear, 1, 1); };

          // Instantiate the component under test:
          var componentUnderTest = new MyComponent();

          // Act:
          int year = componentUnderTest.GetTheCurrentYear();

          // Assert: 
          // This will always be true if the component is working:
          Assert.AreEqual(fixedYear, year);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

请参阅http://msdn.microsoft.com/en-us/library/hh549176.aspx

但是当我编译我的测试项目时,我在输出中得到了一个概念:

警告:无法生成一些假货.有关完整的详细信息,请将此文件中Fakes元素的Diagnostic属性设置为"true"并重建项目.

我该如何解决此警告?

shim microsoft-fakes visual-studio-2012

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

Bootstrap glyphicons在生产中出错404

我正在使用bootstrap-sass-rails 这个问题,当我在生产模式下运行rails项目时,我得到3x 404错误:

GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.woff 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.woff:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.ttf 404 (Not Found) assets/twitter/bootstrap/glyphicons-halflings-regular.ttf:1
GET http://localhost:3000/assets/twitter/bootstrap/glyphicons-halflings-regular.svg 404 (Not Found) 
Run Code Online (Sandbox Code Playgroud)

我使用了rake资产:预编译RAILS_ENV = production来生成带有结果的静态文件:

I, [2013-11-07T16:52:25.269370 #12948]  INFO -- : Writing myproject/public/assets/application-3517eb39b597107b3dbccbcbf4f0b3cc.js
I, [2013-11-07T16:52:25.315358 #12948]  INFO -- : Writing myproject/public/assets/application-1459bfe79a6477170658d53257e4a8fd.css
I, [2013-11-07T16:52:25.334356 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8b1bdc16b9e098d67afebbf8d59fcea7.eot
I, [2013-11-07T16:52:25.345360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-8d8305e5b6a807076d3ec68e2f190674.svg
I, [2013-11-07T16:52:25.357360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-946071b70245967633bb3a774c60f3a3.ttf
I, [2013-11-07T16:52:25.367360 #12948]  INFO -- : Writing myproject/public/assets/twitter/bootstrap/glyphicons-halflings-regular-d7e2274ad1d940a0b2ce7480810ab223.woff
etc ...
Run Code Online (Sandbox Code Playgroud)

除了这3个字体文件外,所有资产都正常工作.我整天搜查,没有找到任何东西.似乎rails正在寻找没有这三个文件的哈希的版本,但是rake用哈希生成它们

我的config/production.rb:

  config.cache_classes = true
  config.eager_load …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails bootstrap-sass twitter-bootstrap-3

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

Powershell通过网络复制文件

尝试将一些文件从服务器本地复制到网络共享,如下图所示:

文件夹1

在此输入图像描述

文件夹2

在此输入图像描述

我需要实现的是将SOURCE下的ROOT文件夹的所有内容复制到DESTINATION文件夹.但每次复制内容时,我都希望它创建一个具有相同目标文件夹名称但后缀为某种顺序编号的新文件夹.SOURCE/ROOT文件夹中的文件夹和文件数始终保持不变(2个文件夹和2个文件).每次运行脚本时,我只需要将所有这些源内容放入目标的新文件夹中.这是我一直尝试的脚本示例,但它不是我需要的:

$date = Get-Date -format MMMM-dd-yyyy
$date2 = Get-Date -format yyyyMMdd

$Source = "C:\SOURCE\ROOT"

$Destination1 = "\\netshare\DESTINATION\DATA_May-26-2014"
$Destination2 = "\\netshare\DESTINATION\DATA_May-26-2014-1st"
$Destination3 = "\\netshare\DESTINATION\DATA_May-26-2014-2nd"
$Destination4 = "\\netshare\DESTINATION\DATA_May-26-2014-3rd"
$Destination5 = "\\netshare\DESTINATION\DATA_May-26-2014-4th"
$Destination6 = "\\netshare\DESTINATION\DATA_May-26-2014-5th"

#Check destination path
if (Test-Path $Destination1)
 {
  #then copy
  robocopy $Source $Destination2 /MIR /Z /E /fft /MAXAGE:$date2
 }
if (Test-Path $Destination2)
 {
  #then copy
  robocopy $Source $Destination3 /MIR /Z /E /fft /MAXAGE:$date2
 }
if (Test-Path $Destination3)
 {
  #then copy
  robocopy $Source $Destination4 /MIR /Z /E …
Run Code Online (Sandbox Code Playgroud)

powershell copy

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

CSS box-shadow仅显示边距

所以,我的网站有一个标题和一个包含Revolution Slider的div.我正在尝试在标题下方添加一个框阴影 - 并在滑块上方.但它不起作用,除非我也添加margin-bottom到标题 - 但这使得整个练习没有实际意义.

这是代码:

#header {
  display:block;
  min-height: 99px;
  background: #FFFFFF;
  border-top: 3px solid #8dddcd;
  border-bottom: 1px solid #ecf0f1;
  line-height: 99px;
  box-shadow: 0 10px 10px 10px rgba(0,0,0,0.3);
}
#rev {
  position: relative;
}
Run Code Online (Sandbox Code Playgroud)
<div id="header"></div>
<div id="rev">the slider</div>
Run Code Online (Sandbox Code Playgroud)

有人可以帮我找出导致这种情况的原因吗?

html css css3 box-shadow

10
推荐指数
2
解决办法
6720
查看次数

当前打开的文件夹没有git存储库

我正在使用一台装有 Windows 操作系统的工作 PC,并且习惯于使用 ubuntu 操作系统进行 Rails 开发。我在 VSCode 上使用 wsl 作为 ubuntu 正确安装了所有内容,在 Windows 上使用 git 正确安装了所有内容,但问题是源代码控制面板没有检测到任何内容,它只是显示以下内容:

VS Code 中源代码控制面板的屏幕截图

我该如何解决这个问题?

这是我的安装参考。

  • 视觉工作室代码 https://code.visualstudio.com/
  • 世界SLhttps://learn.microsoft.com/en-us/windows/wsl/install
  • githttps://git-scm.com/download/win

git visual-studio-code git-for-windows

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

ASP.NET OutputCache和Cookies

有谁知道为什么如果我的页面上有cookie,输出缓存不起作用!

示例页面

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ct.aspx.vb" Inherits="ct" %>
<%@ OutputCache Duration="600" Location="Server" VaryByParam="none" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <h1>Cache test</h1>
      <p id="rndout" runat="server"></p>
    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

后面的示例代码:

Partial Class ct
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Dim rc As New Random()
        Dim rn As Integer
        rn = rc.Next()
        rndout.InnerHtml = rn.ToString

        Response.Cookies("sym")("hello") = "world"
        Response.Cookies("sym").Expires = DateTime.Now.AddDays(370) …
Run Code Online (Sandbox Code Playgroud)

asp.net cookies outputcache

9
推荐指数
2
解决办法
7497
查看次数

使用HTML/JavaScript/CSS沿圆形路径移动div

我想使用HTML/CSS/JavaScript沿着圆形路径移动一个圆圈.有没有办法实现这个目标?圆圈的代码添加如下:

.circle {
    width: 50px;
    height: 50px;
    display: block;
    -webkit-border-radius: 50px;
     -khtml-border-radius: 50px;
       -moz-border-radius: 50px;
            border-radius: 50px;
    color: #fff;
    background-color: #b9c1de;
}
Run Code Online (Sandbox Code Playgroud)
<div class="circle"></div>
Run Code Online (Sandbox Code Playgroud)

html javascript css css3

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

Javascript与Bootstrap崩溃插件切换

我尝试以编程方式使用Bootstrap崩溃插件的切换功能.当我点击手风琴标题中的链接时,我设法切换div,但它只能运行一次,也就是说我无法再次点击隐藏div.

这是我的代码:

<div id="accordion" class="accordion">
    <div class="accordion-group">
        <div class="accordion-heading">
            <a id="program${bean.id}" data-parent="#accordion" 
                   class="accordion-toggle">
            ...
            </a>
        </div>
        <div id="collapse${bean.id}" class="accordion-body collapse">
            <div class="accordion-inner">
            ...
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

后来在JSP中:

$.each($('#accordion a.accordion-toggle'), function(i, link){
    $(link).on('click', 
        function(){
            // ...
            $('#collapse' + id_of_a_bean).collapse({
                toggle : true,
                parent : '#accordion'
            });
            // ...
        }
    )
});
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

toggle collapse twitter-bootstrap

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

如何将ConfigurationManager.AppSettings与自定义部分一起使用?

我需要使用App.config文件获取" http://example.com ".

但目前我正在使用:

string peopleXMLPath = ConfigurationManager.AppSettings["server"];
Run Code Online (Sandbox Code Playgroud)

我无法获得价值.

你能指出我做错了什么吗?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
    <section name="device" type="System.Configuration.SingleTagSectionHandler" />
    <section name="server" type="System.Configuration.SingleTagSectionHandler" />
  </configSections>
  <device id="1" description="petras room" location="" mall="" />
  <server url="http://example.com" />
</configuration>
Run Code Online (Sandbox Code Playgroud)

.net c# wpf appsettings

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

正在报告计算时间的 Visual Studio 诊断工具

我无法共享整个代码库来重现该问题,但我正在使用Visual Studio 诊断工具来检查性能,并且执行 CPU 使用率报告的操作所需的时间要长很多倍。

示例代码

这是两个断点之间有问题的代码块的示例:

诊断入口点

分析时间

此方法中的 CPU 示例仅表明执行时间约为1000 毫秒

CPU使用率

被叫方

轮廓

执行时间处理时间

但是,断点之间需要将近50 秒

诊断时间表

  • 什么可能导致如此长的执行时间线在分析时不显示?

我尝试过的事情:

  • 重启VS
  • 重启机器
  • 重新加载符号
  • 缓存符号

.net asp.net profiler visual-studio visual-studio-2017

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