我正在尝试使用Maven设置一个项目,并且我对如何在生成的war文件中包含一些需要解包的第三方依赖项感到困惑.
我的项目包含一些自定义的ColdFusion代码,并包含Java依赖项,包括打包为war文件的ColdFusion.然后我试图包含一些第三方ColdFusion代码,我已经将其安装在我的maven资源库中打包为jar,但实际上我想在生成的war文件中将其解压缩.这就是我对第三方图书馆的解压缩.我真的希望在战争结束之前完成这项任务,以便我可以使用战争:在开发过程中爆炸.
目前我的pom.xml看起来像这样:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>my-webapp Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- This is the war overlay -->
<dependency>
<groupId>com.adobe.coldfusion</groupId>
<artifactId>coldfusion</artifactId>
<version>9.0.1</version>
<type>war</type>
<scope>runtime</scope>
<optional>false</optional>
</dependency>
<!-- This is the 3rd party ColdFusion dependency -->
<dependency>
<groupId>org.corfield</groupId>
<artifactId>fw1</artifactId>
<version>1.2RC2A</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>my-webapp</finalName>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
通过修改构建部分,我有点做了我想要的事情,如下所示:
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.corfield</groupId>
<artifactId>fw1</artifactId>
<version>1.2RC2A</version>
<type>jar</type> …Run Code Online (Sandbox Code Playgroud) 我有一个问题是解密消息usgin X.509证书.
我使用makecert生成我的证书:
makecert -r -pe -n "CN=MyCertificate" -ss CA -sr CurrentUser -a sha1 -sky signature -cy authority -sv CA.pvk CA.cer
Run Code Online (Sandbox Code Playgroud)
PrivateKey是"mypassword".
我的问题是当我想解密用c#中的先前证书加密的消息时.
我发现这个类http://blog.shutupandcode.net/?p=660,但是在X509Decrypt方法中,PrivateKey一直是null.
public static byte[] X509Decrypt(byte[] data, string certificateFile, string password)
{
// load the certificate and decrypt the specified data
using (var ss = new System.Security.SecureString())
{
foreach (var keyChar in password.ToCharArray())
ss.AppendChar(keyChar);
// load the password protected certificate file
X509Certificate2 cert = new X509Certificate2(certificateFile, ss);
using (RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PrivateKey)
{
return … 我有一个我想要规范化的向量列表(在Python中),同时删除最初具有小规范的向量.
输入列表例如是
a = [(1,1),(1,2),(2,2),(3,4)]
Run Code Online (Sandbox Code Playgroud)
我需要输出为(x*n,y*n),其中n =(x*2 + y*2)** - 0.5
例如,如果我只需要规范,那么列表理解就很容易:
an = [ (x**2+y**2)**0.5 for x,y in a ]
Run Code Online (Sandbox Code Playgroud)
例如,也可以很容易地存储一个标准化的x,但我想要的是将这个临时变量"n"用于两次计算,然后抛弃它.
我也不能只使用lambda函数,因为我还需要n来过滤列表.那么最好的方法是什么?
现在我在这里使用这个嵌套列表理解(在内部列表中有一个表达式):
a = [(1,1),(1,2),(2,2),(3,4)]
[(x*n,y*n) for (n,x,y) in (( (x**2.+y**2.)**-0.5 ,x,y) for x,y in a) if n < 0.4]
# Out[14]:
# [(0.70710678118654757, 0.70710678118654757),
# (0.60000000000000009, 0.80000000000000004)]
Run Code Online (Sandbox Code Playgroud)
内部列表生成带有额外值(n)的元组,然后我将这些值用于计算和过滤.这真的是最好的方式吗?我应该注意哪些可怕的低效率?
使用新的代码片段,我问自己一个问题:多个typedef是否在同一基本类型上影响性能?
示例(我知道这很愚蠢,但这就是我实际看到的,typedef的四个级别...):
typedef float T_FLOAT
typedef T_FLOAT T_TIME
typedef T_TIME T_CURRENTTIME
tyoedef T_CURRENTTIME CLOCKCURRENTTIME
// etc.
Run Code Online (Sandbox Code Playgroud)
我正在使用的应用程序非常庞大(数十万LoC),所以我想知道......
在GCC中使用-02(有时是-03),是否将这4种类型中的每一种都计算为基类型?
任何抬头赞赏=)
假设你想利用移动语义,但你的一个可移动类需要成为一部分std::pair.目的是创建一个函数,该函数返回一个std::pair可被视为右值并转发的函数.
但我无法看到如何做到这一点,除非对其std::pair自身进行内部更改,以使其了解移动语义.
请考虑以下代码:
struct Foo
{
Foo() { }
Foo(Foo&& f) { }
private:
Foo(const Foo& f) { } // do not allow copying
};
int main()
{
Foo f;
std::pair<Foo, int> res = std::make_pair(f, 10); // fails due to private copy constructor
}
Run Code Online (Sandbox Code Playgroud)
问题是std::make_pair,除了std::pair构造函数本身之外,还需要两个对象并尝试制作它们的内部副本.这导致它尝试并调用复制构造函数.但在我的例子中,我希望能够将新对移动到res,并确保不会制作副本.我认为除非std::pair自己在内部定义了以下构造函数,否则这是不可能的:
pair(T1&& t1, T2&& t2) : first(std::move(t1)), second(std::move(t2))
Run Code Online (Sandbox Code Playgroud)
但它没有,至少在我使用的编译器上没有(gcc 4.3.2).这可能是因为我的编译器是简单地外的日期,而事实上新版本将拥有这一举动感知构造.但是我对移动语义的理解目前有点不稳定,所以我不确定我是否只是在这里忽略了一些东西.那么,我是否正在努力实现,而不是实际重新实现std::pair?或者我的编译器是否已过时?
我需要此更新查询在SQL Server和Oracle上运行.如果重要的话,我们的Oracle版本是10.2.当我在Oracle中运行查询时,我得到"ERROR ORA-00933:SQL命令未正确结束".为了让它在Oracle中运行,我需要做什么?
UPDATE dbo.tableUpdate
SET fieldA = tt.fieldB
FROM dbo.tableTranslate tt
WHERE
tt.fieldC = dbo.tableUpdate.fieldC
AND
tt.fieldD = dbo.tableUpdate.fieldA
AND
1 = (
SELECT COUNT(tblTrans.fieldD)
FROM dbo.tableTranslate tblTrans
WHERE
tblTrans.fieldC = dbo.tableUpdate.fieldC
AND
tblTrans.fieldD = dbo.tableUpdate.fieldA
)
Run Code Online (Sandbox Code Playgroud) 我们使用的是JBoss 4.2.3,后者又带有Hibernate的3.2.1.ga版本.我想使用支持JPA 2.0的Hibernate 3.5.1-FINAL.我一直试图通过将我自己的hibernate jar放在我的WEB-INF/lib文件夹中并在jboss-web.xml中为我的WAR创建自己的类加载器来完成这项工作.
<jboss-web>
<loader-repository>
com.moo.foo:archive=catalog-archive
</loader-repository>
</jboss-web>
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
com.moo.catalog:loader=catalogLoader
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
</jboss-web>
Run Code Online (Sandbox Code Playgroud)
但是我遇到了各种各样的问题,这是我目前坚持的例外:
Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.hibernate.cfg.AnnotationConfiguration.applyHibernateValidatorLegacyConstraintsOnDDL(AnnotationConfiguration.java:443)
Run Code Online (Sandbox Code Playgroud)
由于截止日期即将来临,我想我最好问一下它是否可能?:)
可能重复:
在Java中将字符串拆分为相等长度的子字符串
鉴于以下实用方法,我有:
/**
* Splits string <tt>s</tt> into chunks of size <tt>chunkSize</tt>
*
* @param s the string to split; must not be null
* @param chunkSize number of chars in each chuck; must be greater than 0
* @return The original string in chunks
*/
public static List<String> splitInChunks(String s, int chunkSize) {
Preconditions.checkArgument(chunkSize > 0);
List<String> result = Lists.newArrayList();
int length = s.length();
for (int i = 0; i < length; i += chunkSize) {
result.add(s.substring(i, Math.min(length, …Run Code Online (Sandbox Code Playgroud) 我在一个页面中使用多个ui主题.我会创建一个带css范围的自定义主题#scope.我在范围内使用了一个datepicker字段#scope input#datepicker.datepicker字段不会css从ui主题获取样式.我想这是因为它是在外部动态创建的#scope,我该如何改变它,以及如何使它从范围内获取样式.
看到代码,然后你会明白我的困惑.
Test.h
class Test {
public:
#ifndef HIDE_VARIABLE
int m_Test[10];
#endif
};
Run Code Online (Sandbox Code Playgroud)
Aho.h
class Test;
int GetSizeA();
Test* GetNewTestA();
Run Code Online (Sandbox Code Playgroud)
Aho.cpp
//#define HIDE_VARIABLE
#include "Test.h"
#include "Aho.h"
int GetSizeA() { return sizeof(Test); }
Test* GetNewTestA() { return new Test(); }
Run Code Online (Sandbox Code Playgroud)
Bho.h
class Test;
int GetSizeB();
Test* GetNewTestB();
Run Code Online (Sandbox Code Playgroud)
Bho.cpp
#define HIDE_VARIABLE // important!
#include "Test.h"
#include "Bho.h"
int GetSizeB() { return sizeof(Test); }
Test* GetNewTestB() { return new Test(); }
Run Code Online (Sandbox Code Playgroud)
TestPrj.cpp
#include "Aho.h"
#include "Bho.h"
#include "Test.h"
int _tmain(int argc, _TCHAR* argv[]) …Run Code Online (Sandbox Code Playgroud) c++ ×3
java ×2
.net ×1
c# ×1
c++11 ×1
certificate ×1
classloader ×1
coldfusion ×1
css ×1
datepicker ×1
filtering ×1
hibernate ×1
jboss ×1
jquery ×1
jquery-ui ×1
list ×1
mapping ×1
maven ×1
maven-2 ×1
ora-00933 ×1
oracle ×1
private-key ×1
python ×1
split ×1
sql ×1
sql-server ×1
std-pair ×1
string ×1
typedef ×1
visual-c++ ×1