有没有人知道在Microsoft .NET框架中检查给定C#文件的语法和语法的方法?
对于一些小背景,我感兴趣的是设置合成来检查.cs
文件的语法.开箱即用,syntastic使用Mono C#编译器及其--parse
标志来执行此操作,但我在Microsoft .NET框架中找不到相同的东西.
我第一次尝试使用它是用来csc /target:library /nologo
代替mcs --parse
,但问题是这是基于每个文件调用的.因此,它报告缺少名称空间(存在于完整项目构建中)而不仅仅是语法错误.
在使用OpenCover生成覆盖率报告(然后使用ReportGenerator生成HTML报告)时,我试图排除框架生成的类.特别是,由服务引用在项目命名空间下生成的类.
我用来生成XML文件的命令如下所示:
OpenCover.Console.exe -register:user "-target:MyProject.Tests.dll" -targetargs:"/testcontainer:MyContainer" -output:coverage.xml -mergebyhash -filter:-*.AWebService.*
Run Code Online (Sandbox Code Playgroud)
我也试图通过文件排除:
OpenCover.Console.exe -register:user "-target:MyProject.Tests.dll" -targetargs:"/testcontainer:MyContainer" -output:coverage.xml -mergebyhash -excludebyfile:*Reference.cs
Run Code Online (Sandbox Code Playgroud)
但服务引用类仍显示在XML文件中.
有没有办法只排除Visual Studio生成的特定类?
我在命令行应用程序中使用PLY,我将其打包为要安装的Python egg pip
.每次我从命令行运行我的脚本时,都会看到以下消息:
"Generating LALR tables"
Run Code Online (Sandbox Code Playgroud)
此外,parser.out和parsetab.py文件将写入调用脚本的目录.有没有办法用应用程序发送这些文件,以便它不会每次都重新生成表?
我想要完成的是自定义控件,DataGrid
以便每行都有圆角,没有网格线(只是我正在使用的设计).
我一直在尝试做的是创建一个ControlTemplate
修改DataGridRow
控件,使它们具有预期的外观.到目前为止,这是我正在使用的:
<DataGrid Grid.Row="0" Grid.Column="0" Margin="5,5,5,5" AutoGenerateColumns="False" ItemsSource="{Binding Path=MyData}">
<DataGrid.Resources>
<Style x:Key="rowStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Border CornerRadius="8,8,8,8" BorderBrush="Red" BorderThickness="2">
<ContentPresenter />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="Foo" />
<DataGridTextColumn Header="Baz" />
<DataGridTextColumn Header="Bar" />
</DataGrid.Columns>
</DataGrid>
Run Code Online (Sandbox Code Playgroud)
这个版本显然是基本的(只是库存模板的边框),但是当我运行应用程序时,我看不出任何差异.
那么,问题是如何自定义DataGridRow的控件模板?或者,如果这是不可行的,是否有更好的方法来实现我的目标:?
我正在尝试配置我的Maven项目以进行单元测试和集成测试.单元测试使用Maven Surefire插件已经正常工作,并根据模式命名*Test.java
.
添加Failsafe插件后,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我添加了一个名为的集成测试SomeTestIT.java
.但是,当我跑:
mvn failsafe:integration-test
Run Code Online (Sandbox Code Playgroud)
我得到以下内容:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyApp 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-failsafe-plugin:2.18.1:integration-test (default-cli) @ MyApp ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.368 s
[INFO] Finished at: 2015-03-04T14:43:50-06:00
[INFO] Final Memory: …
Run Code Online (Sandbox Code Playgroud) 不同的事件类型通过主题/队列和消息头的某种组合来区分。在 Kafka 中,记录流仍然被分离为主题(https://kafka.apache.org/intro)。在浏览 Azure 事件中心文档时,我没有看到任何此类想法被提及。有分区,但这些与消费者并行性有关 ( https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-what-is-event-hubs#partitions ),根据文档。您是否认为 Azure 事件中心中有一个命名空间,其中每个“主题”都包含一个事件中心?
我在本地计算机上建立了一个独立的 CAS 5 实例,用于修补/黑客攻击,并尝试将其设置为独立的 WAR 文件,并通过简单的基于文件的身份验证部署到 Tomcat。
从 WAR Overlay 模板 ( https://github.com/apereo/cas-overlay-template ) 开始,我添加了以下依赖项,如https://apereo.github.io/cas/5.0.x/所示安装/Whitelist-Authentication.html#example-password-file。
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-generic</artifactId>
<version>${cas.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
然后我创建了一个简单的passwd.txt
文件,其中包含以下内容src/main/resources
。
bob::bob
alice::alice
Run Code Online (Sandbox Code Playgroud)
最后,我将基于文件的属性(参见https://apereo.github.io/cas/5.0.x/installation/Configuration-Properties.html#file-authentication)添加到etc/cas/config/cas.properties
.
cas.authn.file.filename=classpath:passwd.txt
cas.authn.accept.users=
cas.authn.file.passwordEncoder.type=NONE
cas.authn.file.separator=::
Run Code Online (Sandbox Code Playgroud)
当我部署应用程序时,应用程序启动,但登录表单中接受的唯一用户是casuser
/ Mellon
(默认值)。我什至尝试将属性附加cas.authn.policy.any.tryAll=true
到cas.properties
文件中,但爱丽丝和鲍勃都没有被识别。
我应该在不同的地方设置这些选项吗?我还需要做些什么才能启用基于文件的身份验证吗?