小编roj*_*anu的帖子

在jar文件中引用XSD架构

我有两个模式文件,一个从另一个导入.在Eclipse模式中执行代码时,但是找不到jar模式文件中的代码

这是代码

SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        factory.setValidating(false);

        SchemaFactory schemaFactory = SchemaFactory
                .newInstance("http://www.w3.org/2001/XMLSchema");
        try {
            factory.setSchema(schemaFactory.newSchema(new Source[] {
                    new StreamSource(getClass().getResource("Liso.xsd")
                            .getFile()),
                    new StreamSource(getClass().getResource("LisoXml.xsd")
                            .getFile()) }));
                this.saxParser = factory.newSAXParser();
        } catch (SAXException se) {
            System.out.println("SCHEMA : " + se.getMessage()); // problem in the XSD itself
        }
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误

SCHEMA : schema_reference.4: Failed to read schema document 'file:/C:/Tools/lib/LisoTools.jar!/com/xerox/liso/xml/Liso.xsd', because 1) could not find the do
cument; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. …
Run Code Online (Sandbox Code Playgroud)

java xsd jar

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

如何在PowerShell中创建printf效果

当脚本进行时,如何让我的PowerShell脚本以表格格式打印信息.

在bash我会这样做

printf "%s\t%-15.15s" "Locale" "Jar"
if($verbose);then
   printf "%-15.15s %-15.15s" "HelpSet" "Exception"
fi
printf "\t%s\n" "Status"
...
printf "%s\t%-15.15s" $locale $helpFileName
if($verbose); then
   printf "%-15.15s %-15.15s" "$helpSetName" ${exclusion[$helpFileName]}
fi
status="OK"
...
if ($fixed); then
   status="CORRECTED"
fi
printf "\t%s\n" $status
Run Code Online (Sandbox Code Playgroud)

要得到

Locale  Jar            HelpSet         Exception        Status
de      help_D150      help_D150                        CORRECTED

es      help_D150      help_D150                        OK

fr      help_D150      help_D150                        OK

it      Locale folder not found

nl      help_D150      help_D150                        CORRECTED
Run Code Online (Sandbox Code Playgroud)

谢谢

powershell printf

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

Oracle:如何使用不同的where子句以最佳方式执行多个计数?

我需要计算来自同一个表的不同where子句的行.以下是我所需的输出

Bu   #A   #B  #C  #D #E #F #G  #H  #J  #K  #L   #M  #N
GB01 267  284 84  45 35 32 458 801 111 899 892  56  99
NL01 132  844 65  28 26 12 627 321 56  681 1062 127 128
Run Code Online (Sandbox Code Playgroud)

每列都有自己的标准,到目前为止,我有以下SQL,但它看起来很丑,并没有完全返回我需要的内容

