小编mrt*_*181的帖子

有没有办法从eclipse复制包含ine数字的代码

我正在写一些文档和代码说明.我想从包含行号的eclipse中复制代码,以便更容易引用文本中的代码.

在eclipse或其他IDE编辑器中有没有办法做到这一点?

eclipse copy line-numbers

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

如何修复jQuery datepicker的区域设置,以便在Firefox和IE7中运行?

我正在使用jQuery的datepicker和asp.net MVC4.datepicker适用于Firefox,但在IE7中,我通过asp.net的验证得到消息,该字段不是日期.

这是datepicker的代码

if (!Modernizr.inputtypes.date) {
        $(function() {
            $.datepicker.setDefaults($.datepicker.regional['en-GB']);
            $(".datefield").datepicker();
        });
    }
Run Code Online (Sandbox Code Playgroud)

这是我在Web.config中的全球化设置

<globalization uiCulture="en-GB" culture="en-GB" />

例如,在Firefox中,日期显示为"19/03/2012"字符串,并由asp.net的验证设置(客户端和服务器端)接受.在IE7中,客户端不接受相同的日期字符串.如果我将其更改为"03/19/2012",则客户端接受日期,但服务器会抛出异常 - "InvalidOperationException.可为空的对象必须具有值."

我的viewModel使用一个可以为null的DateTime,我将其转换为控制器post动作中的非null-null DateTime.这适用于Firefox,但在IE7中,viewModel中日期的值为null.问题是什么?

validation asp.net-mvc datetime jquery-ui datepicker

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

如何从gradle javadoc任务中排除生成的文件?

我通过第三方插件在gradle构建中生成一些代码.生成的代码javadoc格式错误.

所以我试图从gradles javadoc任务中排除该路径,但它不起作用.我查看了类似的问题,但没有一个提供有用的答案.

$> ./gradlew --version
------------------------------------------------------------
Gradle 4.3
------------------------------------------------------------

Build time:   2017-10-30 15:43:29 UTC
Revision:     c684c202534c4138b51033b52d871939b8d38d72

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)
OS:           Windows 7 6.1 amd64
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle

sourceSets {
  main {
    compileClasspath += java.srcDir("${buildDir}/generated/src/main/com4j")
    runtimeClasspath += java.srcDir("${buildDir}/generated/src/main/com4j")
  }
  test {
    compileClasspath += java.srcDir("${buildDir}/generated/src/main/com4j")
    runtimeClasspath += java.srcDir("${buildDir}/generated/src/main/com4j")
  }
}

javadoc {
  exclude "**/generated/**"
  source = sourceSets.main.allJava
}
Run Code Online (Sandbox Code Playgroud)

没有效果.

$> ./gradlew javadoc
:javadocC:\cygwin64\home\username\sourcecode\COMJurer\build\generated\src\main\com4j\com\app\com4j\api\ClassFactory.java:15: warning: no @return
  public static com.app.com4j.api.IAPI …
Run Code Online (Sandbox Code Playgroud)

java documentation javadoc gradle

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

ColdFusion:如何检查二维数组中是否存在某个元素?

我有一个二维数组.我在初始化期间向数组写入3个值,如果数组值与通过表单传递的值不相等,则添加第四个值.然后我想检查,如果存在第四个值.

update.cfm

<cfset array = obj.getArray() />
<cfif not StructIsEmpty(form)>
  <cfloop collection="#form#" item="key">
    <cfif left(key,3) eq "ID_">
      <cfset number = listLast(key,"_") />
      <cfset value = evaluate(0,key) />
      <cfloop index="j" from="1" to="#arrayLen(array)#">
        <cfif (array[j][1] eq number) and (array[j][3] neq value)>
          <cfset array[j][3] = value />
          <cfset array[j][4] = "true" />
        </cfif>
      </cfloop>
    </cfif>
  </cfloop>
