小编Dom*_*icz的帖子

Bootstrap 3.0.3 navbar-right和pull-right

我正在使用一些Bootstrap教程并使用Bootstrap 3.0.3版本.

我注意到navbar-right浮子完全在右边,而pull-right看起来像3.0 navbar-right一样.

我在JSFiddle上放了一个例子.

根据他们在2013年12月5日的博客,已经做了一些修改,所以我想知道我是否错误地构建了HTML类,或者这是否是菜单对齐的新方法?

html css navbar twitter-bootstrap twitter-bootstrap-3

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

如何使用Marshal.ReleaseComObject与Win32本机函数

我正在玩这两个原生的win32函数:

    [DllImport( "oleacc.dll" )]
    public static extern int AccessibleObjectFromWindow(
            IntPtr hwnd,
            int dwObjectID,
            ref Guid refID,
            ref Accessibility.IAccessible ppvObject );
    [DllImport( "oleacc.dll" )]
    public static extern uint AccessibleChildren(
        Accessibility.IAccessible paccContainer,
        int iChildStart, 
        int cChildren,
        [Out] object[] rgvarChildren,
        out int pcObtained );
Run Code Online (Sandbox Code Playgroud)

而且我很难搞清楚我是否应该/需要在任何返回的对象上调用Marshal.ReleaseComObject.我很感激有人可以开导我这个话题!这是一个示例用法:

    Accessibility.IAccessible test(
        int hWnd,
        string accessName )
    {
        Guid guidCOM = new Guid( 0x618736E0, 0x3C3D, 0x11CF, 0x81, 0xC, 0x0, 0xAA, 0x0, 0x38, 0x9B, 0x71 );
        Accessibility.IAccessible a = null;

        AccessibleObjectFromWindow(
            new IntPtr( hWnd ),
            -4,
            ref guidCOM,
            ref …
Run Code Online (Sandbox Code Playgroud)

.net c# com interop

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

为什么我在IDisposable类中使用私有成员IDispos获取CA2000?

我有一个实现IDisposable的类,因为它有一个私有成员字段"foo",它是IDisposable(在构造函数中初始化).我出乎意料地得到了CA2000代码分析错误,这要求我确保丢弃foo.但是,我在我的类的Dispose()代码中有foo.Dispose(),它应该处理这个问题.

我做了一些搜索,令人惊讶的是找不到答案.我究竟做错了什么?显然我遗漏了一些基本的东西.如何编写代码来克服这个问题?

我的VB代码:

Public Class Bar
    Implements IDisposable

    Private Foo As SomeDisposableThing

    Public Sub New()
        Foo = New SomeDisposableThing() With {.name = "hello"}
    End Sub

    '''' snip ''''

    Private disposedValue As Boolean = False        ' To detect redundant calls '

    Protected Overridable Sub Dispose(ByVal disposing As Boolean)
        If Not Me.disposedValue Then
            If disposing Then
                If Foo IsNot Nothing Then Foo.Dispose()
            End If
        End If
        Me.disposedValue = True
    End Sub

    Public Sub Dispose() Implements IDisposable.Dispose
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub

End Class
Run Code Online (Sandbox Code Playgroud)

.net vb.net code-analysis fxcop

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

使用C#.NET处理XML中的禁用字符

我有一个对象,我正在序列化为xml.看来其中一个属性中的值包含十六进制字符0x1E.我已经尝试将XmlWriterSettings的Encoding属性设置为"utf-16"和"unicode"但我仍然会抛出异常:

这是生成XML文档的错误.---> System.InvalidOperationException:生成XML文档时出错.---> System.ArgumentException:'',十六进制值0x1E,是无效字符.

有没有办法让这些字符进入xml?如果没有,是否还有其他字符会导致问题?

.net c# xml serialization xml-serialization

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

C#中的new运算符不会覆盖基类成员

我很困惑为什么new运营商没有像我预期的那样工作.

注意:以下所有类都在同一名称空间中定义,并在同一文件中定义.

此类允许您使用一些提供的文本为写入控制台的任何内容添加前缀.

public class ConsoleWriter
{
    private string prefix;

    public ConsoleWriter(string prefix)
    {
        this.prefix = prefix;
    }

    public void Write(string text)
    {
        Console.WriteLine(String.Concat(prefix,text));
    }
}
Run Code Online (Sandbox Code Playgroud)

这是一个基类:

public class BaseClass
{
    protected static ConsoleWriter consoleWriter = new ConsoleWriter("");

    public static void Write(string text)
    {
        consoleWriter.Write(text);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是一个实现的类:

public class NewClass : BaseClass
{
    protected new static ConsoleWriter consoleWriter = new ConsoleWriter("> ");
}
Run Code Online (Sandbox Code Playgroud)

现在这是执行此操作的代码:

class Program
{
    static void Main(string[] args)
    {
        BaseClass.Write("Hello World!");
        NewClass.Write("Hello World!");

        Console.Read(); …
Run Code Online (Sandbox Code Playgroud)

c# inheritance new-operator

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

引用实体框架中的表的模式名称

你如何明确地告诉EF一个表位于特定模式中?

例如,AdventureWorks数据库定义了Production.Product表.使用该OnModelCreating方法时,我使用以下代码:

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    EntityTypeConfiguration<Product> config = modelBuilder.Entity<Product>();

    config.HasKey(p => p.ProductID);
    config.Property(p => p.Price).HasColumnName("ListPrice");
    config.ToTable("Product");
}
Run Code Online (Sandbox Code Playgroud)

然而,当它运行时,它说Invalid object name: dbo.Product.

我试过了:

config.ToTable("Production.Product");
//and
config.HasEntityName("Production");
Run Code Online (Sandbox Code Playgroud)

但两者都失败了.

c# data-access entity-framework-4.1

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

使用全局高速缓存时,如何修复CA2000 IDisposable C#编译器警告

CA2000是关于IDisposable接口的警告:

CA2000:Microsoft.Reliability:在方法'ImportProcessor.GetContext(string)'中,在对所有引用超出范围之前,在对象'c'上调用System.IDisposable.Dispose.

我的方法用于存储上下文缓存,如下所示:

public class RegionContext : IDisposable { /* Implement Dispose() here */ } 

private Dictionary<string, RegionContext> contextCache = new ..... ();

public RegionContext GetContext(string regionCode)
{
    RegionContext rc = null;

    if (!this.contextCache.TryGetValue(regionCode.ToUpper(), out rc))
    {
        rc = new RegionContext(regionCode);
        this.contextCache.Add(regionCode.ToUpper(), rc);
    }

    return rc;
}
Run Code Online (Sandbox Code Playgroud)

你会在哪里使用using()修复此编译器警告的语句?

我的外部类实际上会迭代并处理contextCache其自己的实现中的内容.我要压制它,还是有办法正确摆脱这个警告?

c# code-analysis idisposable visual-studio-2010 ca2000

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

无法在Windows 8中运行logstash 1.4.0

有一个月我正在使用logstash,所以我仍在学习它的基础知识,还有elasticsearch和kibana.昨天,我尝试安装并开始使用新版本"logstash 1.4.0".为此,我按照此链接,但当我尝试使用以下命令运行logstash时:

bin\logstash -e 'input { stdin { } } output { stdout {} }'

我收到此错误:

"bin"不被识别为内部或外部命令,可操作程序或批处理文件.

输出如下:

No such command "-e"
Usage: logstash <command> [command args]
Run a command with the --help flag to see the arguments.
For example: logstash agent --help

Available commands:

agent - runs the logstash agent
version - emits version info about this logstash
web - runs the logstash web ui (called Kibana)
rspec - runs tests
Run Code Online (Sandbox Code Playgroud)

有关信息,当我运行java-version时,我得到这个:

java version "1.7.0_40"
Java(TM) SE …
Run Code Online (Sandbox Code Playgroud)

elasticsearch logstash

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

MonoCode中是否有MessageBox.Show()equivelant

MessageBox.Show()在MonoMac中是否有相同的内容,或者我是否必须专门为此目的创建某种弹出类?

.net monomac

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

Autofac.Core.DependencyResolutionException

Autofac新手在这里想要更好地理解以下异常,任何帮助/指针将非常感谢!

Unhandled Exception: 
    Autofac.Core.DependencyResolutionException: 
        None of the constructors found with 'Public binding flags' on type 'Test.Authorization.LoginService' can be invoked with the available services and parameters: 
         Cannot resolve parameter 'System.Func`1[System.IO.Stream] readStream' of constructor 'Void .ctor(System.Func`1[System.IO.Stream], System.Func`1[System.IO.Stream])'.
    at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 117    
    at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
    at Autofac.Core.Resolving.InstanceLookup.Execute() in \autofac\src\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62
    at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 124
    at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 115  
    at Autofac.Features.Collections.CollectionRegistrationSource.c__DisplayClass4.c__DisplayClass6.b__1(IComponentRegistration cr) in \autofac\src\Source\Autofac\Features\Collections\CollectionRegistrationSource.cs:line 80    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() …

dependency-injection autofac

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