SELECT *  FROM (
  SELECT
    c_unit_code,
    COUNT(*) AS ADVICE_EXPORT,
    0 AS CONFIRMATION_EXPORT,
    0 AS ISSUANCE_STANDBY
  FROM EXIMTRX.EPLC_MASTER
  WHERE (CLS_FLG NOT LIKE 'YES' OR CLS_FLG IS NULL) AND (
    form_of_lc LIKE 'IRREVOCABLE' OR
    form_of_lc LIKE 'REVOCABLE' OR …
Run Code Online (Sandbox Code Playgroud)

oracle count where-clause multiple-columns

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

如何Ant代理Windows环境变量

我想让ANT和IVY在代理服务器后面工作.

SetProxy任务工作正常

<target name="proxy">
    <property name="proxy.host" value="proxy.server.com" />
    <property name="proxy.port" value="8080" />
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" />
</target>
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用环境变量时

set ANT_OPTS="-Dhttp.proxyHost=proxy.server.com -Dhttp.proxyPort=8080"
Run Code Online (Sandbox Code Playgroud)

Ivy无法连接到repos,这里是代理的Ant属性输出

[echoproperties] http.proxyHost=proxy.server.com -Dhttp.proxyPort\=8080
Run Code Online (Sandbox Code Playgroud)

当我尝试"autoproxy"论证无济于事

ant -autoproxy deploy
Run Code Online (Sandbox Code Playgroud)

这是ANT的结果

C:\Workspace\DevProjects\fxin>ant -Dproxy.host=proxy.eur.xerox.com -Dproxy.port=8000 deploy
Buildfile: C:\Workspace\DevProjects\fxin\build.xml

load-properties:
     [echo] Using properties file: build.properties

download-ivy:
[echoproperties] #Ant properties
[echoproperties] #Wed Dec 14 10:05:03 GMT 2011
[echoproperties] ant.core.lib=C\:\\Tools\\apache-ant-1.8.2\\lib\\ant.jar
[echoproperties] ant.file=C\:\\Workspace\\DevProjects\\fxin\\build.xml
[echoproperties] ant.file.fxin=C\:\\Workspace\\DevProjects\\fxin\\build.xml
[echoproperties] ant.file.type=file
[echoproperties] ant.file.type.fxin=file
[echoproperties] ant.home=C\:\\Tools\\apache-ant-1.8.2
[echoproperties] ant.java.version=1.7
[echoproperties] ant.library.dir=C\:\\Tools\\apache-ant-1.8.2\\lib
[echoproperties] ant.project.default-target=usage
[echoproperties] ant.project.invoked-targets=deploy
[echoproperties] ant.project.name=fxin
[echoproperties] ant.version=Apache Ant(TM) version 1.8.2 …
Run Code Online (Sandbox Code Playgroud)

ant proxy ivy

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

scalamock 模拟 java 接口方法 varargs

我需要使用 java 接口中的可变参数来模拟一个方法

public interface MyClient {
    MyResponse indexPrivileges(IndexPrivilege... parameters);
}
Run Code Online (Sandbox Code Playgroud)

我在嘲笑它

(mockMyClient.indexPrivileges _).expects(*).returns(response)
Run Code Online (Sandbox Code Playgroud)

但得到一个错误

[error] /projects/lib-scala-projects/src/test/scala/com/example/MyManagerTest.scala:67: value expects is not a member of com.example.parameters.IndexPrivilege* => com.example.MyResponse
[error]       (mockMyClient.indexPrivileges _).expects(*).returns(response)
[error]                                        ^
Run Code Online (Sandbox Code Playgroud)

另外,我尝试传递 IndexPrivilege 的 Seq 无济于事

(mockMyClient.indexPrivileges _).expects(privileges).returns(response)
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

unit-testing scalatest scalamock

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

grep和sed,文件名中包含空格

目前,我有

grep -irl $schema $WORKDIR/ | xargs sed -i 's/'"$schema"'/EXI1/gI'
Run Code Online (Sandbox Code Playgroud)

这对于带空格的文件名不起作用.

任何想法,如何递归搜索和替换所有文件?

谢谢

linux search grep replace sed

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

如何使用特征聚合akka-http路由?

我试图在运行时使用特征聚合路由,到目前为止我有

object SMController {
  def aggregateRoutes(actorSystem: ActorSystem): List[Route] = {
    val runtimeMirror = universe.runtimeMirror(getClass.getClassLoader)
    val reflections = new Reflections("com.example.api")
    val subclasses = reflections.getSubTypesOf(classOf[Routable])
    val routesList = new ListBuffer[Route]()

    for (i <- subclasses) {
      val module = runtimeMirror.staticModule(i.getName)
      val obj = runtimeMirror.reflectModule(module)
      val someTrait: Routable = obj.instance.asInstanceOf[Routable]
      routesList += someTrait.getAllRoutes(actorSystem)
    }

    routesList.toList
  }
}
Run Code Online (Sandbox Code Playgroud)

显然上面的代码不起作用,因为无法将项目列表传递给Http().bindAndHandle.

所以我的问题是,我怎么能解析List[Routes]到一个Http().bindAndHandle接受或者我怎么能动态地从子类加载路线Routable

scala dynamic akka-http spray-routing

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

Generate 12 Digit HEX number in KSH

I need to generate 12 digit Hex numbers in KSH on Solaris

Thanks

linux scripting ksh solaris

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