<cfset obj = createObject("component", "cfc.Obj").init(arg = form.arg, argarray = array) />
<cfset application.objDao.update(obj) />
Run Code Online (Sandbox Code Playgroud)

objDao.cfc更新方法

<cfset matarray = arguments.obj.getArray() />
  <cfloop index="i" from="1" to="#arrayLen(array)#">
    <cfquery name="qUpdateAsset" datasource="#variables.instance.dsn#"> …
Run Code Online (Sandbox Code Playgroud)

coldfusion multidimensional-array data-structures

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

如何在xunit/autofixture中组合PropertyData和AutoNSubstituteData属性?

我正在使用[AutoNSubstituteData]这里发布的属性:

AutoFixture,xUnit.net和Auto Mocking

我想将它与[PropertyData("")]xunit扩展的属性结合起来.

这是我的测试:

public static IEnumerable<string[]> InvalidInvariant
{
    get
    {
        yield return new string[] { null };
        yield return new [] { string.Empty };
        yield return new [] { " " };
    }
}

[Theory, AutoNSubstituteData, PropertyData("InvalidInvariant")]
public void TestThatGuardsAreTriggeredWhenConnectionStringArgumentIsInvalid(
    IDeal deal,
    IDbConnection conn,
    IDb db,
    ISender sender,
    string invalidConnString,
    string query)
{
    deal.Init.Group.Returns(Group.A);
    deal.Aggr.Group.Returns(Group.A);
    deal.Product.Commodity.Returns(Product.Commodity.E);

    var sut = new Handler(db, sender);
    Assert.Throws<ArgumentException>(() => 
        sut.HandleDeal(deal, conn, invalidConnString, query));
}
Run Code Online (Sandbox Code Playgroud)

有没有办法组合这些属性或获得所需的功能(模拟一切,除了invalidConnstring,应该填充属性数据)?

unit-testing mocking xunit.net autofixture nsubstitute

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

coverlet 不会在 azure devops 中创建报告

我在用

  • coverlet.msbuild v3.2.0
  • coverlet.collector v3.2.0

dotnet sdk v6.0.402

当我在 powershell 中运行此测试命令时(之前运行的恢复和构建)

dotnet test --no-build --no-restore --collect:"XPlat Code Coverage" /p:Configuration=$Cfg /p:CollectCoverage=true /p:CoverletOutput=.\CodeCoverage\ --% /p:CoverletOutputFormat=\"cobertura,opencover\"
Run Code Online (Sandbox Code Playgroud)

报告文件

  • coverage.cobertura.xml
  • coverage.opencover.xml

创建后,powershell 输出如下:

Test run for C:\Users\MyUser\repos\My.Project\Specs\bin\Release\net472\My.Project.Specs.dll (.NETFramework,Version=v4.7.2)
Microsoft (R) Test Execution Command Line Tool Version 17.3.1 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Attachments:
  C:\Users\MyUser\repos\My.Project\Specs\TestResults\dbe8cb53-3ec5-4227-a231-3bfedf94694f\coverage.cobertura.xml
Passed!  - Failed:     0, Passed:    14, Skipped:     0, Total:    14, Duration: 910 …
Run Code Online (Sandbox Code Playgroud)

powershell unit-testing code-coverage azure coverlet

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

是否可以使用(流畅的)nhibernate与odbc连接?

我必须使用自定义odbc驱动程序.

我需要传递的所有连接字符串是DSN.

我如何用(流利的)nhibernate做到这一点?FluentNHibernate.Cfg.Db仅提供带有DSN方法的OdbcConnectionStringBuilder类.我该如何使用它?

nhibernate odbc dsn fluent-nhibernate

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

为什么git svn远程跟踪停止工作?

我有以下设置

svn存储库

application
 |
 |-branches
 |  |
 |  |-develop-svn
 |
 |-trunk
Run Code Online (Sandbox Code Playgroud)

本地git存储库

master
 |
 |-develop
