小编alb*_*iff的帖子

Android ndk std :: to_string支持

我正在使用android NDK r9d和toolchain 4.8但我无法使用std :: to_string函数,编译器抛出此错误:

 error: 'to_string' is not a member of 'std'
Run Code Online (Sandbox Code Playgroud)

android ndk不支持此功能吗?我试着APP_CPPFLAGS := -std=c++11没有运气.

c++ android std c++-standard-library android-ndk

48
推荐指数
3
解决办法
3万
查看次数

使用hudson的管道插件获取内联管道脚本中的当前时间戳

我想使用hudson的管道插件获取内联管道脚本中的当前时间戳.用于设置构建显示名称.

使用的内联groovy脚本:

def jobName = env.JOB_NAME + "_" + new Date()
currentBuild.displayName = "$jobName"
node {
   echo "job name $jobName"
}
Run Code Online (Sandbox Code Playgroud)

控制台出错:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: 
  Scripts not permitted to use new java.util.Date
Run Code Online (Sandbox Code Playgroud)

groovy jenkins jenkins-pipeline

13
推荐指数
5
解决办法
3万
查看次数

如何在Jaxb编写的XML中添加<![CDATA [和]]>

如何使用CDATA准备XML,

我通过Jaxb预先做出这个回应,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
 <SOAP-ENV:Header/>
 <soapenv:Body>
   <tem:RequestData>
     <tem:requestDocument>
        <![CDATA[
        <Request>
           <Authentication CMId="68" Function="1" Guid="5594FB83-F4D4-431F-B3C5-EA6D7A8BA795" Password="poihg321TR"/>
           <Establishment Id="4297867"/>
        </Request>
        ]]>
      </tem:requestDocument>
   </tem:RequestData>
 </soapenv:Body>
 </soapenv:Envelope>  
Run Code Online (Sandbox Code Playgroud)

但是从Jaxb我没有得到CDATA,如何把CDATA放在<tem:requestDocument>元素中.

这是我的Java代码:

  public static String test1() {
    try {
        initJB();
        String response = null;
        StringBuffer xmlStr = null;
        String strTimeStamp = null;
        com.cultagent4.travel_republic.gm.Envelope envelope = null;
        com.cultagent4.travel_republic.gm.Header header = null;
        com.cultagent4.travel_republic.gm.Body body = null;
        com.cultagent4.travel_republic.gm.RequestData requestData = null;
        com.cultagent4.travel_republic.gm.RequestDocument requestDocument = null;
        com.cultagent4.travel_republic.gm.RequestDocument.Request request = null;
        com.cultagent4.travel_republic.gm.RequestDocument.Request.Authentication authentication = null;
        com.cultagent4.travel_republic.gm.RequestDocument.Request.Establishment establishment …
Run Code Online (Sandbox Code Playgroud)

java xml jaxb cdata

11
推荐指数
3
解决办法
2万
查看次数

如何使用Groovy设置Project属性值?

我想在Project级别设置属性,使用我的groovy代码我可以在TestCase级别设置属性.如何在Project级别设置属性

这是我的代码:

import groovy.json.JsonSlurper

responseContent = testRunner.testCase.getTestStepByName("TestStepName").getPropertyValue("response")
slurperresponse = new JsonSlurper().parseText(responseContent)
slurperresponse.id.toString()
log.info (slurperresponse.id.toString())
property_name = 'a'
def idProperty = setupTestCase.getProperty(property_name).toString()
setupTestCase.setPropertyValue('a',slurperresponse.a.toString())
Run Code Online (Sandbox Code Playgroud)

这里我从TestStepName的响应中设置TestCase属性"a".我正在使用Soapui.

谢谢

groovy soapui

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

添加时出现soapui WSDL错误

添加此内容时,我不断收到此错误。有任何想法吗。我处理了其他 WSDL 链接,除此之外它们都很好。

org.apache.xmlbeans.XmlException:javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效认证路径

ssl wsdl ssl-certificate

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

PKCS#11实例化问题

我正在尝试使用智能卡和PKCS#11签署pdf文件.我链接正确的.dll,我正在动态制作配置文件,但我遇到了配置问题.

String config = "name=zz\n" +
                "library=" + DLL + "\n" +
                "slotListIndex = " + getSlotsWithTokens(DLL)[0];
ByteArrayInputStream pot = new ByteArrayInputStream(config.getBytes());
Provider providerPKCS11 = new SunPKCS11(pot);
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Exception in thread "main" java.security.ProviderException: Initialization failed
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:376)
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:107)
    at smartCardPKCS11.scPKCS11.main(scPKCS11.java:56)
Caused by: java.security.ProviderException: slotListIndex is 52481 but token only has 10 slots
    at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:357)
    ... 2 more
Run Code Online (Sandbox Code Playgroud)

在整个插槽事情上有点困惑.有人可以帮我吗?

我的getSlotsWithTokens看起来如何:

