小编Bre*_*ias的帖子

Boost StateCharts与Samek的"量子状态图"的比较

我曾经沉迷于Miro Samek的"量子分层状态机",但我想知道它与Boost StateCharts的比较 - 正如曾与两者合作的人所说的那样.任何接受者?

c++ comparison boost state-machine

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

Monitor.Wait和"exitContext"参数

MSDN文档说明了"exitContext"布尔参数:

如果等待,则返回并重新获取上下文的同步域(如果在同步上下文中); 否则,错误.

我不跟随.假设我已经理解脉冲并等待,那么任何人都可以给出这个参数的手持解释吗?使用它的一个实际例子非常有价值.

.net c# multithreading synchronization

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

接口/抽象类编码标准

我发现了一个提议的C#编码标准,它说"尝试提供一个包含所有抽象类的接口".有人知道这个的理由吗?

.net c# abstract-class coding-style interface

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

为什么ofstream需要刷新?

如果我运行以下代码,则根本不会创建任何文件:

std::ofstream outputFile(strOutputLocation.c_str(), std::ios::binary);
outputFile.write((const char*)lpResLock, dwSizeRes);
outputFile.close();
Run Code Online (Sandbox Code Playgroud)

但是,如果我在关闭之前添加flush(),它可以工作:

std::ofstream outputFile(strOutputLocation.c_str(), std::ios::binary);
outputFile.write((const char*)lpResLock, dwSizeRes);
outputFile.flush();
outputFile.close();
Run Code Online (Sandbox Code Playgroud)

标准库是否真的需要这个,或者它是Visual C++ CRT中的错误?

c++ file stream standard-library

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

如何拆分平面文件数据并加载到数据库中的父子表?

我有需要导入父子表的非规范化数据(来自文件).源数据是这样的:

Account#    Name        Membership    Email
101         J Burns     Gold          alpha@foo.com
101         J Burns     Gold          bravo@foo.com
101         J Burns     Gold          charlie@yay.com
227         H Gordon    Silver        red@color.com
350         B Clyde     Silver        italian@food.com
350         B Clyde     Silver        mexican@food.com
Run Code Online (Sandbox Code Playgroud)

我应该使用SSIS的哪些部分,部分或策略将前三列读入父表,将第4列(电子邮件)读入子表?我可以选择父键的几个选项:

  • 直接使用Account#作为主键
  • 在导入过程中使用SSIS生成的代理键
  • 配置身份主键

我确定我已经按照增加的难度顺序列出了我的主键选项.我有兴趣知道如何做第一个和最后一个选项 - 我将推断如何实现中间选项.再次强调,我对一个明确的SSIS解决方案很感兴趣; 我正在寻找一个使用SSIS语言的答案,而不是一个程序性的,技术中立的答案.

我的问题有点类似于另一个SO问题,有一个模糊可行性的答案.我希望能给出更详细的指导.我已经知道如何通过创建一个"临时"中间步骤来解决这个问题,其中父子分离实际上是用直接SQL处理的.但是,我很好奇如果没有这种中间步骤可以做到这一点.

在我看来,这种导入是如此常见,以至于会有一种公开的公式化方法来处理它 - 这是SSIS擅长的一种技术.到目前为止,我还没有看到任何直接答案.

Update #1:根据评论,我调整了样本数据,使其更加明显地非规范化.我还从"平面文件"中删除了"flat",因此语义不会干扰问题.

Update #2:我已经放大了对SSIS语言解决方案的兴趣.

sql-server import ssis etl sql-server-2008

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

ASP.NET性能分析404/500错误

使用Visual Studio Performance Explorer和Cassini,我正在尝试在我的(Orchard CMS 1.4.0)ASP.NET MVC3应用程序上启动性能分析,但是我收到此错误:

无法正确配置网站; 获取ASP.NET进程信息失败.请求http://localhost:30320/OrchardLocal/VSEnterpriseHelper.axd返回错误:远程服务器返回错误:(404)Not Found.

所以我搜索了一个解决方案,发现这篇文章没有适用,因为我使用的是Visual Studio的开发服务器(Cassini)而不是IIS - 不乏IIS 6.然后我读了这篇文章这篇文章 ; 在所有这些建议中,唯一location有所作为的是将该部分添加到我的web.config中,以授予对VSEnterpriseHelper.axd的访问权限.但正如其中一篇文章预测的那样,我的404错误只是变成了500:

无法正确配置网站; 获取ASP.NET进程信息失败.请求http://localhost:30320/OrchardLocal/VSEnterpriseHelper.axd返回错误:远程服务器返回错误:(500)内部服务器错误.

这些不同文章中的尾随评论对我不起作用.有什么建议?我想我会在这里发布我的(Orchard 1.4.0)web.config,以防有人发现罪魁祸首:

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually …
Run Code Online (Sandbox Code Playgroud)

performance profiling visual-studio-2010 orchardcms asp.net-mvc-3

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

Web.config转换 - 缺少手册

你可以在这里那里阅读web.config转换文档,但是有两个白象似乎没有人在讨论:

  1. 你如何在执行变量替换ConditionXPath改造,并...
  2. 可以在Locator有意义嵌套在Transform

让我举一个可以从这两个选项中受益的例子.假设我有这个:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)

假设我想完全擦除dependentAssembly与xpath匹配的节点及其子节点//runtime/assemblyBinding/dependentAssembly[assemblyIdentity@name='System.Web.Mvc'].要做到这一点,我可能想要这样的事情:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity 
          name="System.Web.Mvc" 
          xdt:Remove 
          xdt:Locator="Condition(..[*@name=$name])" 
      />
    </dependentAssembly>
  </assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)

