小编ale*_*rul的帖子

整个存储库树中的.hgignore目录"_notes"?

我想忽略整个存储库中的所有目录"_notes"._notes由dreamweaver生成,不属于项目本身,但这些目录分散在整个项目中.

某种程度上^ _notes $没有在.hgignore中完成工作......我是否必须将.hgignore指向每个目录"_notes"或者它是否以递归方式执行?

我对这些手册页不太确定

mercurial hgignore

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

MEF的多次出口确实有些令人发指的东西 - 为什么,为什么允许它?

我有一个有趣的情况,我需要做这样的事情:

[Export[typeof(ICandy1)]
[Export[typeof(ICandy2)]
public class Candy : ICandy2 { ... }
Run Code Online (Sandbox Code Playgroud)

哪里

public interface ICandy1 { ... }
public interface ICandy2 : ICandy1 { ... }
Run Code Online (Sandbox Code Playgroud)

我无法在任何地方找到任何关于使用多个[导出]属性的帖子,所以我想,到底是什么,不妨尝试一下.

乍一看,它实际上似乎有效.我有几个方法调用Candy实例的两个接口,它很好.

但是,当我开始测试应用程序时,我看到行为不正确,在查看"输出"窗口时,我看到我收到了大量的COMExceptions.我无法追踪它们的来源,但它们总是在工人线程正在睡觉时发生.我认为它必须来自主线程,然后,但根本不知道如何调试它.GUI中没有任何内容,我禁用了我的DispatchTimers以防万一 - 同样的事情.

踩过代码时,比COMExceptions更奇怪的是真正的,非常不稳定的行为.大约30%的时间,当我单步执行时,它会弹出方法,或者它会单步执行两行代码!完全不奇怪的东西,我不习惯看到.

工作代码和非工作代码之间唯一的变化是通过我的插件加载代码引入MEF.因此,作为测试,我将插件程序集更改为仅导出一个界面,并且我在应用程序中硬编码了依赖于另一个(现在未实现的)界面的所有内容.现在COMExceptions消失了,奇怪的调试行为消失了.

这是人们以前见过的东西吗?如果不希望MEF允许类导出多个接口,那么在编写部件时不应该引发CompositionException吗?任何人都可以解释为什么MEF会导致这些奇怪的问题???

这是COMException时代主线程调用堆栈的示例.不确定它对任何人是否意味着什么,但如果你能提出任何调试方法,那就太好了.

> UIAutomationProvider.dll!MS.Internal.Automation.UiaCoreProviderApi.UiaHostProviderFromHwnd(System.IntPtr hwnd) + 0x38 bytes 
  UIAutomationProvider.dll!System.Windows.Automation.Provider.AutomationInteropProvider.HostProviderFromHandle(System.IntPtr hwnd) + 0x2d bytes 
  PresentationCore.dll!MS.Internal.Automation.ElementProxy.HostRawElementProvider.get() + 0x65 bytes 
  [Native to Managed Transition] 
  [Managed to Native Transition] 
  UIAutomationProvider.dll!System.Windows.Automation.Provider.AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(System.Windows.Automation.Provider.IRawElementProviderSimple element, System.Windows.Automation.AutomationPropertyChangedEventArgs e) + 0x2a bytes 
  PresentationCore.dll!System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() + 0x2c9 bytes 
  PresentationCore.dll!System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() + 0x2f8 bytes 
  PresentationCore.dll!System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() + 0x2f8 …
Run Code Online (Sandbox Code Playgroud)

wpf mef export inversion-of-control

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

如何在不打开IE的情况下更改IE的主页?

这是一个有趣的问题.在最近安装的Server 2008 64bit上,我打开了IE,通过工具 - >选项,我将主页更改为iGoogle.com.单击确定然后单击主页按钮.IE崩溃了.

现在你认为我可以删除iGoogle作为主页但是当我打开IE时它会立即进入该页面并在打开时崩溃.

显然我更愿意找到一个解决方案,为什么IE在iGoogle页面上崩溃,但只是为了让IE再次运行我需要删除iGoogle作为主页.无论如何在没有打开IE的情况下这样做?

windows-server-2008 internet-explorer-7

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

Web 访问虚拟机

它们是一种从主机访问安装在虚拟机(例如 vmware)上的 Web 服务器(例如 Windows Server 2003)的方法吗?

virtualization vmware vmware-server windows-server-2003

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

DirectoryEntry.NativeObject为Windows 2008中的Administrators组中的用户抛出拒绝访问

我有一个本地用户,它是Administrators本地组的成员.

当我运行此代码时:

using System;
using System.DirectoryServices;

namespace nanttest
{
    class Program
    {
        public static void Main(string[] args)
        {
            using(DirectoryEntry entry = new DirectoryEntry("IIS://localhost/W3SVC"))
            {
                object absobject = entry.NativeObject;
                Console.WriteLine("Name: {0}", entry.Name);
            }

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到:

未处理的异常:System.Runtime.InteropServices.COMException(0x80070005):访问被拒绝.

在System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)中的System.DirectoryServices.DirectoryEntry.Bind()at System.DirectoryServices.DirectoryEntry.get_NativeObject()at nanttest.Program.Main(String [] args)in c:\ Work \nanttest \nanttest\Program.cs:第20行

如果我以管理员身份登录时运行此代码,则可以正常工作.

此外,如果我以DomainAdmin用户身份登录,则此代码将失败.我已将MYDOMAIN\DomainAdmins和MYDOMAIN\mydomainuser添加为本地Administrators组的成员.

我应该为这些用户添加哪些其他权限,以便他们可以运行此代码.

.net permissions directoryservices administrator windows-server-2008

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

Apple automator视频教程

我在哪里可以找到一些Automator视频教程?

谢谢

macos automator

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

如何反序列化DateTime对象列表?

如果我有以下XML段:

<Times>
  <Time>1/1/1900 12:00 AM</Time>
  <Time>1/1/1900 6:00 AM</Time>
</Times>
Run Code Online (Sandbox Code Playgroud)

相应的属性应该是什么样的,当反序列化发生时,将上述XML接受到DateTime对象列表中?

这可以将XML段反序列化为string对象列表:

[XmlArray("Times")]
[XmlArrayItem("Time", typeof(string))]
public List<string> Times { get; set; }
Run Code Online (Sandbox Code Playgroud)

但是当我使用DateTime作为类型而不是字符串(对于List类型和XmlArrayItem类型)时,我收到以下错误:

The string '1/1/1900 12:00 AM' is not a valid AllXsd value.

谢谢!

.net c# xml-serialization

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

ASP.NET MVC使用Castle Windsor IoC

我有一个应用程序,模仿Apress Pro ASP.NET MVC中的一个应用程序,使用城堡windsor的IoC来实例化各自的存储库控制器,这工作正常

例如

public class ItemController : Controller
{
    private IItemsRepository itemsRepository;
    public ItemController(IItemsRepository windsorItemsRepository)
    {
        this.itemsRepository = windsorItemsRepository;
    }
Run Code Online (Sandbox Code Playgroud)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;
using Castle.Core.Resource;
using System.Reflection;
using Castle.Core;

namespace WebUI
{
    public class WindsorControllerFactory : DefaultControllerFactory
    {
        WindsorContainer container;

        // The constructor:
        // 1. Sets up a new IoC container
        // 2. Registers all components specified in web.config
        // 3. Registers all controller types as …
Run Code Online (Sandbox Code Playgroud)

castle-windsor inversion-of-control

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

用linq回滚到sql?

我有这个

Public void CreateUser(params here)
{
   CreateMembership(params here);
   Users newUser = new Users();
   newUser.UserId = 123456
   Context.Users.insertOnSubmit();
   Context.Submit();
}

public void CreateMembership(...)
{
    Membership membership = new Membership();
     membership.Something = "something";
     Context.Membership.insertOnSumbit();
     Context.Submit();
}
Run Code Online (Sandbox Code Playgroud)

那么,如果Users表提交失败怎么办?如何将此回滚以删除会员资格?或者我可以设置我的东西不同,只需删除Membership方法中的Context.Submit()行?

然后只有一个提交被调用?或者我还需要做别的事吗?

.net c# asp.net linq-to-sql

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

XmlSerializer没有填充子元素

我已经使用XSD.EXE将XSD转换为对象.这很好,我可以使用XMLSerializer进行反序列化,除了生成为数组的子元素不会填充.

    private SubElements[] subelementsField;

    /// <remarks/>
    [System.Xml.Serialization.XmlArrayItemAttribute("SubElement", IsNullable=false)]
    public SubElement[] SubElement {
        get {
            return this.subelementField;
        }
        set {
            this.subelementField = value;
        }
    }
Run Code Online (Sandbox Code Playgroud)

即使XML中存在数据,但在使用以下代码时它也不会填充它:

// Deserialize
var result = serializer.Deserialize(new StringReader(data.XMLText.ToString()));
Run Code Online (Sandbox Code Playgroud)

根元素都可以正常工作,而不是这种XML数据的子元素:

<RootNode Weight="205" Year="1995">
  <ParentNodeWhichWorksFine Contact="John Doe">
    <SubElement SomeAttribute="123">
      <Location>New York City</Location>
      <Team>New York Pizza</Team>
    </SubElement>
  </ParentNodeWhichWorksFine>
</RootNode>
Run Code Online (Sandbox Code Playgroud)

我错过了XSD.EXE不包含的一些提示或其他内容吗?

c# xml-serialization xsd.exe

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