public static long[] getSlotsWithTokens(String libraryPath) throws IOException{
        CK_C_INITIALIZE_ARGS initArgs = new CK_C_INITIALIZE_ARGS();
        String functionList = "C_GetFunctionList";

        initArgs.flags = 0;
        PKCS11 …
Run Code Online (Sandbox Code Playgroud)

java cryptography digital-signature pkcs#11

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

JPA Criteria API - 使用 ORACLE 将天数添加到 DATE

我正在尝试使用 JPA Criteria API 来过滤特定范围之间的日期。

问题是我的实体中没有直接日期,我使用日期字段获取日期并将天数(在另一个字段中)添加到该日期。

我环顾四周,看到一些建议在将日期传递给标准构建器之前先用 java 计算日期,但问题是我不知道要添加的天数,因为它取决于特定列中的天数桌子。

简化的表 OBJECT 有一个类型为 date 的字段 CREATION_DATE 和一个数字类型的 EXPIRATION_DAYS。我想通过一系列可能的到期日期进行过滤,我得到了 OBJECT 表中每个元素的到期日期,将 EXPIRATION_DAYS 添加到 CREATION_DATE,SQL 查询是:

select * from OBJECT
where CREATION_DATE + EXPIRATION_DAYS 
between to_date('01/01/2018','dd/MM/yyyy') and to_date('01/02/2018','dd/MM/yyyy') 
Run Code Online (Sandbox Code Playgroud)

CriteriaBuilder我做了一些尝试,但我想我尽量用最好的方法是如下:

 CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
 CriteriaQuery<Object> criteria = criteriaBuilder.createQuery(Object.class);
 List<Predicate> predicates...
 predicates.add(criteriaBuilder.between(
        criteriaBuilder.function("AddDate", Date.class, Object.get("creationDate"), criteriaBuilder.literal("day"), Object.get("expirationDays")), 
        dateInit, dateEnd));
 criteria.where(predicates.toArray(new Predicate[]{}));        
 ...
  TypedQuery<Object> query = entityManager.createQuery(criteria);
  return query.getResultList();
Run Code Online (Sandbox Code Playgroud)

我使用function("addDate"...)方法,问题是我认为 JPA 实现将“addDate”转换为特定的数据库供应商,但事实并非如此,因为它抛出了以下非常清楚的异常:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
Internal …
Run Code Online (Sandbox Code Playgroud)

oracle jpa oracle10g criteria-api

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

android蓝牙连接失败(isSocketAllowedBySecurityPolicy start:device null)

我正在尝试用蓝牙连接两部手机(galaxy note1,galaxy note2),但是套接字连接失败.

这是我的LogCat:

 I/BluetoothService(24036): BEGIN mConnectThread
 D/BluetoothUtils(24036): isSocketAllowedBySecurityPolicy start : device null
 D/BluetoothService(24036): setState() 2 -> 1
 D/BluetoothService(24036): Connect Fail
 D/BluetoothService(24036): start
 V/BluetoothSocket.cpp(24036): abortNative
 V/BluetoothSocket.cpp(24036): ...asocket_abort(56) complete
 V/BluetoothSocket.cpp(24036): destroyNative
 V/BluetoothSocket.cpp(24036): ...asocket_destroy(56) complete
 D/BluetoothUtils(24036): isSocketAllowedBySecurityPolicy start : device null
 D/BluetoothService(24036): setState() 1 -> 1
 D/BluetoothService(24036): Connect Fail
 D/BluetoothService(24036): start
Run Code Online (Sandbox Code Playgroud)

我不知道为什么会发生'连接失败'.

isSocketAllowedBySecurityPolicy start:device null'有问题吗?或蓝牙uuid不正确?

你能告诉我这是什么问题以及如何解决这个问题?

我还添加了关于bluetoothservice部分的src代码

public class BluetoothService {
// Debugging
private static final String TAG = "BluetoothService";

// Intent request code
private static final int REQUEST_CONNECT_DEVICE = 1;
private …
Run Code Online (Sandbox Code Playgroud)

android bluetooth connect

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

在模拟服务 URL 中使用通配符

我需要模拟一个休息服务,该模拟已经在 SoapUI 上运行了。问题是我创建了一个带有这样的 URL 的模拟/test/userA/

有没有办法创建一个也能响应 url 的模拟/test/userB/?我在想类似/test/user?/或 的东西test/user[A-Z]/。用 SoapUI 可以吗?

rest groovy mocking soapui

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

我必须传递来自 CMSSignedData 对象的哪些数据才能生成有效的时间戳?

我有一个有效的 PKCS7 文件加载到 CMSSignedData 对象中。此 PKCS7 文件包括纯文本消息和有效的附加数字签名(都在同一个文件中)。

现在我想给这个文件加上时间戳。这是我正在使用的代码(源代码):

 private static CMSSignedData addTimestamp(CMSSignedData signedData)
throws Exception {
        Collection ss = signedData.getSignerInfos().getSigners();
        SignerInformation si = (SignerInformation) ss.iterator().next();

        TimeStampToken tok = getTimeStampToken();

        ASN1InputStream asn1InputStream = new ASN1InputStream
(tok.getEncoded());
        DERObject tstDER = asn1InputStream.readObject();
        DERSet ds = new DERSet(tstDER);

        Attribute a = new Attribute(new
DERObjectIdentifier("1.2.840.113549.1.9.16.2.14"), ds);
        DEREncodableVector dv = new DEREncodableVector();
        dv.add(a);
        AttributeTable at = new AttributeTable(dv);
        si = SignerInformation.replaceUnsignedAttributes(si, at);
        ss.clear();
        ss.add(si);
        SignerInformationStore sis = new SignerInformationStore(ss);

        signedData = CMSSignedData.replaceSigners(signedData, sis);
        return …
Run Code Online (Sandbox Code Playgroud)

java validation bouncycastle trusted-timestamp pkcs#7

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