Run Code Online (Sandbox Code Playgroud)

主跟踪遥控器/主干

开发track remotes/develop-svn

由于某种原因,开发停止跟踪develop-svn.

当我从主人结帐开发时,我收到以下消息.

$ (master) git checkout develop
Switched to branch develop
Your branch is ahead of 'develop-svn' by 59 commits.
Run Code Online (Sandbox Code Playgroud)

当我尝试提交到svn存储库时,它会尝试更新远程主干.

$ (develop) git svn dcommit -n
Committing to https://servername/svn/application/trunk ...
...
Run Code Online (Sandbox Code Playgroud)

它曾经提交到https:// servername/svn/application/branches/develop-svn

我已经尝试过这个命令,但没有帮助:

$ (master) git branch --set-upstream develop develop-svn
Branch develop set up to track local refs/remotes/develop-svn.
$ (master) git checkout develop
Switched to branch develop
Your branch …
Run Code Online (Sandbox Code Playgroud)

git branch git-svn

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

在这种情况下,为什么使用AsParallel()比foreach慢?

我正在从这种格式的excel中提取数据

 product1   | unnamedcol2 | product2  | unnamedcol4 | product3  | unnamedcol6 |
-------------------------------------------------------------------------------
 @1foo      |        1.10 | @1foo     |         0.3 | @1foo     |         0.3
 @2foo      |        1.00 | @2foo     |           2 | @2foo     |
 @3foo      |        1.52 | @3foo     |        2.53 | @3foo     |
 @4foo      |        1.47 |           |             | @4foo     |        1.31
 @5foo      |        1.49 |           |             | @5foo     |        1.31

该文件使用所有255个字段.使用dapper-dot-net我通过此代码获取数据

IEnumerable<IDictionary<string, object>> excelDataRaw =
                conn.Query(string.Format("select * from {0}", table)).Cast<IDictionary<string, object>>();
Run Code Online (Sandbox Code Playgroud)

我将这些数据传递给这些测试方法.数据作为IEnumerable of IDictionaries返回,其中每个键都是一个产品,每个值都是一个IDictionary,其中每个键是product列中的值,相应的值是unnamedcol中产品列右侧的值.

var excelDataRefined = …
Run Code Online (Sandbox Code Playgroud)

c# linq parallel-processing performance loops

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

SimpleInjector:注入不适用于MVC 4 ASP.NET Web API

我有这个设置:

public static void Initialize(ISessionFactory factory)
{
    var container = new Container();
    InitializeContainer(container, factory);
    container.RegisterMvcControllers(
        Assembly.GetExecutingAssembly());
    container.RegisterMvcAttributeFilterProvider();
    container.Verify();
    DependencyResolver.SetResolver(
        new SimpleInjectorDependencyResolver(container));
}

private static void InitializeContainer(
    Container container, ISessionFactory factory)
{
    container.RegisterPerWebRequest<ISession>(
        () => factory.OpenSession(), true);
}
Run Code Online (Sandbox Code Playgroud)

Initialize方法调用于Application_Start:

public class WebApiApplication : HttpApplication
{
    protected void Application_Start()
    {
        SimpleInjectorInitializer.Initialize(
            new NHibernateHelper(
                Assembly.GetCallingAssembly(), 
                this.Server.MapPath("/"))
                .SessionFactory);

        AreaRegistration.RegisterAllAreas();
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试调用控制器动作时,我得到一个ArgumentException:

类型'PositionReportApi.Controllers.PositionsController'没有默认构造函数

堆栈跟踪:

System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage请求,HttpControllerDescriptor)上的System.Web.Http.Internal.TypeActivator.Create [TBase](Type instanceType)中的System.Linq.Expressions.Expression.New(Type type) controllerDescriptor,类型controllerType)

我无法注册ISession.

如何注册工厂创建的ISession?

nhibernate session dependency-injection registration simple-injector

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