很明显,我@name=$name根据xpath变量概念编写了语法,但这个例子说明了为什么我想要这个功能.这支持吗?我该如何调整语法以利用它?我可以输入一个字符串文字,但我只是想知道这是否可行.

我可能尝试删除dependentAssembly节点的另一种方法是:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" xdt:Transform="Remove">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" xdt:Locator="Match(name)" />
    </dependentAssembly>
  </assemblyBinding>
</runtime> …
Run Code Online (Sandbox Code Playgroud)

deployment xslt xpath web-config visual-studio-2010

7
推荐指数
2
解决办法
3154
查看次数

类型约束C#Generic的无效转换

针对.net 4.0,我正在尝试构建以下类:

public class ConfigurationElementCollection<TElement, TParent> 
    where TElement : ParentedConfigElement<TParent>, new() 
    where TParent : class
{
    public TParent ParentElement { get; set; }

    protected ConfigurationElement CreateNewElement()
    {
        //**************************************************
        //COMPILER GIVES TYPE CONVERSION ERROR ON THIS LINE!
        //**************************************************
        return new TElement { ParentCollection = this };
    }
}

public class ParentedConfigElement<TParent> : ConfigurationElement where TParent : class
{
    internal ConfigurationElementCollection<ParentedConfigElement<TParent>, TParent> 
        ParentCollection { get; set; }

    protected TParent Parent
    {
        get
        {
            return ParentCollection != null ? ParentCollection.ParentElement : null;
        } …
Run Code Online (Sandbox Code Playgroud)

.net c# generics

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

使用ASP.NET Dev Server进行单元测试MVC

我想确认我的"HomeController"类是由我创建的路由选择的.所以我有这样的测试:

    [TestMethod]
    [UrlToTest("http://localhost:14478/home")]
    [HostType("ASP.NET")]
    [AspNetDevelopmentServerHost("$(SolutionDir)\\MvcBuildApp")]
    public void MyTest()
    {
        System.Diagnostics.Debugger.Break();

        RouteCollection routes = new RouteCollection();
        MvcApplication.RegisterRoutes(routes);
        MvcApplication.RegisterGlobalFilters(GlobalFilters.Filters);
        //This fetches DefaultControllerFactory (for now, anyway...)
        var factory = ControllerBuilder.Current.GetControllerFactory();
        //mock a context...
        var httpContext = CreateHttpContext("http://localhost:14478/home", "GET");
        RouteData route = routes.GetRouteData(httpContext);

        var ctrlInstance = factory.CreateController(new RequestContext(httpContext, route), (string)route.Values["controller"]);

        //ASSERT the instance is of type "HomeController"
        //...
     }
Run Code Online (Sandbox Code Playgroud)

说它失败了 'http://localhost:14478/home' completed successfully without running the test.

我注意到在VS输出窗口中,还有这条消息No connection could be made because the target machine actively refused it 127.0.0.1:14478.我认为卡西尼一定不能活跃.所以我选择在启动单元测试之前启动正在测试的站点(ctrl + F5).然后它将VS输出更改为: …

c# asp.net asp.net-mvc unit-testing visual-studio

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

Android SDK已安装,但adb.exe缺失

在我的Visual Studio安装突然失去了将我的Xamarin应用程序部署到Android模拟器的能力后,我决定卸载一切(Visual Studio,Xamarin,Android SDK)并重新开始.

一切都已重新安装,但Android SDK不包含adb.exe文件.我希望找到它的地方在这里:

C:\ Users \用户costcopc \应用程序数据\本地\的Android\Android的SDK \平台工具\ adb.exe

什么地方出了错?我怎样才能解决这个问题?

我打开了一个cmd.exe提示符并搜索了整个驱动器(C:>)以找到该文件 - 它不存在.

重新追踪我的步骤

如果有帮助,我会追溯我的步骤......

卸载

根据指示,我先卸载了Xamarin .我想要一个空白的板岩,根据这些说明,我也卸载了:

  • Android SDK工具
  • GTK#

我没有卸载Java SDK,因为正如我的第一个链接所解释的那样,我已经使用系统还原点来恢复稳定版本的Java SDK.

接下来是Visual Studio.我使用其安装程序进行卸载,然后我按照它给出的卸载后"辅助安装程序"说明进行操作.

重新安装

我首先重新安装了VS 2015,然后我启动了Xamarin Studio安装程序,后者又为我安装了Android SDK:

在此输入图像描述

一切看似安装成功,我启动了Visual Studio,并尝试使用工具 - > Android - > Android SDK Manager打开Android SDK Manager.

它工作,但我注意到一个cmd.exe窗口打开并保持打开状态,包含几个奇怪的错误消息.

在此输入图像描述

它是:"进程无法访问该文件,因为它正被另一个进程使用."

尽管存在异常,但我确实使用SDK管理器安装了另外4个软件包.

不过,我对错误消息感到不安,所以我觉得是时候重启了.重启后情况变得更糟.之前,Visual Studio至少能够启动android SDK管理器.现在它完全无法启动它:

在此输入图像描述

奇怪的SDK路径C:\Users\costcopc\AppData\Local\Android\ANDROI-1已经消失了!

Xamarin Studio也无法启动SDK Manager:

在此输入图像描述

现在我选择执行Xamarin Studio安装"修复".Xamarin的行为就像安装了Android SDK一样,所以它没有做任何修复.

同样,我该怎么做才能解决这个问题?

android xamarin visual-studio-2015

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