小编pro*_*eek的帖子

Microsoft代码覆盖工具可以生成XML文件作为报告格式吗?

Microsoft代码覆盖率工具(vsinstr.exe)生成要在Visual Studio中读取的二进制文件.它还可以生成XML文件吗?

instrumentation code-coverage visual-studio-2010

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

Python的os.path库在C#中等效

假设我在C#代码ae /a/b/c/xyz.exe中有一个二进制文件,它需要/a/b/c/hello.txt在同一目录中.如何在完整路径中获取/a/b/c/hello.txt?

在python中,我可以获取正在运行的程序的路径os.path.abspath(sys.argv[0]),并且我可以使用dirname()获取目录信息,并且我可以使用join()来获取新的完整路径.

import sys
from os.path import *
newName = join(dirname(abspath(sys.arg[0]), "hello.txt")
Run Code Online (Sandbox Code Playgroud)

C#怎么能做同样的事情?

c# python path

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

如何在Emacs org-mode中调用Emacs Lisp函数?

当我有elisp功能

(defun hello (param)
    ... )
Run Code Online (Sandbox Code Playgroud)

如何运行(hello abc.txt)with org模式?我学会了如何将http与[[mine:...]]标签链接起来.我期待类似的方式,类似的[[lisp:hello(abc.txt)]]东西.

添加

正如这篇文章解释的那样,我有(runmate)和(runeditor (something))elisp命令.

它alt-x runmate在emacs中工作正常,但是当我运行时[[lisp:(runmate)]],我得到以下对话框.

在此输入图像描述

解决了

应该用过[[elisp:(runmate)]].

emacs org-mode

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

C++中虚拟公共类的副作用

Virtual Public Class用于类,以确保类的对象仅继承一个子对象.

class L { /* ... */ }; // indirect base class
class B1 : virtual public L { /* ... */ };
class B2 : virtual public L { /* ... */ };
class D : public B1, public B2 { /* ... */ }; // valid
Run Code Online (Sandbox Code Playgroud)

当我们不使用虚拟公共来进行单一继承时,我们是否有副作用.例如,是

class L { /* ... */ }; // indirect base class
class B1 : virtual public L { /* ... */ };
class D : public B1 { …
Run Code Online (Sandbox Code Playgroud)

c++ virtual class

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

通过Applescript从iCal获取今天的活动

我迭代iCal中的所有事件只获得今天的事件,但我认为这不是有效的.是否有功能/方法只能获得今天的活动?

tell application "iCal"
    tell calendar "Lotus Notes"
        set today to (current date)
        set this_year to year of today
        set this_month to month of today
        set this_day to day of today

        repeat with c in every event
            set d to start date of c
            set the_year to year of d
            set the_month to month of d
            set the_day to day of d
            if (the_year = this_year) and (the_month = this_month) and (the_day = this_day) then
                show c
            end if
        end …
Run Code Online (Sandbox Code Playgroud)

icalendar applescript

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

异常类型,不是来自VS2010的StyleCop的足够具体的错误

我有一些引发异常的代码如下。

if (jobFinished)
{
   ...                
} else
{                  
    throw new Exception("The server Error ...")
}
Run Code Online (Sandbox Code Playgroud)

它可以编译/运行,没有问题,但是当我运行StyleCop时,出现了此错误消息,指出Exception不特定。

Error   10  CA2201 : Microsoft.Usage : Function(string, DirectoryInfo, string, string, string, out string)' 
creates an exception of type 'Exception', an exception type that is not sufficiently 
specific and should never be raised by user code. If this exception instance might be
thrown, use a different exception type.
Run Code Online (Sandbox Code Playgroud)

我遇到一些错误情况时只想抛出一个错误。如何做出足够明确的异常?

c# stylecop visual-studio-2010

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

使用Linq进行分段的XML字符串解析

假设我有一个支离破碎的XML,如下所示.

<A>
  <B></B>
</A>
<A>
  <B></B>
</A>
Run Code Online (Sandbox Code Playgroud)

我可以使用XmlReaderFragment选项来解析这个not completeXML字符串.

XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
XmlReader reader;
using (StringReader stringReader = new StringReader(inputXml))
{
    reader = XmlReader.Create(stringReader, settings);
}
XPathDocument xPathDoc = new XPathDocument(reader);
XPathNavigator rootNode = xPathDoc.CreateNavigator();
XPathNodeIterator pipeUnits = rootNode.SelectChildren("A", string.Empty);
while (pipeUnits.MoveNext())
Run Code Online (Sandbox Code Playgroud)

我可以使用Linq进行碎片化的XML字符串解析吗?

.net c# xml linq

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

如何设置相对于项目文件的资源文件路径?

假设我有一个目录A,并且在该目录中有一个项目文件x.csproj和sln.我也有资源文件x.resources.

如何设置没有绝对路径的资源文件C:\A\x.resources,而是相对路径.\x.resources?我试过x.resources但它不起作用.

在此输入图像描述

.net resources visual-studio-2010 visual-studio

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

在vsvars32.bat命令之后,Powershell没有正确的路径信息

使用命令提示符,我运行vsvars32以运行所有visual studio命令行实用程序(编译器,链接器...).

在此输入图像描述

但是,当我使用PowerShell运行相同的东西时,我无法运行实用程序.可能有什么问题?

在此输入图像描述

.net powershell environment-variables

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

在Mac OS X雪豹上运行mono 2.10.2 mkbundle时出现的问题

此页面包含有关Bundles的信息mkbundle,但是当我尝试在Mac上使用它时,我收到此错误消息.

delegate> mkbundle delegate.exe -o delegate
OS is: Darwin
Sources: 1 Auto-dependencies: False
   embedding: /Users/smcho/Desktop/csharp/delegate/delegate.exe
Compiling:
as -o temp.o temp.s 
temp.s:2:unknown section type: symbol_stubs
temp.s:2:Rest of line ignored. 1st junk character valued 112 (p).
[Fail]
Run Code Online (Sandbox Code Playgroud)

从这个网站,我可以跑来export AS="as -arch i386"得到另一个错误.

Compiling:
as -arch i386 -o temp.o temp.s 
cc -g -o a.out -Wall temp.c `pkg-config --cflags --libs mono-2`  temp.o
ld: warning: ignoring file /Library/Frameworks/Mono.framework/Versions/2.10.2/lib/libmono-2.0.dylib, file was built for unsupported file format which is not the …
Run Code Online (Sandbox Code Playgroud)

.net macos mono mkbundle

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